Skip to main content
GameDev.net gamedev.net
🔒 Locked

Makefile Question

Started by RegularKid Jan 10, 2003 at 10:51 AM 2 replies 250+ views
Original Post
RegularKid
RegularKid
Ok, I''m learing about makefiles and dependencies. I''m using gcc for the gameboy advance, and to get a list of dependencies, I do this:
  
gcc -c -M file1.c file2.c file3.c > cdepend 
  
This works perfectly and the file "cdepend" contained all the dependencies for all my .o files and everything was just great! Then I copied the above line into my make file like so:
  
depend : 
    gcc -c -M file1.c file2.c file3.c > cdepend 
  
Then I called the makefile like so:
  
make -f Makefile.mak depend
  
It should work the exact same, except it gives me this error:
  
MAKE: *** [depend] Error 1 
  
and my cdepend file is empty! Is there something I''m missing here? Any suggestions? Thanks!
cgoat
cgoat
If you're on a Linux/Unix machine, make sure the Makefile is in UNIX text mode (line-feed only), not DOS. Also, I don't think you want the -c option in the depend line. Just -M will do.

Although if you want to go all out, the best way to use dependencies is to have the makefile build them automatically when a source file changes, as documented on the GNU site:

http://www.gnu.org/manual/make/html_chapter/make_4.html#SEC51

[edited by - cgoat on January 10, 2003 12:21:59 PM]
RegularKid
RegularKid
Yeah, I tried both suggestions, but it still doesn''t work. The strange thing is that this command works flawlessly from the command line. But when I tries to run it from inside the makefile, it returns an error! ARGGGHHHH! Any more suggestions?

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.