CC = gcc PROF = -O -g NOCRYPT = C_FLAGS = -Wall -W $(PROF) $(NOCRYPT) L_FLAGS = $(PROF) O_FILES = act_comm.o act_enter.o act_info.o act_move.o act_obj.o act_wiz.o \ alias.o ban.o comm.o const.o db.o db2.o effects.o fight.o flags.o \ handler.o healer.o interp.o note.o lookup.o magic.o magic2.o \ music.o recycle.o save.o scan.o skills.o special.o tables.o \ update.o rom: $(O_FILES) $(CC) $(L_FLAGS) -o rom $(O_FILES) # pull in dependency info for *existing* .o files -include $(O_FILES:.o=.d) # compile and generate dependency info; # more complicated dependency computation, so all prereqs listed # will also become command-less, prereq-less targets # sed: append directory to object target. (gcc bug?) # sed: strip the target (everything before colon) # sed: remove any continuation backslashes # fmt -1: list words one per line # sed: strip leading spaces # sed: add trailing colons %.o: %.c $(CC) -c $(C_FLAGS) $*.c -o $*.o $(CC) -MM $(C_FLAGS) $*.c > $*.d @mv -f $*.d $*.d.tmp @sed -e 's|.*:|$*.o:|' < $*.d.tmp > $*.d @sed -e 's/.*://' -e 's/\\$$//' < $*.d.tmp | fmt -1 | \ sed -e 's/^ *//' -e 's/$$/:/' >> $*.d @rm -f $*.d.tmp clean : rm -rf rom $(O_FILES) $(O_FILES:.o=.d)
Powered by [web hosting]