From 317d2c6384839f43d8dd472dc1961fcf21ec181d Mon Sep 17 00:00:00 2001 From: Jim Meyering Date: Sun, 21 Dec 2008 17:37:22 +0100 Subject: maint.mk: enforce the "include first" rule * maint.mk (sc_require_config_h_first): New rule. * .x-sc_require_config_h_first: New file. --- maint.mk | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'maint.mk') diff --git a/maint.mk b/maint.mk index cb3c6a56d..7a9649e10 100644 --- a/maint.mk +++ b/maint.mk @@ -191,6 +191,21 @@ sc_require_config_h: else :; \ fi +# You must include 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 ' > /dev/null \ + || { echo $$i; fail=1; }; \ + done; \ + test $$fail = 1 && \ + { echo '$(ME): the above files include some other header' \ + 'before ' 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. -- cgit v1.2.3-70-g09d2