-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile.am
172 lines (141 loc) · 5.42 KB
/
Makefile.am
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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
## Process this file with automake to create Makefile.in.
AUTOMAKE_OPTIONS = 1.12
SUBDIRS = po lib src doc contrib misc
if HAVE_TESTS
SUBDIRS += tests
endif
EXTRA_DIST =
dist_noinst_SCRIPTS = build-glib2.sh
dist_noinst_HEADERS = $(top_srcdir)/version.h
ACLOCAL_AMFLAGS = -I m4
CONFIG_STATUS_DEPENDENCIES = $(top_srcdir)/version.h
.PHONY: update-version \
cppcheck \
cppcheck-error \
cppcheck-information \
cppcheck-performance \
cppcheck-portability \
cppcheck-style \
cppcheck-warning \
cppcheck-all \
tags \
tags-emacs \
tags-vim
# Invoke a ctags utility to generate Emacs and Vim's format tag file.
# The meaning of the flags:
# - `p` kind enables function prototypes,
# - `x` kind enables extern and forward variable declarations,
# - `S` field enables function signatures,
# - `properties` field enables static, volatile, etc. properties,
# - `macrodef` field enables macro definitions.
#
# Generate two formats at once: Emacs and Vim's.
tags: tags-emacs tags-vim
# Build only the Emacs-style `TAGS` file.
tags-emacs:
@if type ctags >/dev/null 2>&1; then \
if ctags --version | grep >/dev/null 2>&1 "Universal Ctags"; then \
ctags -e -R --languages=C --langmap=C:.h.c --c-kinds=+px \
--fields=+S --fields-c=+"{properties}" --fields-c=+"{macrodef}"; \
else \
ctags -e -R --languages=C --langmap=C:.h.c --c-kinds=+px \
--fields=+S; \
fi; \
printf "Created the Emacs \`TAGS\` file.\\n"; \
else \
printf 'Error: Please install a Ctags (e.g.: either the Exuberant or Universal %b' \
'version) utility first.\n'; \
fi
# Build only the Vim-style `tags` file.
tags-vim:
@if type ctags >/dev/null 2>&1; then \
if ctags --version | grep >/dev/null 2>&1 "Universal Ctags"; then \
ctags -R --languages=C --langmap=C:.h.c --c-kinds=+px \
--fields=+S --fields-c=+"{properties}" --fields-c=+"{macrodef}"; \
else \
ctags -R --languages=C --langmap=C:.h.c --c-kinds=+px \
--fields=+S; \
fi; \
printf "Created the Vim's style \`tags\` file.\\n"; \
else \
printf 'Error: Please install a Ctags (e.g.: either the Exuberant or Universal %b' \
'version) utility first.\n'; \
fi
update-version:
@if test -x $(top_srcdir)/maint/utils/version.sh; then \
$(top_srcdir)/maint/utils/version.sh "$(top_srcdir)" 2>&1 >/dev/null; \
else \
if test ! -e $(top_srcdir)/version.h; then \
echo "File not found: $(top_srcdir)/maint/utils/version.sh"; \
exit 1; \
fi; \
fi
$(top_srcdir)/version.h: update-version
CPPCHECK_CMD = cppcheck \
--inline-suppr \
--error-exitcode=0 \
-j 4 \
--force \
-I $(top_srcdir)/lib \
--language=c \
--std=c99
CPPCHECK_DIRS = \
"$(top_srcdir)/lib" \
"$(top_srcdir)/src"
CPPCHECK_OUT_PREFIX = $(top_builddir)/cppcheck-
CPPCHECK_OUT_EXT = log.txt
CPPCHECK_SED_FILTER = \
-e '/\/src\/vfs\/smbfs\//d' \
-e '/is reassigned a value before the old one has been used./d' \
-e '/ Unmatched suppression: /d' \
-e "/Skipping configuration '.*' since the value of '.*' is unknown./d"
cppcheck:
$(CPPCHECK_CMD) --enable=all $(CPPCHECK_DIRS) 2>$(CPPCHECK_OUT_PREFIX)all.$(CPPCHECK_OUT_EXT);
$(SED) -i $(CPPCHECK_SED_FILTER) $(CPPCHECK_OUT_PREFIX)all.$(CPPCHECK_OUT_EXT)
cppcheck-all: cppcheck
cppcheck-information:
$(CPPCHECK_CMD) --enable=information $(CPPCHECK_DIRS) 2>$(CPPCHECK_OUT_PREFIX)information.$(CPPCHECK_OUT_EXT);
$(SED) -i $(CPPCHECK_SED_FILTER) $(CPPCHECK_OUT_PREFIX)information.$(CPPCHECK_OUT_EXT)
cppcheck-performance:
$(CPPCHECK_CMD) --enable=performance $(CPPCHECK_DIRS) 2>$(CPPCHECK_OUT_PREFIX)performance.$(CPPCHECK_OUT_EXT);
$(SED) -i $(CPPCHECK_SED_FILTER) $(CPPCHECK_OUT_PREFIX)performance.$(CPPCHECK_OUT_EXT)
cppcheck-portability:
$(CPPCHECK_CMD) --enable=portability $(CPPCHECK_DIRS) 2>$(CPPCHECK_OUT_PREFIX)portability.$(CPPCHECK_OUT_EXT);
$(SED) -i $(CPPCHECK_SED_FILTER) $(CPPCHECK_OUT_PREFIX)portability.$(CPPCHECK_OUT_EXT)
cppcheck-style:
$(CPPCHECK_CMD) --enable=style $(CPPCHECK_DIRS) 2>$(CPPCHECK_OUT_PREFIX)style.$(CPPCHECK_OUT_EXT);
$(SED) -i $(CPPCHECK_SED_FILTER) $(CPPCHECK_OUT_PREFIX)style.$(CPPCHECK_OUT_EXT)
cppcheck-warning:
$(CPPCHECK_CMD) --enable=warning $(CPPCHECK_DIRS) 2>$(CPPCHECK_OUT_PREFIX)warning.$(CPPCHECK_OUT_EXT);
$(SED) -i $(CPPCHECK_SED_FILTER) $(CPPCHECK_OUT_PREFIX)warning.$(CPPCHECK_OUT_EXT)
cppcheck-unusedFunction:
$(CPPCHECK_CMD) --enable=unusedFunction $(CPPCHECK_DIRS) 2>$(CPPCHECK_OUT_PREFIX)unusedFunction.$(CPPCHECK_OUT_EXT);
$(SED) -i $(CPPCHECK_SED_FILTER) $(CPPCHECK_OUT_PREFIX)unusedFunction.$(CPPCHECK_OUT_EXT)
cppcheck-missingInclude:
$(CPPCHECK_CMD) --enable=missingInclude $(CPPCHECK_DIRS) 2>$(CPPCHECK_OUT_PREFIX)missingInclude.$(CPPCHECK_OUT_EXT);
$(SED) -i $(CPPCHECK_SED_FILTER) $(CPPCHECK_OUT_PREFIX)missingInclude.$(CPPCHECK_OUT_EXT)
cppcheck-split-all: \
cppcheck-information \
cppcheck-performance \
cppcheck-portability \
cppcheck-style \
cppcheck-warning \
cppcheck-unusedFunction \
cppcheck-missingInclude
INDENT_CMD = indent \
--gnu-style \
--format-first-column-comments \
--indent-level4 \
--brace-indent0 \
--line-length100 \
--no-tabs \
--blank-lines-after-procedures
INDENT_DIRS = \
"$(top_srcdir)/lib" \
"$(top_srcdir)/src" \
"$(top_srcdir)/tests"
indent:
for directory in $(INDENT_DIRS); do \
find "$${directory}" -name '*.[ch]' -print0 | \
xargs -0 $(INDENT_CMD); \
done