From: Laurent Mazet Date: Tue, 16 Jul 2024 06:07:05 +0000 (+0200) Subject: correct makefile X-Git-Tag: v1.0~10 X-Git-Url: https://secure.softndesign.org/git/?a=commitdiff_plain;h=9ea2e7fcfc5da739484b707a8a82408f63acbc5b;p=checkers.git correct makefile --- diff --git a/makefile b/makefile index 7329ad3..3f2fd95 100644 --- a/makefile +++ b/makefile @@ -13,7 +13,7 @@ OFLAGS = -O4 -Os CFLAGS += -W -Wall -Wextra -g #CFLAGS += -std=c99 -D_XOPEN_SOURCE=500 CFLAGS += $(OFLAGS) $(INCLUDES) $(OPTIONS) -LDFLAGS += -g $(OPTIONS) +LDFLAGS += -g $(LDOPTS) $(OPTIONS) LDOPT = linker ifeq ($(OS),Windows_NT) @@ -62,7 +62,7 @@ count: clean: $(call TITLE, "Cleaning") touch clean - rm -f clean $(wildcard *.d *.ld *.log *.o *.test *~ .exec_* gmon.out) + rm -f clean $(wildcard *.d *.ld *.log *.o *.test *~ .exec_* gmon.out) _ $(call PASS, SUCCESS) depends: $(patsubst %.c, %.d, $(wildcard *.c)) $(patsubst %, %.ld, $(ALLEXE)) @@ -90,7 +90,7 @@ wipe: purge tests: test.o -rm -f $(ALLEXE) - LDFLAGS="$$LDFLAGS test.o" $(MAKE) all + LDOPTS="test.o" $(MAKE) all $(MAKE) $(addprefix test_,$(ALLEXE)) ## Main rules @@ -100,7 +100,9 @@ include $(wildcard *.ld) gcov_%: $(MAKE) purge - OPTIONS="-coverage -O0" $(MAKE) + $(MAKE) depends + $(MAKE) test.o + LDOPTS="test.o" OPTIONS="-coverage -O0" $(MAKE) ${@:gcov_%=%}.exe $(MAKE) test_$(@:gcov_%=%) gcov `sed -e 's/\.exe:/.c/;s/\.o/.c/g' $(@:gcov_%=%.ld)` touch gcov @@ -111,7 +113,8 @@ gcov_%: gprof_%: $(MAKE) purge $(MAKE) depends - OPTIONS="-pg" $(MAKE) ${@:gprof_%=%}.exe + $(MAKE) test.o + LDOPTS="test.o" OPTIONS="-pg" $(MAKE) ${@:gprof_%=%}.exe $(MAKE) ${@:gprof_%=%}.test IFS=$$'\n'; id=1; \ for test in `cat ${@:gprof_%=%}.test | sed 's,${@:gprof_%=%}.exe,./${@:gprof_%=%}.exe,g'`; do \ @@ -131,6 +134,7 @@ gprof_%: $(call TITLE, "Building $@") $(call GETCOMMENTS,test, $<) > $@ $(call PASS, SUCCESS) + -rm -f _ test_%: %.test %.exe IFS=$$'\n'; RC=0; \