That'll work just fine for simple projects but once you get more source files it may get harder to manage. also adding a .PHONY: line is helpful just incase there is a file named clean.
This may be a better template makefile for future projects. %.o matches any argument to make with a .o ending. $^ matches the entire dependencies list $< matches the first file in the dependencies list $@ matches the target. ********************************** NAME=MiniRF.elf CPU = msp430x1121 DEPS = tx.inc sw1const.inc CC = msp430-gcc COPT = -mmcu=${CPU} -O2 -Wall -g .PHONY: clean MiniRF.elf : tx.o int1switch.o ${CC} -mmcu=${CPU} -Wall -O2 -o $@ $^ %.o : %.c %.h ${DEPS} ${CC} ${COPT} -c $< clean: rm -f ${NAME} ${NAME}.a43 ${NAME}.lst ${NAME}.ini *.o ************************************************** -----Original Message----- From: Mark Skeels [mailto:meske...@earthlink.net] Sent: Saturday, August 23, 2003 6:28 AM To: mspgcc-users@lists.sourceforge.net Subject: Re: [Mspgcc-users] compiling multiple source files Thanks to all who helped me with the make file information. I managd to cobble together a crude makefile implementation which produced a valid *.elf file for GDB-Insight. Here it is: ********************************** NAME=MiniRF.elf CPU = msp430x1121 CC = msp430-gcc COPT = -mmcu=${CPU} -O2 -Wall -g MiniRF.elf : tx.o int1switch.o ${CC} -mmcu=${CPU} -Wall -O2 -o MiniRF.elf tx.o int1switch.o tx.o : tx.c tx.h tx.inc sw1const.inc ${CC} ${COPT} -c tx.c int1switch.o : int1switch.c int1switch.h tx.inc sw1const.inc ${CC} ${COPT} -c int1switch.c clean: rm -f ${NAME} ${NAME}.a43 ${NAME}.lst ${NAME}.ini *.o ************************************************** Comments? Thanks, Mark ------------------------------------------------------- This SF.net email is sponsored by: VM Ware With VMware you can run multiple operating systems on a single machine. WITHOUT REBOOTING! Mix Linux / Windows / Novell virtual machines at the same time. Free trial click here:http://www.vmware.com/wl/offer/358/0 _______________________________________________ Mspgcc-users mailing list Mspgcc-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/mspgcc-users