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
use tab_t for storage
[calc.git]
/
makefile
diff --git
a/makefile
b/makefile
index b10fc9fdb46825141ef65786ae50c1eec847521e..48382b25d7b29d5c7885454b86285dac1812eaec 100644
(file)
--- a/
makefile
+++ b/
makefile
@@
-11,8
+11,8
@@
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) $(GCOV
ER
)
-LDFLAGS += -g
+CFLAGS += $(OFLAGS) $(INCLUDES) $(GCOV)
+LDFLAGS += -g
$(GCOV)
# Targets
# Targets
@@
-24,6
+24,7
@@
SHELL = bash
#MAKE = mingw32-make
MAKEFLAGS += -s
#MAKE = mingw32-make
MAKEFLAGS += -s
+include $(wildcard .makefile)
# Functions
# Functions
@@
-67,9
+68,9
@@
valgrinds:
$(MAKE) $(addprefix valgrind_,$(ALLEXE))
wipe: purge
$(MAKE) $(addprefix valgrind_,$(ALLEXE))
wipe: purge
- $(call TITLE, "
w
iping")
+ $(call TITLE, "
W
iping")
touch wipe
touch wipe
- rm -f wipe $(wildcard *.gcda *.gcno)
+ rm -f wipe $(wildcard *.gcda *.gcno
*.gcov
)
$(call PASS, SUCCESS)
tests: all
$(call PASS, SUCCESS)
tests: all
@@
-81,13
+82,14
@@
include $(wildcard *.d)
include $(wildcard *.ld)
gcov_%:
include $(wildcard *.ld)
gcov_%:
-
make
purge
- CFLAGS="-fprofile-arcs -ftest-coverage" LDFLAGS="-fprofile-arcs -ftest-coverage" make
-
make
test_$(@:gcov_%=%)
+
$(MAKE)
purge
+ GCOV="-coverage -O0" $(MAKE)
+
$(MAKE)
test_$(@:gcov_%=%)
gcov `sed -e 's/\.exe:/.c/;s/\.o/.c/g' $(@:gcov_%=%.ld)`
touch gcov
rm -f gcov $(wildcard *.gcda *.gcno)
gcov `sed -e 's/\.exe:/.c/;s/\.o/.c/g' $(@:gcov_%=%.ld)`
touch gcov
rm -f gcov $(wildcard *.gcda *.gcno)
- make purge
+ $(MAKE) purge
+ grep '#####' *.c.gcov || true
%.test: %.c
$(call TITLE, "Building $@")
%.test: %.c
$(call TITLE, "Building $@")
@@
-97,18
+99,18
@@
gcov_%:
test_%: %.test %.exe
IFS=$$'\n'; RC=0; \
test_%: %.test %.exe
IFS=$$'\n'; RC=0; \
- for test in `cat $< | sed 's,${<:.test=.exe},./${<:.test=.exe},g'`; do \
+ for test in `cat $< | sed 's,${<:.test=.exe},
$(VALGRIND)
./${<:.test=.exe},g'`; do \
echo "=== $$test ==="; \
echo "=== $$test ==="; \
- eval $
(VALGRIND) $
$test; \
+ eval $$test; \
[ $$? -eq 0 ] && echo -e "\033[1;32mSUCCESS\033[0;0m" \
|| { echo -e "\033[1;31mFAILED\033[0;0m"; RC=1; }; \
done; \
[ $$? -eq 0 ] && echo -e "\033[1;32mSUCCESS\033[0;0m" \
|| { echo -e "\033[1;31mFAILED\033[0;0m"; RC=1; }; \
done; \
- test "$$RC" -ne 1
+ test "$$RC" -ne 1
valgrind_%: %.exe
valgrind_%: %.exe
- VALGRIND="valgrind -v --leak-check=full --
show-reachable=yes --log-fd=2
"; \
+ VALGRIND="valgrind -v --leak-check=full --
log-fd=3
"; \
export VALGRIND; \
export VALGRIND; \
- $(MAKE) $(@:valgrind_%=test_%)
+ $(MAKE) $(@:valgrind_%=test_%)
3>$@.log
%.d: %.c
$(call TITLE, "Building $@")
%.d: %.c
$(call TITLE, "Building $@")
@@
-130,7
+132,7
@@
valgrind_%: %.exe
%.exe: %.o %.d
$(call TITLE, "Building $@")
%.exe: %.o %.d
$(call TITLE, "Building $@")
- $(CC) $(LDFLAGS) $
(shell ./getcomments.pl -p='linker:\s' -f='%' ${<:.o=.c}) $<
-o $@
+ $(CC) $(LDFLAGS) $
< $(shell ./getcomments.pl -p='linker:\s' -f='%' ${<:.o=.c})
-o $@
$(call PASS, SUCCESS)
## Phony
$(call PASS, SUCCESS)
## Phony