-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathmakefile.dev
54 lines (44 loc) · 1.42 KB
/
makefile.dev
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
# -*- makefile -*-
# Copyright 2009-2011 Nicolas Limare <[email protected]>
#
# Copying and distribution of this file, with or without
# modification, are permitted in any medium without royalty provided
# the copyright notice and this notice are preserved. This file is
# offered as-is, without any warranty.
DATE = $(shell date -u +%Y%m%d)
RELEASE_TAG = 0.$(DATE)
CSTRICT = -ansi -pedantic -Wall -Wextra -Werror
.PHONY : srcdoc lint beautify debug test release
# dependencies
makefile.dep : $(SRC)
$(CC) $(CPPFLAGS) -MM $^ > $@
# source documentation
srcdoc : $(SRC) $(HDR)
doxygen doc/doxygen.conf
# code cleanup
beautify : $(SRC) $(HDR)
for FILE in $^; do \
expand $$FILE | sed 's/[ \t]*$$//' > $$FILE.$$$$ \
&& indent -kr -i4 -l78 -nut -nce -sob -sc \
$$FILE.$$$$ -o $$FILE \
&& rm $$FILE.$$$$; \
done
# static code analysis and strict build
lint : $(SRC)
clang --analyze -ansi -I. $^
splint -ansi-lib -weak -I. $^
cppcheck --enable=style --error-exitcode=1 $^
$(RM) *.plist
$(MAKE) -B CFLAGS="$(CFLAGS) $(CSTRICT)"
@echo OK
# debug build
debug : $(SRC)
$(MAKE) CFLAGS="$(CFLAGS) -g" \
CPPFLAGS="$(CPPFLAGS) -UNDEBUG" LDFLAGS="$(LDFLAGS) -lefence"
# code tests
test : $(SRC) $(HDR)
sh -e test/run.sh && echo SUCCESS || ( echo ERROR; return 1)
# release tarball
release :
git archive --format=tar --prefix=$(PROJECT)-$(RELEASE_TAG)/ HEAD \
| gzip > ../$(PROJECT)-$(RELEASE_TAG).tar.gz