From: Eric Blake Date: Mon, 27 Apr 2009 14:36:55 +0000 (-0600) Subject: maint.mk: allow package-specific header to provide X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=3c52ec7163fa9d23e0446019f21d85fb5a69c778;p=pspp maint.mk: allow package-specific header to provide * top/maint.mk (sc_require_config_h): New variable. (sc_require_config_h, sc_require_config_h_first): Use it. Signed-off-by: Eric Blake --- diff --git a/ChangeLog b/ChangeLog index 3126a87d78..1c0d6a3939 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2009-04-27 Eric Blake + + maint.mk: allow package-specific header to provide + * top/maint.mk (sc_require_config_h): New variable. + (sc_require_config_h, sc_require_config_h_first): Use it. + 2009-04-27 Simon Josefsson * top/maint.mk (sc_avoid_if_before_free): Except diff --git a/top/maint.mk b/top/maint.mk index 2873878772..b7f68680ba 100644 --- a/top/maint.mk +++ b/top/maint.mk @@ -191,10 +191,13 @@ sc_prohibit_have_config_h: { echo '$(ME): found use of HAVE''_CONFIG_H; remove' \ 1>&2; exit 1; } || : -# Nearly all .c files must include . +# Nearly all .c files must include . However, we also permit this +# via inclusion of a package-specific header, if cfg.mk specified one. +# config_h_header must be suitable for grep -E. +config_h_header ?= sc_require_config_h: - @if $(VC_LIST_EXCEPT) | grep -l '\.c$$' > /dev/null; then \ - grep -L '^# *include ' \ + @if $(VC_LIST_EXCEPT) | grep -l '\.c$$' > /dev/null; then \ + grep -EL '^# *include $(config_h_header)' \ $$($(VC_LIST_EXCEPT) | grep '\.c$$') \ | grep . && \ { echo '$(ME): the above files do not include ' \ @@ -203,12 +206,13 @@ sc_require_config_h: fi # You must include before including any other header file. +# This can possibly be via a package-specific header, if given by cfg.mk. sc_require_config_h_first: @if $(VC_LIST_EXCEPT) | grep -l '\.c$$' > /dev/null; then \ fail=0; \ for i in $$($(VC_LIST_EXCEPT) | grep '\.c$$'); do \ grep '^# *include\>' $$i | sed 1q \ - | grep '^# *include ' > /dev/null \ + | grep -E '^# *include $(config_h_header)' > /dev/null \ || { echo $$i; fail=1; }; \ done; \ test $$fail = 1 && \