* Makerules ($(common-objpfx)Versions.v.i): Depend on abi-versions.h.
authorRoland McGrath <roland@gnu.org>
Thu, 14 Mar 2002 23:33:10 +0000 (23:33 +0000)
committerRoland McGrath <roland@gnu.org>
Thu, 14 Mar 2002 23:33:10 +0000 (23:33 +0000)
* Makeconfig (%.v.i, %.v): New implicit rules.
(preprocess-versions): Variable removed.
($(common-objpfx)shlib-versions.v.i): New target giving just the
shlib-versions input files as dependencies.
($(common-objpfx)soversions.i): Depend on that instead of the input
files.  Use it as input instead of using a pipeline.
(postclean-generated): Append soversions.i, shlib-versions.v, and
shlib-versions.v.i here.
* Makerules ($(common-objpfx)Versions.def.v.i): New target giving just
the Versions.def input files as dependencies.
($(common-objpfx)Versions.v.i): Likewise for Versions files.
($(common-objpfx)Versions.all): Depend on that instead of the input
files.  Use it as input instead of using a pipeline.
($(common-objpfx)sysd-versions): Likewise with Versions.v.i.
(postclean-generated): Append those .v and .v.i files here.

ChangeLog
Makeconfig

index ca6b9c9..a361c16 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,23 @@
+2002-03-14  Roland McGrath  <roland@frob.com>
+
+       * Makerules ($(common-objpfx)Versions.v.i): Depend on abi-versions.h.
+
+       * Makeconfig (%.v.i, %.v): New implicit rules.
+       (preprocess-versions): Variable removed.
+       ($(common-objpfx)shlib-versions.v.i): New target giving just the
+       shlib-versions input files as dependencies.
+       ($(common-objpfx)soversions.i): Depend on that instead of the input
+       files.  Use it as input instead of using a pipeline.
+       (postclean-generated): Append soversions.i, shlib-versions.v, and
+       shlib-versions.v.i here.
+       * Makerules ($(common-objpfx)Versions.def.v.i): New target giving just
+       the Versions.def input files as dependencies.
+       ($(common-objpfx)Versions.v.i): Likewise for Versions files.
+       ($(common-objpfx)Versions.all): Depend on that instead of the input
+       files.  Use it as input instead of using a pipeline.
+       ($(common-objpfx)sysd-versions): Likewise with Versions.v.i.
+       (postclean-generated): Append those .v and .v.i files here.
+
 2002-03-14  Jakub Jelinek  <jakub@redhat.com>
 
        * locale/broken_cur_max.c (__ctype_get_mb_cur_max): Use nl_langinfo.
index ee3a880..d7c7172 100644 (file)
@@ -1,4 +1,4 @@
-# Copyright (C) 1991-2000, 2001 Free Software Foundation, Inc.
+# Copyright (C) 1991-2000,01,02 Free Software Foundation, Inc.
 # This file is part of the GNU C Library.
 
 # The GNU C Library is free software; you can redistribute it and/or
@@ -731,15 +731,24 @@ endif
 
 ifeq (yes, $(build-shared))
 
-# Commands to put in a pipeline to preprocess a file with # comments
-# %ifdef et al based on config.h settings or other %include'd files.
-define preprocess-versions
-sed '/^[       ]*#/d;s/^[      ]*%/#/' \
-| $(CC) -E -undef -I$(common-objdir) -I$(..)include \
-                 -include $(common-objpfx)config.h \
-                 -DASSEMBLER -x assembler-with-cpp - \
-| sed '/^[     ]*#/d;/^[       ]*$$/d'
-endef
+# This is a pair of implicit rules to preprocess a file with # comments,
+# %ifdef et al, based on config.h settings or other %include'd files.
+# We use chained rules instead of a pipeline here so that we can properly
+# check the exit status of cpp rather than using its bad output when there
+# is a preprocessing error.  Another rule should depend on the output file
+# `FOO.v', and along with that `FOO.v.i' should be given dependencies
+# listing both its input files, and any header files that it may reference
+# (but no commands).
+%.v.i: $(common-objpfx)config.h
+       sed '/^[        ]*#/d;s/^[      ]*%/#/' $(filter-out FORCE %.h,$^) \
+       | $(CC) -E -undef -I$(common-objdir) -I$(..)include \
+                  -include $(common-objpfx)config.h \
+                  -DASSEMBLER -x assembler-with-cpp - \
+                  > $@T
+       mv -f $@T $@
+%.v: %.v.i
+       sed '/^[        ]*#/d;/^[       ]*$$/d' $< > $@T
+       mv -f $@T $@
 
 # Process the shlib-versions file, which tells us what shared library
 # version numbers to use when we install shared objects on this system.
@@ -747,28 +756,26 @@ endef
 ifeq ($(sysd-sorted-done),t)
 -include $(common-objpfx)soversions.mk
 ifndef avoid-generated
-$(common-objpfx)soversions.i: $(..)shlib-versions $(..)Makeconfig \
-                             $(wildcard $(patsubst %, $(..)%/shlib-versions,\
-                                                      $(add-ons) \
-                                                      $(subdirs))) \
-                             $(common-objpfx)config.make
-       cat $(filter-out $(..)Makeconfig $(common-objpfx)config.make,$^) \
-       | $(preprocess-versions) \
-       | while read conf version setname; do \
-           test -n "$$version" && \
-           test `expr '$(config-machine)-$(config-vendor)-$(config-os)' \
-                      : "$$conf"` != 0 || continue; \
-           if test "x$$version" = xDEFAULT; then \
-             default_setname="$$setname"; \
-           else \
-             lib=`echo $$version | sed 's/=.*$$//'`; \
-             if eval test -z "\$${versioned_$${lib}}"; then \
-               eval versioned_$${lib}=yes; \
-               number=`echo $$version | sed "s/^.*=//"`; \
-               echo $$lib $$number $${setname:-$${default_setname}}; \
-             fi; \
+$(common-objpfx)shlib-versions.v.i: \
+       $(..)shlib-versions $(wildcard $(patsubst %, $(..)%/shlib-versions,\
+                                                    $(add-ons) \
+                                                    $(subdirs)))
+$(common-objpfx)soversions.i: $(common-objpfx)shlib-versions.v
+       while read conf version setname; do \
+         test -n "$$version" && \
+         test `expr '$(config-machine)-$(config-vendor)-$(config-os)' \
+                    : "$$conf"` != 0 || continue; \
+         if test "x$$version" = xDEFAULT; then \
+           default_setname="$$setname"; \
+         else \
+           lib=`echo $$version | sed 's/=.*$$//'`; \
+           if eval test -z "\$${versioned_$${lib}}"; then \
+             eval versioned_$${lib}=yes; \
+             number=`echo $$version | sed "s/^.*=//"`; \
+             echo $$lib $$number $${setname:-$${default_setname}}; \
            fi; \
-         done > $@T; exit 0
+         fi; \
+       done < $< > $@T; exit 0
        mv -f $@T $@
 $(common-objpfx)soversions.mk: $(common-objpfx)soversions.i
        (while read lib number setname; do \
@@ -784,7 +791,8 @@ $(common-objpfx)soversions.mk: $(common-objpfx)soversions.i
 endif
 endif
 
-postclean-generated += soversions.mk
+postclean-generated += soversions.mk soversions.i \
+                      shlib-versions.v shlib-versions.v.i
 
 # Generate the header containing the names of all shared libraries.
 # We use a stamp file to avoid uncessary recompilations.