# Program name PROJ = ce # Compiler to be used CC = gcc # Flags for the compiler CFLAGS = -Wall INCLUDE = . LIB = . ifdef NDEBUG OUT_DIR = release else OUT_DIR = debug CFLAGS += -g -DDEBUG endif # Build list of object files OBJ_LST = $(OUT_DIR)/fila.o \ $(OUT_DIR)/lista.o \ $(OUT_DIR)/pilha.o \ $(OUT_DIR)/ceui.o \ $(OUT_DIR)/log.o proj_$(PROJ): $(OUT_DIR) $(OUT_DIR)/$(PROJ) Makefile #******* #* WARNING i have no idea why, but if you use the target name #* to build a dir statically (as build_dir:) make does not #* show the message "make: Nothing to be done for `target_name'." #***************************************************************** $(OUT_DIR): @if [ ! -e $(OUT_DIR) ]; then \ echo "Building dir '$(OUT_DIR)'..."; \ mkdir $(OUT_DIR); \ echo "done."; \ fi $(OUT_DIR)/$(PROJ): $(OBJ_LST) $(CC) -L$(LIB) -o $@ $(OBJ_LST) -lncurses @echo "done with '$(@)'"; $(OUT_DIR)/lista.o: lista.c lista.h mycommdef.h mydebug.h $(CC) -c $(CFLAGS) -I$(INCLUDE) -o $@ $< $(OUT_DIR)/pilha.o: pilha.c pilha.h mycommdef.h mydebug.h $(CC) -c $(CFLAGS) -I$(INCLUDE) -o $@ $< $(OUT_DIR)/fila.o: fila.c fila.h mycommdef.h mydebug.h $(CC) -c $(CFLAGS) -I$(INCLUDE) -o $@ $< $(OUT_DIR)/ceui.o: ceui.c ceui.h mycommdef.h mydebug.h $(CC) -c $(CFLAGS) -I$(INCLUDE) -o $@ $< $(OUT_DIR)/log.o: log.c log.h mycommdef.h mydebug.h $(CC) -c $(CFLAGS) -I$(INCLUDE) -o $@ $< clean: -rm -f $(OUT_DIR)/*.o $(OUT_DIR)/$(PROJ) trab1-algii.tar.gz cleanall: -rm -rf $(OUT_DIR) trab1-algii.tar.gz dist: trab1-algii.tar.gz trab1-algii.tar.gz: -tar czf trab1-algii.tar.gz *.h *.c Makefile scripts/