about summary refs log tree commit diff
path: root/Makeconfig
diff options
context:
space:
mode:
authorRoland McGrath <roland@gnu.org>2002-03-14 23:33:10 +0000
committerRoland McGrath <roland@gnu.org>2002-03-14 23:33:10 +0000
commitf3787738d8dc97223747038fe431d3ed2713cfc9 (patch)
treec79cc716f60ab14e1e87ecd73918071b61c9babd /Makeconfig
parent951641e7a3ca2287b10da9ab8f916cc88a5c3b22 (diff)
downloadglibc-f3787738d8dc97223747038fe431d3ed2713cfc9.tar.gz
glibc-f3787738d8dc97223747038fe431d3ed2713cfc9.tar.xz
glibc-f3787738d8dc97223747038fe431d3ed2713cfc9.zip
* 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.
Diffstat (limited to 'Makeconfig')
-rw-r--r--Makeconfig72
1 files changed, 40 insertions, 32 deletions
diff --git a/Makeconfig b/Makeconfig
index ee3a880b6c..d7c7172db6 100644
--- a/Makeconfig
+++ b/Makeconfig
@@ -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.