# file: $(ECE_1111)/labs/01/l01_04/src/main/Makefile # # revision history: # 20180823 (TD): added CDEBUGS flags for linking, added a debug target to # compile source into object file with debugging and link with # debugging information to an executable with a .gdb extension # 20180820 (TD): included an exe extension when coppying myprog.exe to bin # 20180803 (TD): added the debug target for the myprog.exe target to produce # a file with debugging information # 20180724 (JP): initial version # define compilation flags # CFLAGS += -c CDEBUGS += -g # define source and object files # SRC = myprog.cc OBJ = myprog.o # define dependencies # DEPS = ../functs/myprog.h ../../lib/libmyprog.a # define include files # INCLUDES = -I../../include/ # define a target for the application # all: myprog.exe # define a target to link the application # myprog.exe: $(OBJ) $(DEPS) g++ -I../../include/ -o myprog.exe \ myprog.o \ -L../../lib -lmyprog \ -lm # define a debug target to link the application with debugging information # debug: $(OBJ) $(DEPS) g++ $(CDEBUGS) $(CFLAGS) $(SRC) $(INCLUDES) -o $(OBJ) g++ -I../../include $(CDEBUGS) -o myprog.gdb \ myprog.o \ -L../../lib -lmyprog \ -lm # define a target to compile the application # myprog.o: $(SRC) $(DEPS) g++ $(CFLAGS) $(SRC) $(INCLUDES) -o $(OBJ) # define an installation target # install: cp myprog.exe ../../bin/myprog.exe cp myprog.gdb ../../bin/myprog.gdb # define a target to clean the directory # clean: rm -f myprog.exe myprog.o myprog.gdb # # end of file