Patchwork [v3] libstdc++/49829

login
register
mail settings
Submitter Matthias Klose
Date Jan. 25, 2012, 2:11 p.m.
Message ID <4F200D9E.20203@ubuntu.com>
Download mbox | patch
Permalink /patch/137770/
State New
Headers show

Comments

Matthias Klose - Jan. 25, 2012, 2:11 p.m.
On 25.01.2012 06:26, Benjamin Kosnik wrote:
>
>
>> this breaks builds configured with --enable-libstdcxx-debug.
>
> confirmed
>
>>   Tried
>> the following (not yet working) fix.
>
> OK. The attached is closer, but still not quite there.

one step further, to avoid the endless recursion in the install-debug target. 
unsure if that is the right approach. the install now works, but the debug 
library is now built in the install step, not in the build step.

   Matthias

Patch

Index: src/Makefile.am
===================================================================
--- src/Makefile.am	(revision 183514)
+++ src/Makefile.am	(working copy)
@@ -172,13 +172,23 @@ 
 # 1 debug library
 # 2 supra-convenience library
 if GLIBCXX_BUILD_DEBUG
-all-local: libstdc++convenience.la build_debug
-install-data-local: install_debug
+STAMP_DEBUG = build-debug
+STAMP_INSTALL_DEBUG = install-debug
+CLEAN_DEBUG = debug
 else
-all-local: libstdc++convenience.la
-install-data-local:
+STAMP_DEBUG =
+STAMP_INSTALL_DEBUG =
+CLEAN_DEBUG =
 endif
 
+all-local-once: libstdc++convenience.la $(STAMP_DEBUG)
+install-data-local-once: $(STAMP_INSTALL_DEBUG)
+
+all-local: all-local-once
+install-data-local: install-data-local-once
+clean-local:
+	rm -rf libstdc++convenience.la stamp* $(CLEAN_DEBUG)
+
 # Make a non-installed convenience library, so that --disable-static
 # may work.
 libstdc++convenience.la: $(toolexeclib_LTLIBRARIES)
@@ -188,13 +198,13 @@ 
 	fi; \
 	echo `date` > stamp-libstdc++convenience;
 
-debugdir = debug
-
-# Build a set of debug objects here.
+# Build a debug variant.
 # Take care to fix all possibly-relative paths.
+debugdir = ${glibcxx_builddir}/src/debug
 stamp-debug:
 	if test ! -d ${debugdir}; then \
 	  mkdir -p ${debugdir}; \
+	  for d in $(SUBDIRS); do mkdir -p  ${debugdir}/$$d; done; \
 	  (cd ${debugdir}; \
 	  sed -e 's/top_builddir = \.\./top_builddir = ..\/../' \
 	      -e 's/top_build_prefix = \.\./top_build_prefix = ..\/../' \
@@ -202,16 +212,27 @@ 
 	      -e 's/VPATH = \.\./VPATH = ..\/../' \
 	      -e 's/glibcxx_basedir = \.\./glibcxx_basedir = ..\/../' \
 	      -e 's/MKDIR_P = \.\./MKDIR_P = ..\/../' \
-	      -e 's/all-local: build_debug/all-local:/' \
-	      -e 's/install-data-local: install_debug/install-data-local:/' \
-	  < ../Makefile > Makefile) ; \
+	      -e 's/all-local: all-local-once/all-local:/' \
+	      -e 's/install-data-local: install-data-local-once/install-data-local:/' \
+	  < ../Makefile > Makefile ; \
+	  for d in . $(SUBDIRS); do \
+	  sed -e 's/top_builddir = \.\./top_builddir = ..\/../' \
+	      -e 's/top_build_prefix = \.\./top_build_prefix = ..\/../' \
+	      -e 's/srcdir = \.\./srcdir = ..\/../' \
+	      -e 's/VPATH = \.\./VPATH = ..\/../' \
+	      -e 's/glibcxx_basedir = \.\./glibcxx_basedir = ..\/../' \
+	      -e 's/MKDIR_P = \.\./MKDIR_P = ..\/../' \
+	  < ../$$d/Makefile > $$d/Makefile ; \
+	  done) ; \
 	fi; \
 	echo `date` > stamp-debug;
 
-build_debug: stamp-debug
-	(cd ${debugdir} && $(MAKE) CXXFLAGS='$(DEBUG_FLAGS)' all)
+build-debug: stamp-debug
+	(cd ${debugdir} && $(MAKE) CXXFLAGS='$(DEBUG_FLAGS)' libstdc++.la)
 
-# Install debug library here.
-install_debug:
-	(cd ${debugdir} && $(MAKE) \
-	toolexeclibdir=$(glibcxx_toolexeclibdir)/debug install)
+# Install debug library.
+install-debug: stamp-debug
+	(if [ $$(basename $(CURDIR)) != debug ]; then \
+	  cd ${debugdir} && $(MAKE) \
+	  toolexeclibdir=$(glibcxx_toolexeclibdir)/debug install; \
+	fi)