gbadev.org forum archive

This is a read-only mirror of the content originally found on forum.gbadev.org (now offline), salvaged from Wayback machine copies. A new forum can be found here.

Beginners > Newbie needs help w/ Visual Studio 2k3.NET makefiles

#27333 - hisshouburaiken - Sun Oct 10, 2004 4:23 pm

Hi all, I've just recently gotten into GBA development, i'm still just messing with pixels and stuff at this point (my pride and joy is an etch-a-sketch). I've been working with HAM but I recent got Visual Studio .NET 2K3 and want to start using it as the IDE. I've followed the popular setup tutorials but I'm having trouble getting VS to compile them. Unless I'm on crack or my brain is subconsciously fixing a subtle error, this is a proper makefile (it's copied directly from GBAdev's makefile tutorial):

Code:
CC = gcc
CFLAGS = -c
THUMBMODEL = -mthumb -mthumb-interwork

all: movepixel.gba

movepixel.gba: movepixel.elf
   objcopy -O binary movepixel.elf movepixel.gba

movepixel.elf: main.o
   $(CC) -o movepixel.elf main.o

main.o: main.c basic.h
   $(CC) $(CFLAGS) $(THUMBMODEL) main.c
   


VS gives me this error, whether I use nmake or gnu:


Code:
movepixel fatal error U1073: don't know how to make 'main.c'


What's wrong? My main target should work fine here, right?

Any help is appreciated. Once I get it compiling you have my word my next newbie question will at least have some substance to it :)

#27336 - sajiimori - Sun Oct 10, 2004 7:33 pm

My guesses: either VS.NET is not compatible with Unix-style makefiles, or main.c doesn't exist in the current directory when the makefile is executed. If the makefile and main.c are in the same directory, be sure the make utility is being executed from that directory.

#27338 - dist0rted - Sun Oct 10, 2004 9:06 pm

See the line where it says:

main.o: main.c basic.h

You don't have a line that says:

main.c:

or

basic.h:

so it won't be able to do that step since you have no declaration. (Get what I'm saying?)

Change that line to just:

main.o:
$(CC) $(CFLAGS) $(THUMBMODEL) main.c

Tell me if that works
_________________
All knowledge is good; only the way it is put to use is good or evil.

#27339 - sajiimori - Sun Oct 10, 2004 9:27 pm

dist0rted, that's not really how make rules work. The things on the left of the colon are targets, and on the right are prerequisites.

If a prerequisite doesn't exist, make will look for a rule to build it, and in this case it won't find such a rule. If the prerequisite already exists, make won't look for the rule.

If a prerequisite is newer than a target, then the target gets rebuilt. That's the purpose of having main.o depend on main.c.

#27346 - hisshouburaiken - Mon Oct 11, 2004 2:17 am

Thanks for the replies, it turned out to be a typical bonehead thing where I had changed the name of a source file without updating it in VS...all the googling in the world doesn't seem to tell you "check your filenames". I'm all set w/VS now, after a few more issues figuring out where to slap the thumb include options.