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)
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))
tests: test.o
-rm -f $(ALLEXE)
- LDFLAGS="$$LDFLAGS test.o" $(MAKE) all
+ LDOPTS="test.o" $(MAKE) all
$(MAKE) $(addprefix test_,$(ALLEXE))
## Main rules
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
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 \
$(call TITLE, "Building $@")
$(call GETCOMMENTS,test, $<) > $@
$(call PASS, SUCCESS)
+ -rm -f _
test_%: %.test %.exe
IFS=$$'\n'; RC=0; \