From 8321286846970af562a2ff6b7272f1cd0860d6c1 Mon Sep 17 00:00:00 2001 From: "H.J. Lu" Date: Tue, 5 Jul 2016 15:01:33 -0700 Subject: Make copies of cstdlib/cmath and use them [BZ #20314] If C++ headers or are used, GCC 6 will include /usr/include/stdlib.h or /usr/include/math.h from "#include_next" (instead of stdlib/stdlib.h or math/math.h in the glibc source directory), and this turns up as a make dependency. An implicit rule will kick in and make will try to install stdlib/stdlib.h or math/math.h as /usr/include/stdlib.h or /usr/include/math.h because the target is out of date. We make a copy of and in the glibc build directory so that stdlib/stdlib.h and math/math.h will be used instead of /usr/include/stdlib.h and /usr/include/math.h. [BZ #20314] * Makeconfig (CXXFLAGS): Prepend -I$(common-objpfx). * Makerules (before-compile): Add $(common-objpfx)cstdlib and $(common-objpfx)cmath. ($(common-objpfx)cstdlib): New target. ($(common-objpfx)cmath): Likewise. --- Makerules | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) (limited to 'Makerules') diff --git a/Makerules b/Makerules index f1ecd40..7e4077e 100644 --- a/Makerules +++ b/Makerules @@ -109,6 +109,30 @@ endif # avoid-generated endif # $(build-shared) = yes ifndef avoid-generated +ifneq (,$(CXX)) +# If C++ headers or are used, GCC 6 will include +# /usr/include/stdlib.h or /usr/include/math.h from "#include_next" +# (instead of stdlib/stdlib.h or math/math.h in the glibc source +# directory), and this turns up as a make dependency. An implicit +# rule will kick in and make will try to install stdlib/stdlib.h or +# math/math.h as /usr/include/stdlib.h or /usr/include/math.h because +# the target is out of date. We make a copy of and +# in the glibc build directory so that stdlib/stdlib.h and math/math.h +# will be used instead of /usr/include/stdlib.h and /usr/include/math.h. +before-compile := $(common-objpfx)cstdlib $(common-objpfx)cmath \ + $(before-compile) +cstdlib=$(shell echo "\#include " | $(CXX) -M -MP -x c++ - \ + | sed -n "/cstdlib:/{s/:$$//;p}") +$(common-objpfx)cstdlib: $(cstdlib) + $(INSTALL_DATA) $< $@T + $(move-if-change) $@T $@ +cmath=$(shell echo "\#include " | $(CXX) -M -MP -x c++ - \ + | sed -n "/cmath:/{s/:$$//;p}") +$(common-objpfx)cmath: $(cmath) + $(INSTALL_DATA) $< $@T + $(move-if-change) $@T $@ +endif + before-compile := $(common-objpfx)libc-abis.h $(before-compile) $(common-objpfx)libc-abis.h: $(common-objpfx)libc-abis.stamp; @: $(common-objpfx)libc-abis.stamp: $(..)scripts/gen-libc-abis \ -- cgit v1.1