* configure.ac (TARGETLIB_PIC, TARGETLIB_NOASAN): New variables.
* configure: Regenerate.
* maint-tool: Refactor pic/ and noasan/ handling.
* Makefile.in: Likewise. Regenerate dependencies.
---
The below does the same but attempts to be limited to what POSIX
requires a make(1) to provide. Seems to compile fine with gnu-make and
bmake.
Changes v2 - v3:
- drop unneeded SUB_CFLAGS
- add dependencies on %.c for stamp-pic-ofiles and stamp-noasan-ofiles
Ok for trunk?
Signed-off-by: Bernhard Reutner-Fischer rep.dot@gmail.com
---
libiberty/Makefile.in | 2408 +---
libiberty/configure|8 +
libiberty/configure.ac |6 +
libiberty/maint-tool | 33 +-
4 files changed, 1487 insertions(+), 968 deletions(-)
diff --git a/libiberty/Makefile.in b/libiberty/Makefile.in
index f06cc69..ca4e75f 100644
--- a/libiberty/Makefile.in
+++ b/libiberty/Makefile.in
@@ -68,6 +68,7 @@ MAKEOVERRIDES =
TARGETLIB = ./libiberty.a
TESTLIB = ./testlib.a
+TARGETLIBS = $(TARGETLIB) @TARGETLIB_PIC@ @TARGETLIB_NOASAN@
LIBOBJS = @LIBOBJS@
@@ -102,7 +103,7 @@ FLAGS_TO_PASS = \
SUBDIRS = testsuite
# FIXME: add @BUILD_INFO@ once we're sure it works for everyone.
-all: stamp-picdir stamp-noasandir $(TARGETLIB) required-list all-subdir
+all: $(TARGETLIBS) required-list all-subdir
@: $(MAKE) ; $(MULTIDO) $(FLAGS_TO_PASS) multi-do DO=all
.PHONY: check installcheck
@@ -244,24 +245,24 @@ INSTALLED_HEADERS =
\
$(INCDIR)/timeval-utils.h
$(TARGETLIB): $(REQUIRED_OFILES) $(EXTRA_OFILES) $(LIBOBJS)
- -rm -f $(TARGETLIB) pic/$(TARGETLIB) noasan/$(TARGETLIB)
- $(AR) $(AR_FLAGS) $(TARGETLIB) \
+ -rm -f $@
+ $(AR) $(AR_FLAGS) $@ \
$(REQUIRED_OFILES) $(EXTRA_OFILES) $(LIBOBJS)
- $(RANLIB) $(TARGETLIB)
- if [ x$(PICFLAG) != x ]; then \
- cd pic; \
- $(AR) $(AR_FLAGS) $(TARGETLIB) \
- $(REQUIRED_OFILES) $(EXTRA_OFILES) $(LIBOBJS); \
- $(RANLIB) $(TARGETLIB); \
- cd ..; \
- else true; fi; \
- if [ x$(NOASANFLAG) != x ]; then \
- cd noasan; \
- $(AR) $(AR_FLAGS) $(TARGETLIB) \
- $(REQUIRED_OFILES) $(EXTRA_OFILES) $(LIBOBJS); \
- $(RANLIB) $(TARGETLIB); \
- cd ..; \
- else true; fi
+ $(RANLIB) $@
+
+TARGETLIB_PIC_OFILES = `echo $(REQUIRED_OFILES) $(EXTRA_OFILES) $(LIBOBJS) | \
+sed -e 's,[^/ ]*/,./pic/,g';`
+./pic/libiberty.a: stamp-pic-ofiles
+ -rm -f $@
+ $(AR) $(AR_FLAGS) $@ $(TARGETLIB_PIC_OFILES)
+ $(RANLIB) $@
+
+TARGETLIB_NOASAN_OFILES =`echo $(REQUIRED_OFILES) $(EXTRA_OFILES) $(LIBOBJS) |
\
+sed -e 's,[^/ ]*/,./noasan/,g';`
+./noasan/libiberty.a: stamp-noasan-ofiles
+ -rm -f $@
+ $(AR) $(AR_FLAGS) $@ $(TARGETLIB_NOASAN_OFILES)
+ $(RANLIB) $@
$(TESTLIB): $(REQUIRED_OFILES) $(CONFIGURED_OFILES)
-rm -f $(TESTLIB)
@@ -393,17 +394,15 @@ install_to_tooldir: all
required-list: Makefile
echo $(REQUIRED_OFILES) required-list
-stamp-picdir:
- if [ x$(PICFLAG) != x ] [ ! -d pic ]; then \
- mkdir pic; \
- else true; fi
- touch stamp-picdir
+stamp-pic-ofiles: $(CFILES:%=$(srcdir)/%)
+ [ -d pic ] : || mkdir pic
+ $(MAKE) $(FLAGS_TO_PASS) $(TARGETLIB_PIC_OFILES)
+ touch $@
-stamp-noasandir:
- if [ x$(NOASANFLAG) != x ] [ ! -d noasan ]; then \
- mkdir noasan; \
- else true; fi
- touch stamp-noasandir
+stamp-noasan-ofiles: $(CFILES:%=$(srcdir)/%)
+ [ -d noasan ] : || mkdir noasan
+ $(MAKE) $(FLAGS_TO_PASS) $(TARGETLIB_NOASAN_OFILES)
+ touch $@
.PHONY: all etags tags ls clean stage1 stage2
@@ -444,7 +443,7 @@ maint-deps :
mostlyclean: mostlyclean-subdir
-rm -rf *.$(objext) pic noasan core errs \#* *.E a.out
-rm -f errors dummy config.h stamp-*
- -rm -f $(CONFIG_H) stamp-picdir stamp-noasandir
+ -rm -f $(CONFIG_H)
-rm -f libiberty.aux libiberty.cp libiberty.cps libiberty.fn
libiberty.ky
-rm -f libiberty.log libiberty.tmp libiberty.tps libiberty.pg
-rm -f libiberty.pgs libiberty.toc libiberty.tp libiberty.tpl
libiberty.vr
@@ -501,9 +500,6 @@ maintainer-clean-subdir: config.h
cd $$dir $(MAKE) $(FLAGS_TO_PASS) $$target; \
done
-$(REQUIRED_OFILES) $(EXTRA_OFILES) $(LIBOBJS): stamp-picdir stamp-noasandir
-$(CONFIGURED_OFILES): stamp-picdir stamp-noasandir
-
# Don't export variables to the environment, in order to not confuse
# configure.
.NOEXPORT:
@@ -511,1200 +507,1708 @@ $(CONFIGURED_OFILES): stamp-picdir stamp-noasandir
# The dependencies in the remainder of this file are automatically
# generated by make maint-deps. Manual edits will be lost.
-./_doprnt.$(objext): $(srcdir)/_doprnt.c config.h $(INCDIR)/ansidecl.h \
- $(INCDIR)/safe-ctype.h
- if [ x$(PICFLAG) != x ]; then