############################################
# MAKEFILE FOR main.exe -- last rev 2003-11-14 TGH
# NOTES:
# - This makefile was designed for compilation using MinGW under Win32
# - Get GNU tools for Win32 (http://sourceforge.net/projects/unxutils/)
# - Get MinGW (http://www.mingw.org/)
# - Get MSYS (http://www.mingw.org/msys.shtml)
# - Make sure that the GNU tools and MinGW are in your PATH= statement
# - Start the MSYS shell, cd to your project file and type "make all" to compile
############################################
# MACRO DEFINITIONS
# (hint: "make -p" will spit out a default list for your environment)
# $@ - name of the file to be made (e.g. "main.o")
# $? - names of the changed dependents
CC=gcc
LINK=$(CC)
#COMPILE FLAGS - CFLAGS2 appears at the end of the command
CFLAGS1=
CFLAGS2=
#CFDEBUG= -Wp,-DDEBUG
CFDEBUG=
#LINK FLAGS - LFLAGS2 appears at the end of the command
LFLAGS1=
LFLAGS2=
#OBJS is the list of all object files created by the compiles
OBJS=module1.o module2.o main.o
PROGNAME=main.exe
############################################
# IMPLICIT RULES
# $< - name of the related file that caused the action (e.g. "main.c")
# $* - prefix shared by both the target and the dependent (e.g. "main")
.c.o:
$(CC) $(CFLAGS1) $(CFDEBUG) -c -o $@ $*.c $(CFLAGS2)
.o.exe:
$(LINK) $(LFLAGS1) -o $@ $? $(LFLAGS2)
############################################
# MAKE TARGETS (all, clean, install, etc)
# - all: should be the first link target within the make file
all: $(PROGNAME)
clean:
-rm $(OBJS)
-rm $(PROGNAME)
install:
@echo No action taken.
############################################
# MODULES TO BE COMPILED
module1.o: module1.c module1.h
module2.o: module2.c module2.h
main.o: main.c module1.h module2.h
############################################
# PROGRAM TO BE COMPILED (.EXE)
$(PROGNAME): $(OBJS)
$(LINK) $(LFLAGS1) -o $@ $(OBJS) $(LFLAGS2)
### END OF MAKEFILE ###
Labels: 2003