Soft'N'Design Software
/
projects
/
calc.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
new functions: quit and help
[calc.git]
/
makefile
diff --git
a/makefile
b/makefile
index 34218b4f15a8fe793b568ec3bfcc8a647cd98372..0f6cb9b1b02be3b3ee03908b2c414822757badce 100644
(file)
--- a/
makefile
+++ b/
makefile
@@
-11,14
+11,14
@@
OFLAGS = -O4 -Os
#OFLAGS += -malign-double
CFLAGS += -W -Wall -Wextra -g
CFLAGS += -std=c99 -D_XOPEN_SOURCE=500
#OFLAGS += -malign-double
CFLAGS += -W -Wall -Wextra -g
CFLAGS += -std=c99 -D_XOPEN_SOURCE=500
-CFLAGS += $(OFLAGS) $(INCLUDES)
+CFLAGS += $(OFLAGS) $(INCLUDES)
$(GCOVER)
LDFLAGS += -g
# Targets
ALLEXE =
ALLEXE += calc
LDFLAGS += -g
# Targets
ALLEXE =
ALLEXE += calc
-ALLEXE += skel
+
#
ALLEXE += skel
SHELL = bash
SHELL = bash
@@
-43,11
+43,6
@@
VALID = $(call TITLE, $(1)) && $(2) && $(call PASS, SUCCESS) || { $(call FAIL, F
all: depends
$(MAKE) $(ALLEXE:%=%.exe)
all: depends
$(MAKE) $(ALLEXE:%=%.exe)
-alltests: all
- $(MAKE) $(addprefix test_,$(ALLEXE:%.exe=%))
-
-depends: $(patsubst %.c, %.d, $(wildcard *.c)) $(patsubst %, %.ld, $(ALLEXE))
-
count:
wc $(wildcard *.c *.h) $(MAKEFILE_LIST)
count:
wc $(wildcard *.c *.h) $(MAKEFILE_LIST)
@@
-57,17
+52,34
@@
clean:
rm -f clean $(wildcard *.d *.ld *.log *.o *.test *~ .exec_*)
$(call PASS, SUCCESS)
rm -f clean $(wildcard *.d *.ld *.log *.o *.test *~ .exec_*)
$(call PASS, SUCCESS)
+depends: $(patsubst %.c, %.d, $(wildcard *.c)) $(patsubst %, %.ld, $(ALLEXE))
+
+gcovs:
+ $(MAKE) $(addprefix gcov_,$(ALLEXE))
+
purge: clean
$(call TITLE, "Purging")
touch purge
purge: clean
$(call TITLE, "Purging")
touch purge
- rm -f purge $(ALLEXE) $(shell [ -f .targets ] && { cat .targets | sort | uniq; echo .targets; })
+ rm -f purge $(ALLEXE
:%=%.exe
) $(shell [ -f .targets ] && { cat .targets | sort | uniq; echo .targets; })
$(call PASS, SUCCESS)
$(call PASS, SUCCESS)
+tests: all
+ $(MAKE) $(addprefix test_,$(ALLEXE))
+
## Main rules
include $(wildcard *.d)
include $(wildcard *.ld)
## Main rules
include $(wildcard *.d)
include $(wildcard *.ld)
+gcov_%:
+ make purge
+ CFLAGS="-fprofile-arcs -ftest-coverage" LDFLAGS="-fprofile-arcs -ftest-coverage" make
+ make test_$(@:gcov_%=%)
+ gcov `sed -e 's/\.exe:/.c/;s/\.o/.c/g' $(@:gcov_%=%.ld)`
+ touch gcov
+ rm -f gcov $(wildcard *.gcda *.gcno)
+ make purge
+
%.test: %.c
$(call TITLE, "Building $@")
# awk '/\/\* *test:.*\*\// { sub(/^.*\/\* *test: */, ""); sub(/ *\*\/.*$$/, ""); print }' $< > $@
%.test: %.c
$(call TITLE, "Building $@")
# awk '/\/\* *test:.*\*\// { sub(/^.*\/\* *test: */, ""); sub(/ *\*\/.*$$/, ""); print }' $< > $@
@@
-114,7
+126,7
@@
valgrind_%: %
## Phony
## Phony
-.PHONY:
clean count purge
+.PHONY:
all clean count depends gcovs purge tests
## Precious
## Precious