README-release: make it easier to execute commands
[gnulib/ericb.git] / Makefile
blob675c8e03dcf30a96912ecdb0933a0c050f0e60a8
1 # GNU Makefile for gnulib central.
2 # Copyright (C) 2006, 2009-2012 Free Software Foundation, Inc.
4 # Copying and distribution of this file, with or without modification,
5 # in any medium, are permitted without royalty provided the copyright
6 # notice and this notice are preserved.
8 # This Makefile requires the use of GNU make. Some targets require
9 # that you have tools like git, makeinfo and cppi installed.
11 # Required for the use of <(...) below.
12 SHELL=/bin/bash
14 # Produce some files that are not stored in the repository.
15 all:
17 # Produce the documentation in readable form.
18 info html dvi pdf:
19 cd doc && $(MAKE) $@ && $(MAKE) mostlyclean
21 # Collect the names of rules starting with 'sc_'.
22 syntax-check-rules := $(sort $(shell sed -n 's/^\(sc_[a-zA-Z0-9_-]*\):.*/\1/p'\
23 Makefile))
25 # Perform some platform independent checks on the gnulib code.
26 check: $(syntax-check-rules)
28 sc_prefer_ac_check_funcs_once:
29 if test -d .git; then \
30 git grep -w -l AC_CHECK_FUNCS modules \
31 && { echo use AC_CHECK_FUNCS_ONCE, not AC_CHECK_FUNCS \
32 in modules/ 1>&2; exit 1; } || : \
33 else :; fi
35 sc_prohibit_leading_TABs:
36 if test -d .git; then \
37 git grep -l '^ * ' lib m4 tests \
38 | grep -Ev '^lib/reg|Makefile|test-update-copyright' \
39 | grep . \
40 && { printf '*** %s\n' 'indent with spaces, not TABs;' \
41 1>&2; exit 1; } || : \
42 else :; fi
44 sc_prohibit_augmenting_PATH_via_TESTS_ENVIRONMENT:
45 if test -d .git; then \
46 url=http://thread.gmane.org/gmane.comp.lib.gnulib.bugs/22874; \
47 git grep '^[ ]*TESTS_ENVIRONMENT += PATH=' modules \
48 && { printf '%s\n' 'Do not augment PATH via TESTS_ENVIRONMENT;' \
49 " see <$$url>" 1>&2; exit 1; } || : \
50 else :; fi
52 # Run all maint.mk syntax-check tests on gnulib's sources.
53 sc_maint:
54 rm -f maint.mk; ln -s top/maint.mk maint.mk
55 $(MAKE) -s srcdir=. gnulib_dir=. _build-aux=build-aux \
56 -f cfg.mk -f maint.mk syntax-check
57 rm -f maint.mk
59 # Files in m4/ that (exceptionally) may use AC_LIBOBJ.
60 # Do not include their ".m4" suffix.
61 allow_AC_LIBOBJ = \
62 close \
63 dprintf \
64 dup2 \
65 faccessat \
66 fchdir \
67 fclose \
68 fcntl \
69 fprintf-posix \
70 open \
71 printf-posix-rpl \
72 snprintf \
73 sprintf-posix \
74 stdio_h \
75 vasnprintf \
76 vasprintf \
77 vdprintf \
78 vfprintf-posix \
79 vprintf-posix \
80 vsnprintf \
81 vsprintf-posix
83 allow_AC_LIBOBJ_or := $(shell echo $(allow_AC_LIBOBJ) | tr -s ' ' '|')
85 sc_prohibit_AC_LIBOBJ_in_m4:
86 url=http://article.gmane.org/gmane.comp.lib.gnulib.bugs/26995; \
87 if test -d .git; then \
88 git ls-files m4 \
89 | grep -Ev '^m4/($(allow_AC_LIBOBJ_or))\.m4$$' \
90 | xargs grep '^ *AC_LIBOBJ(' \
91 && { printf '%s\n' 'Do not use AC_LIBOBJ in m4/*.m4;' \
92 "see <$$url>"; exit 1; } || :; \
93 else :; fi
95 sc_pragma_columns:
96 if test -d .git; then \
97 git ls-files|grep '\.in\.h$$' \
98 | xargs grep -l '^@PRAGMA_SYSTEM_HEADER@' \
99 | xargs grep -L '^@PRAGMA_COLUMNS@' \
100 | grep . \
101 && { printf '%s\n' \
102 'the files listed above use @PRAGMA_SYSTEM_HEADER@' \
103 'without also using @PRAGMA_COLUMNS@' 1>&2; \
104 exit 1; } || :; \
105 else :; fi
107 # Verify that certain (for now, only Jim Meyering and Eric Blake's)
108 # *.c files are consistently cpp indented.
109 sc_cpp_indent_check:
110 ./gnulib-tool --extract-filelist \
111 $$(cd ./modules; grep -ilrE '(meyering|blake)' .) \
112 | sort -u \
113 | grep '\.c$$' \
114 | grep -vE '/(stdio-(read|write)|getloadavg)\.c$$' \
115 | xargs cppi -c
117 # Ensure that the list of symbols checked for by the
118 # sc_prohibit_intprops_without_use rule match those in the actual file.
119 # Extract the symbols from the .h file and compare with the list of
120 # symbols extracted from the rule in maint.mk.
121 sc_check_sym_list:
122 i=lib/intprops.h; \
123 diff -u <(perl -lne '/^# *define ([A-Z]\w+)\(/ and print $$1' $$i|fmt) \
124 <(sed -n /^_intprops_name/,/^_intprops_syms_re/p top/maint.mk \
125 |sed '/^_/d;s/^ //;s/ *\\$$//')
127 # Ensure that the copyright statements in files and in the module descriptions
128 # are consistent.
129 sc_check_copyright:
130 ./check-copyright
132 # Regenerate some files that are stored in the repository.
133 regen: MODULES.html
135 # MODULES.html is periodically being generated and copied to the web pages at
136 # :ext:USER@cvs.savannah.gnu.org:/web/gnulib/gnulib/
137 # where it then appears at <http://www.gnu.org/software/gnulib/MODULES.html>.
138 MODULES.html: MODULES.html.sh
139 ./MODULES.html.sh > MODULES.html
141 # Run this rule once per year (usually early in January)
142 # to update all FSF copyright year lists here.
143 # We exclude the files listed in srclist.txt (maintained elsewhere)
144 # as well as those in tests/unictype (generated).
145 # Also exclude any file that includes the "GENERATED AUTOMATICALLY" comment,
146 # being careful not to exclude code that merely generates the comment.
147 # Also exclude doc/INSTALL*, since they too are generated.
148 update-copyright:
149 exempt=$$(mktemp); \
150 grep -v '^#' config/srclist.txt|grep -v '^$$' \
151 | while read src dst; do \
152 test -f "$$dst" && { echo "$$dst"; continue; }; \
153 test -d "$$dst" || continue; \
154 echo "$$dst"/$$(basename "$$src"); \
155 done > $$exempt; \
156 git ls-files tests/unictype >> $$exempt; \
157 git ls-files doc/INSTALL* >> $$exempt; \
158 git ls-files | grep -vFf $$exempt \
159 | xargs grep -L '^/\*.*GENERATED AUTOMATICALLY' \
160 | UPDATE_COPYRIGHT_MAX_LINE_LENGTH=79 \
161 UPDATE_COPYRIGHT_USE_INTERVALS=1 \
162 xargs build-aux/update-copyright