diff options
author | Jim Meyering <meyering@redhat.com> | 2008-12-21 17:37:22 +0100 |
---|---|---|
committer | Jim Meyering <meyering@redhat.com> | 2008-12-21 17:49:58 +0100 |
commit | 317d2c6384839f43d8dd472dc1961fcf21ec181d (patch) | |
tree | 7af3e7a1ee6bc1c16ffc80b9976468673a035075 /maint.mk | |
parent | 292d68565a34b237cd2bf586ace545b7cd3dbfcf (diff) | |
download | coreutils-317d2c6384839f43d8dd472dc1961fcf21ec181d.tar.xz |
maint.mk: enforce the "include <config.h> first" rule
* maint.mk (sc_require_config_h_first): New rule.
* .x-sc_require_config_h_first: New file.
Diffstat (limited to 'maint.mk')
-rw-r--r-- | maint.mk | 15 |
1 files changed, 15 insertions, 0 deletions
@@ -191,6 +191,21 @@ sc_require_config_h: else :; \ fi +# You must include <config.h> before including any other header file. +sc_require_config_h_first: + @if $(VC_LIST_EXCEPT) | grep '\.c$$' > /dev/null; then \ + fail=0; \ + for i in $$($(VC_LIST_EXCEPT) | grep '\.c$$'); do \ + grep '^# *include\>' $$i | sed 1q \ + | grep '^# *include <config\.h>' > /dev/null \ + || { echo $$i; fail=1; }; \ + done; \ + test $$fail = 1 && \ + { echo '$(ME): the above files include some other header' \ + 'before <config.h>' 1>&2; exit 1; } || :; \ + else :; \ + fi + # To use this "command" macro, you must first define two shell variables: # h: the header, enclosed in <> or "" # re: a regular expression that matches IFF something provided by $h is used. |