Add.
[libtasn1.git] / maint.mk
blobb5ae6d78b90ab5d91a66f588689c8d2b3dff3249
1 # -*-Makefile-*-
2 # This Makefile fragment is intended to be useful by any GNU-like project.
3 # This file originate from coreutils, CPPI, Bison, and Autoconf.
5 ## Copyright (C) 2001-2006 Free Software Foundation, Inc.
6 ##
7 ## This program is free software; you can redistribute it and/or modify
8 ## it under the terms of the GNU General Public License as published by
9 ## the Free Software Foundation; either version 2, or (at your option)
10 ## any later version.
12 ## This program is distributed in the hope that it will be useful,
13 ## but WITHOUT ANY WARRANTY; without even the implied warranty of
14 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 ## GNU General Public License for more details.
17 ## You should have received a copy of the GNU General Public License
18 ## along with this program; if not, write to the Free Software
19 ## Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
20 ## 02110-1301, USA.
22 ME := maint.mk
24 # List of all C-like source code files that will be tested for
25 # stylistic "errors". You may want to define this to something
26 # more complex in Makefile.cfg.
27 C_SOURCES ?= $(shell find . -name '*.[chly]')
29 # Add some more files to check, typically set in Makefile.cfg.
30 C_SOURCES += $(C_SOURCES_ADD)
32 # Do not save the original name or timestamp in the .tar.gz file.
33 # Use --rsyncable if available.
34 gzip_rsyncable := \
35 $(shell gzip --help|grep rsyncable >/dev/null && echo --rsyncable)
36 GZIP_ENV = '--no-name --best $(gzip_rsyncable)'
38 # Prevent programs like 'sort' from considering distinct strings to be equal.
39 # Doing it here saves us from having to set LC_ALL elsewhere in this file.
40 export LC_ALL = C
42 # Casting arguments to free is never necessary.
43 sc_cast_of_argument_to_free:
44 @grep -nE '\<free *\( *\(' $(C_SOURCES) && \
45 { echo '$(ME): don'\''t cast free argument' 1>&2; \
46 exit 1; } || :
48 # Collect the names of rules starting with `sc_'.
49 syntax-check-rules := $(shell sed -n 's/^\(sc_[a-zA-Z0-9_-]*\):.*/\1/p' $(ME))
50 .PHONY: $(syntax-check-rules)
52 syntax-check: $(syntax-check-rules)