maint: avoid any CDPATH issue
[gnulib.git] / Makefile
1 # Makefile for gnulib central.
2 # Copyright (C) 2006, 2009-2011 Free Software Foundation, Inc.
3 #
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.
7
8 # Produce some files that are not stored in the repository.
9 all:
10
11 # Produce the documentation in readable form.
12 info html dvi pdf:
13         cd doc && $(MAKE) $@ && $(MAKE) mostlyclean
14
15 # Perform some platform independent checks on the gnulib code.
16 check: \
17   sc_prohibit_augmenting_PATH_via_TESTS_ENVIRONMENT                     \
18   sc_pragma_columns                                                     \
19   sc_prefer_ac_check_funcs_once
20
21 sc_prefer_ac_check_funcs_once:
22         if test -d .git; then                                           \
23           git grep -w -l AC_CHECK_FUNCS modules                         \
24             && { echo use AC_CHECK_FUNCS_ONCE, not AC_CHECK_FUNCS       \
25                    in modules/ 1>&2; exit 1; } || :                     \
26         else :; fi
27
28 sc_prohibit_augmenting_PATH_via_TESTS_ENVIRONMENT:
29         if test -d .git; then                                           \
30           url=http://thread.gmane.org/gmane.comp.lib.gnulib.bugs/22874; \
31           git grep '^[   ]*TESTS_ENVIRONMENT += PATH=' modules          \
32             && { printf '%s\n' 'Do not augment PATH via TESTS_ENVIRONMENT;' \
33                  "  see <$$url>" 1>&2; exit 1; } || :                   \
34         else :; fi
35
36 sc_pragma_columns:
37         if test -d .git; then                                           \
38           git ls-files|grep '\.in\.h$$'                                 \
39               | xargs grep -l '^@PRAGMA_SYSTEM_HEADER@'                 \
40               | xargs grep -L '^@PRAGMA_COLUMNS@'                       \
41               | grep .                                                  \
42             && { printf '%s\n'                                          \
43                    'the files listed above use @PRAGMA_SYSTEM_HEADER@'  \
44                    'without also using @PRAGMA_COLUMNS@' 1>&2;          \
45                  exit 1; } || :;                                        \
46         else :; fi
47
48 # Verify that certain (for now, only Jim Meyering and Eric Blake's)
49 # lib/**.c files are consistently cpp indented.
50 sc_cpp_indent_check:
51         ./gnulib-tool --extract-filelist \
52             $$(cd ./modules; grep -ilrE '(meyering|blake)' .) \
53           | sort -u \
54           | grep 'lib/.*\.c$$' \
55           | grep -v '/getloadavg\.c$$' \
56           | xargs cppi -c
57
58 # Regenerate some files that are stored in the repository.
59 regen: MODULES.html
60
61 # MODULES.html is periodically being generated and copied to the web pages at
62 # :ext:USER@cvs.savannah.gnu.org:/web/gnulib/gnulib/
63 # where it then appears at <http://www.gnu.org/software/gnulib/MODULES.html>.
64 MODULES.html: MODULES.html.sh
65         ./MODULES.html.sh > MODULES.html
66
67 # Run this rule once per year (usually early in January)
68 # to update all FSF copyright year lists here.
69 # We exclude the files listed in srclist.txt (maintained elsewhere)
70 # as well as those in tests/unictype (generated).
71 # Also exclude any file that includes the "GENERATED AUTOMATICALLY" comment,
72 # being careful not to exclude code that merely generates the comment.
73 # Also exclude doc/INSTALL*, since they too are generated.
74 update-copyright:
75         exempt=$$(mktemp);                                              \
76         grep -v '^#' config/srclist.txt|grep -v '^$$'                   \
77           | while read src dst; do                                      \
78               test -f "$$dst" && { echo "$$dst"; continue; };           \
79               test -d "$$dst" || continue;                              \
80               echo "$$dst"/$$(basename "$$src");                        \
81             done > $$exempt;                                            \
82         git ls-files tests/unictype >> $$exempt;                        \
83         git ls-files doc/INSTALL* >> $$exempt;                          \
84         git ls-files | grep -vFf $$exempt                               \
85           | xargs grep -L '^/\*.*GENERATED AUTOMATICALLY'               \
86           | UPDATE_COPYRIGHT_MAX_LINE_LENGTH=79                         \
87             UPDATE_COPYRIGHT_USE_INTERVALS=1                            \
88               xargs build-aux/update-copyright