From: Joshua L. <ani...@ho...> - 2002-11-18 19:52:16
|
I'll try this when I get home :) Thanks everyone for the help, and that site Greg included is very interesting I'd recommend checking it out. Joshua. >From: Paul Whitfield <pa...@mi...> >To: Joshua Little <ani...@ho...> >CC: min...@li... >Subject: Re: [Mingw-users] Makefile confusion. >Date: Mon, 18 Nov 2002 16:22:53 +0800 > >Joshua Little wrote: >> >>After using VC++ for so long I'm slowly getting used to using the command >>line tools included in MinGW. I'm trying to get a makefile set up so that >>all I have to do add a new .o file to the ojects list (OBJS in the >>makefile) then put in a dependancy list. I would like to use a dependency >>list generator but I'm not sure if MinGW has that (maybe in the bintools? >>I haven't looked enough yet)but I assume that it does. So I have two >>questions. My original makefile bascially lists each target and its >>dependencies that I put in manually. Well as I start to add new classes >>I'm getting tired of adding everything manually. So I looked around and >>learned about pattern matching rules and dependancy generators. Please >>excuse the length of the post because I'm really trying to find out whats >>happening I'm going to post both makefiles. Heres the first that works >>just fine : > >Ahhh... the fun of makefiles .. > >You still need the cpp files in the list, make will not >auto generate that for you > >Gcc is your friend > >gcc -M will output a dependency list for a file in >the format to include in a makefile. > >(see also gcc -MM) > >something like this can be done >This is basically, the minimalist >makefile I can make with the >features you are after. > > >CC = gcc >CCFLAGS = -g -Wall >SRCS= main.c test.c > >all: thing > ># Generate object list from source list >OBJS = $(SRCS:.c=.o) > ># make a target that depends on all objects >thing: $(OBJS) > $(CC) $(OBJS) -o $@.exe > ># Create a depend file that is updated whenever a source file is edited >.depend: $(SRCS) Makefile > $(CC) -MM $(SRCS) > .depend > ># include the generated dependency list >include .depend > > >Hope that helps > >Best regards > >Paul _________________________________________________________________ STOP MORE SPAM with the new MSN 8 and get 2 months FREE* http://join.msn.com/?page=features/junkmail |