X-Git-Url: https://secure.softndesign.org/git/?a=blobdiff_plain;f=makefile;h=49a8ae72b706b48c2250188f554624ba216e3985;hb=5e0c5bc840f7c64e93c7860cf89a058718dfeedc;hp=5b03e86e77438a3ffbef88e4892a8b01339774ba;hpb=58352bb03181bec09abf991ae982bc3bb04c5fd3;p=compress.git diff --git a/makefile b/makefile index 5b03e86..49a8ae7 100644 --- a/makefile +++ b/makefile @@ -6,12 +6,13 @@ INCLUDES = -I../debug -D__MEMORY_ALLOCATION__ #OFLAGS = -O4 -ffast-math -finline-functions OFLAGS = -O4 -finline-functions #OFLAGS += -mtune=pentium3 -mmmx -msse -msse2 -m3dnow -OFLAGS += -minline-all-stringops -fsingle-precision-constant -OFLAGS += -malign-double -CFLAGS += -Wall -Wextra -g +#OFLAGS += -minline-all-stringops -fsingle-precision-constant +#OFLAGS += -malign-double +CFLAGS += -W -Wall -Wextra -g CFLAGS += -std=c99 -D_XOPEN_SOURCE=500 CFLAGS += $(OFLAGS) $(INCLUDES) LDFLAGS += -g +LDFLAGS += -static-libgcc # Targets @@ -45,7 +46,7 @@ all: depends alltests: all $(MAKE) $(addprefix test_,$(ALLEXE:%.exe=%)) -depends: $(patsubst %.c, %.d, $(wildcard *.c)) +depends: $(patsubst %.c, %.d, $(wildcard *.c)) $(patsubst %, %.ld, $(ALLEXE)) count: wc $(wildcard *.c *.h) $(MAKEFILE_LIST) @@ -53,7 +54,7 @@ count: clean: $(call TITLE, "Cleaning") touch clean - rm -f clean $(wildcard *.d *.log *.o *.test *~ .exec_*) + rm -f clean $(wildcard *.d *.ld *.log *.o *.test *~ .exec_*) $(call PASS, SUCCESS) purge: clean @@ -65,6 +66,7 @@ purge: clean ## Main rules include $(wildcard *.d) +include $(wildcard *.ld) %.test: %.c $(call TITLE, "Building $@") @@ -73,14 +75,10 @@ include $(wildcard *.d) $(call PASS, SUCCESS) test_%: %.test %.exe - PATH=$$PATH:.; \ - IFS=$$'\n'; \ - LOGFILE=${<:.test=.log}; \ - rm -f $$LOGFILE; \ - RC=0; \ - for test in `cat $<`; do \ - echo "=== $$test ===" | tee -a $$LOGFILE; \ - ( eval $(VALGRIND) $$test ) 2>&1 | tee -a $$LOGFILE; \ + IFS=$$'\n'; RC=0; \ + for test in `cat $< | sed 's,${<:.test=.exe},./${<:.test=.exe},g'`; do \ + echo "=== $$test ==="; \ + eval $(VALGRIND) $$test; \ [ $$? -eq 0 ] && echo -e "\033[1;32mSUCCESS\033[0;0m" \ || { echo -e "\033[1;31mFAILED\033[0;0m"; RC=1; }; \ done; \ @@ -98,6 +96,11 @@ valgrind_%: % mv $@~ $@ $(call PASS, SUCCESS) +%.ld: %.c + $(call TITLE, "Building $@") + echo ${<:.c=.exe}: $(shell ./getcomments.pl -p='linker:\s' -f='%' $< | awk '{for (i=1;i<=NF;i++) if ($$(i) ~ /.o$$/) printf " %s", $$(i)}') >> $@ + $(call PASS, SUCCESS) + %.o: %.c $(call TITLE, "Building $@") $(CC) $(CFLAGS) $(INCLUDES) $(shell ./getcomments.pl -p='cflags:\s' -f='%' $<) -c $< -o $@ @@ -106,9 +109,7 @@ valgrind_%: % %.exe: %.o %.d $(call TITLE, "Building $@") - $(CC) $(LDFLAGS) $(shell ./getcomments.pl -p='linker:\s' -f='%' ${<:.o=.c}) $< -o ${<:.o=} - echo ${<:.o=} >> .targets - #ln -sf ${<:.o=} $@ + $(CC) $(LDFLAGS) $(shell ./getcomments.pl -p='linker:\s' -f='%' ${<:.o=.c}) $< -o $@ $(call PASS, SUCCESS) ## Phony