1 # Makefile for STDexecDTS.c
3 # Author: Øyvind A. Holm <sunny@sunbase.org>
13 CFLAGS
+= $$(test -n
"$(GCOV)" && echo
-n
"-fprofile-arcs -ftest-coverage")
14 CFLAGS
+= $$(test -n
"$(PROF)" && echo
-n
"-pg")
21 LDFLAGS
+= $$(test -n
"$(PROF)" && echo
-n
"-pg")
24 LIBS
+= $$(test -n
"$(GCOV)" && echo
"-lgcov --coverage")
31 CFILES
+= STDexecDTS.c
35 HFILES
+= STDexecDTS.h
37 DEPS
= version.h
$(HFILES
) Makefile
38 GNCOV_STR
= $$(test -n
"$(GNCOV)" && echo
"-g")
39 TESTABLE_LINES
= $$(grep
-E
'^ +\#\#\#\#\#:' *.c.gcov \
40 | grep
-vF
'/* gncov */' | wc
-l
)
46 $(LD
) -o
$(EXEC
) $(LDFLAGS
) $(OBJS
) $(LIBS
)
48 version.h
: Gen-version
$(CFILES
) $(HFILES
) Makefile
51 STDexecDTS.o
: STDexecDTS.c
$(DEPS
)
52 $(CC
) $(CFLAGS
) STDexecDTS.c
54 selftest.o
: selftest.c
$(DEPS
)
55 $(CC
) $(CFLAGS
) selftest.c
60 rm -f
*.gcda
*.gcno
*.gcov
61 rm -f gmon.out gmon.sum
67 $(EDITOR
) $$(git ls-files
)
72 $(MAKE
) clean test GCOV
=1
74 @echo
$$(grep
-E
'^ +#####:' *.c.gcov | wc
-l
) untested lines
>&2
75 @echo
$$(grep
-E
'^ +#####:' *.c.gcov | grep
-F
'/* gncov */' \
76 | wc
-l
) gncov lines
>&2
77 @echo
$(TESTABLE_LINES
) testable lines
>&2
81 gcov-cmt
$(GNCOV_STR
) $(CFILES
)
83 .PHONY
: gcov-cmt-clean
89 gdb
-x gdbrc
$$(cat gdbopts
2>/dev
/null
) $(EXEC
)
92 install: $(PREFIX
)/bin
/$(EXEC
)
94 $(PREFIX
)/bin
/$(EXEC
): $(EXEC
)
95 mkdir
-p
$(PREFIX
)/bin
96 install $(EXEC
) $(PREFIX
)/bin
/$(EXEC
)
98 tags: $(CFILES
) $(HFILES
)
99 ctags
$(CFILES
) $(HFILES
)
107 $(MAKE
) testcomb WHAT
=test
111 $(MAKE
) clean $(WHAT
) NDEBUG
=1
112 $(MAKE
) clean $(WHAT
) UNUSED
=1
113 $(MAKE
) clean $(WHAT
) NDEBUG
=1 UNUSED
=1
114 $(MAKE
) clean $(WHAT
)
118 @echo Check files for long lines
>&2
119 @for f in
$(CFILES
) $(HFILES
) Gen-version Makefile
; do \
120 [ -f
"$$f" ] && expand
"$$f" | sed
's/ $$//;' \
121 | grep
-q
-E
'.{80}' && echo
"$$f"; \
122 done | grep .
&& exit
1 || true
126 @
$(MAKE
) -s gcov
2>.make-tlok.tmp
>&2; res
=$$?
; \
127 if
test $$res -eq
0; then \
129 "$(TESTABLE_LINES)" \
130 "$$(grep ^1\\.\\. .make-tlok.tmp \
131 | perl -pe 's/^1\.\.(\d+).*/$$1/;')"; \
133 grep
"Looks like you failed" <.make-tlok.tmp \
135 -e
's/.*failed (\d+) tests? of (\d+).*/$$1\/$$2 FAIL/;'; \
141 rm -f
$(PREFIX
)/bin
/$(EXEC
)
145 cd t
&& $(MAKE
) valgrind
149 $(MAKE
) testcomb WHAT
=valgrind