# 1 ########################### #### VARIABLES DEFINITION #### #### SHOULDN'T BE MODIFIED #### ############################### # compiler (can be replaced by clang) CC = gcc # linker LD = $(CC) # compiler options ## -Wall: most warnings ## -pedantic: more warnings ## -g: debugging symbols ## -std=c99: ### accept C++ // comments ### accept C++-like variable declaration: anywhere in functions and in for(int i; ...; ...) ### disable GNU extensions for better compatibility with other compilers (clang, msvc) CFLAGS = -Wall -pedantic -g -std=c99 # linker options LDFLAGS = # 2 ############################################## #### SOURCE LIST AND EXECUTABLES NAMES #### #### MODIFY TO ADD OTHER TARGETS IF NECESSARY #### ################################################## # to add other targets: ## add SOURCE3, etc. ## and EXE3, etc. # SOURCES: list of C filenames needed to build the executables SOURCES1 = Automaton.c testAutomaton.c SOURCES2 = Automaton.c reg_op.c interpreteur.c draw.c Stack.c RegisterFile.c # EXE: name of the executables produced EXE1 = testAutomaton EXE2 = interpreteur # 3 #################################### #### TARGETS REFERENCING EXECUTABLE #### #### CHANGE ACCORDINGLY TO 2 #### ######################################## # default targets all: Makefile.d $(EXE1) $(EXE2) # build the executable 1 $(EXE1): $(SOURCES1:%.c=%.o) $(LD) $^ -o $@ $(LDFLAGS) # build the executable 2 $(EXE2): $(SOURCES2:%.c=%.o) $(LD) $^ -o $@ $(LDFLAGS) # clean everything but sources distclean: clean $(RM) $(EXE1) $(EXE2) # 4 ################################## #### GENERIC TARGETS #### #### DO NOT MODIFY ANYTHING BELOW #### ###################################### # create .o from .c .c.o: $(CC) -c $(CFLAGS) $< # remove non essential files clean: $(RM) *.o *~ *.log Makefile.d *.tmp .*tmp # only real files can be non phony targets .PHONY: all clean distclean debug release # for .h dependencies Makefile.d: $(CC) -MM *.c > Makefile.d # for .h dependencies -include Makefile.d