]> git.ipfire.org Git - thirdparty/coreutils.git/commitdiff
* Makefile.maint (headers_with_interesting_macro_defs): Define.
authorJim Meyering <jim@meyering.net>
Sat, 14 Oct 2006 12:17:24 +0000 (12:17 +0000)
committerJim Meyering <jim@meyering.net>
Sat, 14 Oct 2006 12:17:24 +0000 (12:17 +0000)
(.re-defmac, sc_always_defined_macros): New rules.

ChangeLog
Makefile.maint

index fea785c6a0c13b7cf65f05133dbe053052ce8311..f38ba512456fa2587e4755c8b57d52987f288443 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,8 @@
 2006-10-14  Jim Meyering  <jim@meyering.net>
 
+       * Makefile.maint (headers_with_interesting_macro_defs): Define.
+       (.re-defmac, sc_always_defined_macros): New rules.
+
        * src/system.h (EXIT_FAILURE, EXIT_SUCCESS): Remove definitions.
        Instead, include "exit.h".  This hereby retires the work-around for
        "Sony NEWS-OS Release 4.0C"'s bug due to "#define EXIT_FAILURE 0".
index 8d12b9eee35b3636ecfc7e4fb8b1e94fd645b20f..528c4e70fd913f1eb07277e6119391892532cc6c 100644 (file)
@@ -219,6 +219,40 @@ sc_root_tests:
          && { echo 'tests/Makefile.am: missing check-root action'>&2;  \
               exit 1; } || :
 
+headers_with_interesting_macro_defs = \
+  exit.h       \
+  fcntl_.h     \
+  fnmatch_.h   \
+  intprops.h   \
+  inttypes_.h  \
+  lchown.h     \
+  openat.h     \
+  stat-macros.h        \
+  stdint_.h
+
+# Create a list of regular expressions matching the names
+# of macros that are guaranteed by parts of gnulib to be defined.
+.re-defmac:
+       @(cd $(srcdir)/lib;                                             \
+         for f in $(headers_with_interesting_macro_defs); do           \
+           test -f $$f &&                                              \
+             sed -n '/^# *define \([^_ (][^ (]*\)[ (].*/s//\1/p' $$f;  \
+          done;                                                        \
+        ) | sort -u                                                    \
+          | grep -Ev 'ATTRIBUTE_NORETURN|SIZE_MAX'                     \
+          | sed 's/^/^# *define /'                                     \
+         > $@-t
+       @mv $@-t $@
+
+# Don't define macros that we already get from gnulib header files.
+sc_always_defined_macros: .re-defmac
+       @if test -f $(srcdir)/src/system.h; then                        \
+         trap 'rc=$$?; rm -f .re-defmac; exit $$rc' 0 1 2 3 15;        \
+         grep -f .re-defmac $$($(CVS_LIST))                            \
+           && { echo '$(ME): define the above via some gnulib .h file' \
+                 1>&2;  exit 1; } || :;                                \
+       fi
+
 # Create a list of regular expressions matching the names
 # of files included from system.h.  Exclude a couple.
 .re-list: