This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: reverted 59d9f1d
- From: Daniel Jacobowitz <dan at codesourcery dot com>
- To: Roland McGrath <roland at redhat dot com>
- Cc: libc-alpha at sources dot redhat dot com
- Date: Thu, 12 Aug 2010 10:35:49 -0400
- Subject: Re: reverted 59d9f1d
- References: <20100409222122.20814119B@magilla.sf.frob.com><20100412145805.GM9310@caradoc.them.org>
On Mon, Apr 12, 2010 at 10:58:06AM -0400, Daniel Jacobowitz wrote:
> On Fri, Apr 09, 2010 at 03:21:22PM -0700, Roland McGrath wrote:
> > Dan's change was wrong because it doesn't handle the $(..) issue right.
> > Every run will regenerate the file, and differently in main vs subdirs.
>
> Thanks. I spent a while looking at this on Saturday. Here's a patch
> which handles both subdir cases (.. = ../ and .. = `pwd`/) and falls
> back to -I options for non-subdir. It also falls back to -I options
> when includes.mk needs to be regenerated.
>
> What do you think?
Roland, have you had a chance to look at this? Including with
ChangeLog this time.
--
Daniel Jacobowitz
CodeSourcery
2010-08-12 Daniel Jacobowitz <dan@codesourcery.com>
* Makeconfig (+common-includes, +abspfx, +emptyvar, +absinclude,
+abs-includes, +include-file): Define.
(+includes): Use +include-file.
* Makefile (postclean): Remove includes and includes.mk.
Makerules ($(common-objpfx)includes.mk): Include and create
includes.mk. Create includes.
diff --git a/Makeconfig b/Makeconfig
index cd77fe1..37a0f7a 100644
--- a/Makeconfig
+++ b/Makeconfig
@@ -670,9 +670,20 @@ endif # $(+cflags) == ""
# library source directory, in the include directory, and in the
# current directory.
+sysdep-includes = $(addprefix -I,$(+sysdep_dirs))
++common-includes = $(+sysdep-includes) $(includes) $(sysincludes)
+ifdef subdir
+abspfx := $(shell cd $(sysdep_dir)/.. && pwd)/
+emptyvar := # Nothing.
+absinclude = $(patsubst -I$(..)%,-I$(abspfx)%,\
+ $(patsubst $(emptyvar) $(..)%,$(emptyvar) $(abspfx)%, $1))
++abs-includes = $(call absinclude,$(+common-includes))
++include-file = $(if $(includes-force),$(+common-includes),@$(common-objpfx)includes)
+else
++include-file = $(+common-includes)
+endif
+includes = -I$(..)include $(if $(subdir),$(objpfx:%/=-I%)) \
- $(+sysdep-includes) $(includes) \
- $(patsubst %/,-I%,$(..)) $(libio-include) -I. $(sysincludes)
+ $(+include-file) \
+ $(patsubst %/,-I%,$(..)) $(libio-include) -I.
# Since libio has several internal header files, we use a -I instead
# of many little headers in the include directory.
diff --git a/Makefile b/Makefile
index 61cfa43..d2327b3 100644
--- a/Makefile
+++ b/Makefile
@@ -227,7 +227,7 @@ parent-mostlyclean: common-mostlyclean # common-mostlyclean is in Makerules.
parent-clean: parent-mostlyclean common-clean
postclean = $(addprefix $(common-objpfx),$(postclean-generated)) \
- $(addprefix $(objpfx),sysd-dirs sysd-rules) \
+ $(addprefix $(objpfx),sysd-dirs sysd-rules includes includes.mk) \
$(addprefix $(objpfx),sysd-sorted soversions.mk soversions.i)
clean: parent-clean
diff --git a/Makerules b/Makerules
index 9bfe550..8edab8c 100644
--- a/Makerules
+++ b/Makerules
@@ -269,6 +269,22 @@ ifndef sysd-rules-done
no_deps=t
endif
+ifdef subdir
+-include $(common-objpfx)includes.mk
+ifneq ($(+abs-includes),$(saved-includes))
+# Recreate includes.mk (and includes).
+includes-force = FORCE
+FORCE:
+endif
+$(common-objpfx)includes.mk: $(includes-force)
+ -@rm -f $@T $(common-objpfx)includesT
+ for inc in $(+abs-includes); do echo "$$inc"; done \
+ > $(common-objpfx)includesT
+ mv -f $(common-objpfx)includesT $(common-objpfx)includes
+ echo 'saved-includes := $(+abs-includes)' > $@T
+ mv -f $@T $@
+endif
+
define o-iterator-doit
$(objpfx)%$o: %.S $(before-compile); $$(compile-command.S)
endef