missing x bit
[compress.git] / makefile
index 15683ec6d21642a9051862afb8c42965fc65831f..997c6d7fa56281800ee0b62f1d0251141c4af1bc 100644 (file)
--- a/makefile
+++ b/makefile
@@ -3,12 +3,13 @@
 CC = gcc
 
 INCLUDES = -I../debug -D__MEMORY_ALLOCATION__
+OFLAGS  = -O4 -Os
 #OFLAGS  = -O4 -ffast-math -finline-functions
-OFLAGS  = -O4 -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
@@ -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 $@")
@@ -94,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 $@
@@ -102,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