#18430 - punchy - Thu Mar 25, 2004 10:31 pm
Hi,
my project is starting to get rather large, and having all the c and s files in one directory is getting a bit messy. What's the best way of using multiple source directories in a makefile? I'm currently using a general rule to build each file as in
{$(SRCDIR)}.s.o:
$(CMPDIR)\as $(SFLAGS) $(SRCDIR)\$*.s -o$@
for asm files. What i want is some way of replacing the single source dir with a list of directories that make will check for files.
Any help would be most appreciated.
Thanks.
#18432 - Miked0801 - Thu Mar 25, 2004 10:54 pm
Look up the vpath directive for make at gnu.org (not gcc.gnu.org!). It will allow make to scan multiple directories for you - which is what you are looking for.
#18521 - punchy - Sun Mar 28, 2004 12:23 pm
I'm using VC++ as an IDE so its nMake i'm using. Must be an equivalent though. At least i know what to search for. Thanks.
#18536 - Gopher - Sun Mar 28, 2004 6:32 pm
This is related to using VC++. Am I the only one who doesn't use makefiles in VC++? I just create utility projects and define custom build steps, outputs, and dependencies. It's a little bit of work to add files to the project and get them configured to compile, but not really any more tha n updating the makefile, and VC automatically takes care of recompiling only changed files.
I haven't done a lot of work with makefiles, so maybe there's some other advantage to that approach that I'm missing, but the only advantage I see is that the project could be compiled outside of VC++ if you wanted.
Anyone got any other reasons for using makefiles instead? I'm currious because everyone who has talked about using VC++ on the forums seems to use makefiles.
_________________
"Only two things are infinite: the universe, and human stupidity. The first is debatable." -Albert Einstein
#18540 - tepples - Sun Mar 28, 2004 7:23 pm
Gopher wrote: |
It's a little bit of work to add files to the project and get them configured to compile, but not really any more than updating the makefile, and VC automatically takes care of recompiling only changed files.
I haven't done a lot of work with makefiles, so maybe there's some other advantage to that approach that I'm missing, but the only advantage I see is that the project could be compiled outside of VC++ if you wanted. |
This "only advantage" is the big one: Not everybody can afford a license of VC++ for each seat. (Remember that the version of Visual C++ with an optimizing x86 compiler costs $1089 for one seat.) Starting VC++ is slow. And some versions of VC++ have binary formats for project files, which makes it more difficult for other tools to add data to a project file.
_________________
-- Where is he?
-- Who?
-- You know, the human.
-- I think he moved to Tilwick.
#18541 - poslundc - Sun Mar 28, 2004 7:27 pm
I'd say use whatever works for you, especially if you're the only developer dealing with your stuff.
If you want to share your code with others, though, and if it's non-trivial to build, you shouldn't assume they'll be using VC++.
If someone is just starting out on GBA development and they have the choice of learning to use either makefiles or the VC++ project-interface, learning makefiles is probably the more transferrable skill of the two.
Dan.