cleanups in makefiles in ld gold bfd binutils gas gprof opcodes

Ralf Wildenhues Ralf.Wildenhues@gmx.de
Sun Aug 16 08:16:00 GMT 2009


To flush my current patch queue for build system updates (this is still
the first round that targets only directories from the binutils-gdb git
tree), here is a final patch that is more or less cosmetic.  It cleans
up some usage of old, deprecated Automake APIs such as using AM_CPPFLAGS
instead of INCLUDES, it avoid some warnings from automake, and it makes
use of the program_transform feature better to avoid some duplicate
rules for programs renamed upon installation (such as ld-new, as-new).

It is intended to be applied after the move to 2.64/1.11 and after the
patches enabling dependency tracking.

What do you think?

Thanks,
Ralf

ld/ChangeLog:
2009-08-16  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>

	* Makefile.am (bin_PROGRAMS): Renamed from ...
	(noinst_PROGRAMS): ... this.
	(transform): Override, including the renaming of ld-new to ld.
	(install-exec-local): Installation of ld in $(bindir) not needed
	here any more.
	(AM_CPPFLAGS): Renamed from ...
	(INCLUDES): ... this.
	(MAINTAINERCLEANFILES): Add ld.1.
	* Makefile.in: Regenerate.

gold/ChangeLog:
2009-08-16  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>

	* Makefile.am (AM_CPPFLAGS): Renamed from ...
	(INCLUDES): ... this.
	* testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add -Wno-portability.
	(AM_CPPFLAGS): Renamed from ...
	(INCLUDE): ... this.
	* Makefile.in, testsuite/Makefile.in: Regenerate.

bfd/ChangeLog:
2009-08-16  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>

	* Makefile.am (libbfd_la_LDFLAGS): Initialize early, to allow
	appending.
	[INSTALL_LIBBFD] (bfdlib_LTLIBRARIES, bfdinclude_HEADERS): Set
	only in this condition.
	[!INSTALL_LIBBFD] (noinst_LTLIBRARIES, libbfd_la_LDFLAGS): New,
	to build but not install libbfd.la in this condition.
	(install-bfdlibLTLIBRARIES, uninstall-bfdlibLTLIBRARIES)
	(install_libbfd, install_libbfd): Remove.
	* Makefile.in: Regenerate.

binutils/ChangeLog:
2009-08-16  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>

	* Makefile.am (AM_CPPFLAGS): Renamed from ...
	(INCLUDES): ... this.
	(bin2c$(EXEEXT_FOR_BUILD): Adjust rule.
	(installcheck-local): Renamed from ...
	(installcheck): ... this.
	* Makefile.in: Regenerate.

gas/ChangeLog:
2009-08-16  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>

	* Makefile.am (YFLAGS): Remove, not needed any more.
	(AM_CPPFLAGS): Renamed from ...
	(INCLUDES): ... this.
	* Makefile.in: Regenerate.

gprof/ChangeLog:
2009-08-16  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>

	* Makefile.am (AM_CPPFLAGS): Renamed from ...
	(INCLUDES): ... this.
	* Makefile.in: Regenerate.

opcodes/ChangeLog:
2009-08-16  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>

	* Makefile.am (libopcodes_la_LDFLAGS): Initialize early.
	[INSTALL_LIBBFD] (bfdlib_LTLIBRARIES): Set only in this condition.
	[INSTALL_LIBBFD] (bfdinclude_DATA): New.
	[!INSTALL_LIBBFD] (noinst_LTLIBRARIES): New.
	[!INSTALL_LIBBFD] (libopcodes_la_LDFLAGS): Ensure libopcodes.la
	is built shared even if it is not to be installed.
	(install-bfdlibLTLIBRARIES,uninstall-bfdlibLTLIBRARIES)
	(install_libopcodes, uninstall_libopcodes): Remove.
	(AM_CPPFLAGS): Renamed from ...
	(INCLUDES): ... this.
	* Makefile.in: Regenerate.

diff --git a/ld/Makefile.am b/ld/Makefile.am
index a6abe8e..c1a04cd 100644
--- a/ld/Makefile.am
+++ b/ld/Makefile.am
@@ -90,7 +90,8 @@ CXX_FOR_TARGET = ` \
     fi; \
   fi`
 
-noinst_PROGRAMS = ld-new
+transform = s/^ld-new$$/ld/;@program_transform_name@
+bin_PROGRAMS = ld-new
 info_TEXINFOS = ld.texinfo
 ld_TEXINFOS = configdoc.texi
 noinst_TEXINFOS = ldint.texinfo
@@ -101,7 +102,7 @@ AM_MAKEINFOFLAGS = -I $(srcdir) -I $(BFDDIR)/doc -I ../bfd/doc \
 TEXI2DVI = texi2dvi -I $(srcdir) -I $(BFDDIR)/doc -I ../bfd/doc \
 		    -I $(top_srcdir)/../libiberty
 
-INCLUDES = -I. -I$(srcdir) -I../bfd -I$(BFDDIR) -I$(INCDIR) \
+AM_CPPFLAGS = -I. -I$(srcdir) -I../bfd -I$(BFDDIR) -I$(INCDIR) \
 	@INCINTL@ $(HDEFINES) $(CFLAGS) \
 	-DLOCALEDIR="\"$(datadir)/locale\""
 
@@ -1926,7 +1927,7 @@ ld.1: $(srcdir)/ld.texinfo configdoc.texi
 	        (rm -f $@.T$$$$ && exit 1)
 	rm -f ld.pod
 
-MAINTAINERCLEANFILES = configdoc.texi
+MAINTAINERCLEANFILES = configdoc.texi ld.1
 
 # We want to reconfigure if configure.host or configure.tgt changes.  We
 # extract version from bfd/configure.in, so we must depend on that also.
@@ -1942,13 +1943,7 @@ CLEANFILES = dep.sed DEP DEPA DEP1 DEP2 spu_ovl.s spu_ovl.o spu_icache.s spu_ica
 .PHONY: install-exec-local install-data-local
 
 install-exec-local: ld-new$(EXEEXT)
-	$(mkinstalldirs) $(DESTDIR)$(bindir) $(DESTDIR)$(tooldir)/bin
-	@list='$(noinst_PROGRAMS)'; for p in $$list; do \
-	  if test -f $$p; then \
-	    echo " $(LIBTOOL)  --mode=install $(INSTALL_PROGRAM) $$p $(bindir)/`echo $$p|sed -e 's/$(EXEEXT)$$//' -e 's/-new//'|sed '$(transform)'|sed 's/$$/$(EXEEXT)/'`"; \
-	    $(LIBTOOL)  --mode=install $(INSTALL_PROGRAM) $$p $(DESTDIR)$(bindir)/`echo $$p|sed -e 's/$(EXEEXT)$$//' -e 's/-new//'|sed '$(transform)'|sed 's/$$/$(EXEEXT)/'`; \
-	  else :; fi; \
-	done
+	$(mkinstalldirs) $(DESTDIR)$(tooldir)/bin
 	n=`echo ld | sed '$(transform)'`; \
 	if [ "$(bindir)/$$n$(EXEEXT)" != "$(tooldir)/bin/ld$(EXEEXT)" ]; then \
 	  rm -f $(DESTDIR)$(tooldir)/bin/ld$(EXEEXT); \
diff --git a/gold/Makefile.am b/gold/Makefile.am
index 4be1d47..876cc9b 100644
--- a/gold/Makefile.am
+++ b/gold/Makefile.am
@@ -11,7 +11,7 @@ ACLOCAL_AMFLAGS = -I ../bfd -I ../config
 AM_CFLAGS = $(WARN_CFLAGS) $(LFS_CFLAGS) $(RANDOM_SEED_CFLAGS)
 AM_CXXFLAGS = $(WARN_CXXFLAGS) $(LFS_CFLAGS) $(RANDOM_SEED_CFLAGS)
 
-INCLUDES = \
+AM_CPPFLAGS = \
 	-I$(srcdir) -I$(srcdir)/../include -I$(srcdir)/../elfcpp \
 	-DLOCALEDIR="\"$(datadir)/locale\"" \
 	-DBINDIR="\"$(bindir)\"" -DTOOLBINDIR="\"$(tooldir)/bin\"" \
diff --git a/gold/testsuite/Makefile.am b/gold/testsuite/Makefile.am
index e8d03f5..119d98a 100644
--- a/gold/testsuite/Makefile.am
+++ b/gold/testsuite/Makefile.am
@@ -4,7 +4,8 @@
 # system and the host system are the same.  So these tests will not
 # work when building with a cross-compiler.
 
-AUTOMAKE_OPTIONS =
+# Ignore warning about AM_PROG_CC_C_O due to large_CFLAGS
+AUTOMAKE_OPTIONS = -Wno-portability
 
 # The two_file_test tests -fmerge-constants, so we simply always turn
 # it on.  This may need to be controlled by a configure option
@@ -12,7 +13,7 @@ AUTOMAKE_OPTIONS =
 AM_CFLAGS = $(WARN_CFLAGS) $(LFS_CFLAGS) -fmerge-constants
 AM_CXXFLAGS = $(WARN_CXXFLAGS) $(LFS_CFLAGS) -fmerge-constants
 
-INCLUDES = \
+AM_CPPFLAGS = \
 	-I$(srcdir) -I$(srcdir)/.. -I$(srcdir)/../../include \
 	-I$(srcdir)/../../elfcpp -I.. \
 	-DLOCALEDIR="\"$(datadir)/locale\"" \
diff --git a/bfd/Makefile.am b/bfd/Makefile.am
index fe79ea2..8381492 100644
--- a/bfd/Makefile.am
+++ b/bfd/Makefile.am
@@ -15,7 +15,14 @@ bfddocdir = doc
 bfdlibdir = @bfdlibdir@
 bfdincludedir = @bfdincludedir@
 
+libbfd_la_LDFLAGS =
+if INSTALL_LIBBFD
 bfdlib_LTLIBRARIES = libbfd.la
+bfdinclude_HEADERS = $(BFD_H) $(INCDIR)/ansidecl.h $(INCDIR)/symcat.h $(INCDIR)/bfdlink.h
+else !INSTALL_LIBBFD
+noinst_LTLIBRARIES = libbfd.la
+libbfd_la_LDFLAGS += -rpath $(bfdlibdir)
+endif
 
 WARN_CFLAGS = @WARN_CFLAGS@
 NO_WERROR = @NO_WERROR@
@@ -750,7 +757,7 @@ libbfd_la_SOURCES = $(BFD32_LIBS_CFILES)
 EXTRA_libbfd_la_SOURCES = $(CFILES)
 libbfd_la_DEPENDENCIES = $(OFILES) ofiles
 libbfd_la_LIBADD = `cat ofiles` @SHARED_LIBADD@ $(LIBDL)
-libbfd_la_LDFLAGS = -release `cat libtool-soversion` @SHARED_LDFLAGS@
+libbfd_la_LDFLAGS += -release `cat libtool-soversion` @SHARED_LDFLAGS@
 
 # libtool will build .libs/libbfd.a.  We create libbfd.a in the build
 # directory so that we don't have to convert all the programs that use
@@ -862,36 +869,6 @@ $(BFD32_LIBS) \
  $(BFD64_BACKENDS) \
  $(OPTIONAL_BACKENDS): $(BFD_H) $(BFD_H_DEPS) $(LOCAL_H_DEPS)
 
-install-bfdlibLTLIBRARIES: @INSTALL_LIBBFD_TRUE@install_libbfd
-	@$(NORMAL_INSTALL)
-
-uninstall-bfdlibLTLIBRARIES: @INSTALL_LIBBFD_TRUE@uninstall_libbfd
-	@$(NORMAL_UNINSTALL)
-
-.PHONY: install_libbfd uninstall_libbfd
-install_libbfd: $(bfdlib_LTLIBRARIES) $(BFD_H)
-	$(mkinstalldirs) $(DESTDIR)$(bfdlibdir)
-	$(mkinstalldirs) $(DESTDIR)$(bfdincludedir)
-	@list='$(bfdlib_LTLIBRARIES)'; for p in $$list; do \
-	  if test -f $$p; then \
-	    echo "$(LIBTOOL)  --mode=install $(INSTALL) $$p $(DESTDIR)$(bfdlibdir)/$$p"; \
-	    $(LIBTOOL)  --mode=install $(INSTALL) $$p $(DESTDIR)$(bfdlibdir)/$$p; \
-	  else :; fi; \
-	done
-	$(INSTALL_DATA) $(BFD_H) $(DESTDIR)$(bfdincludedir)/bfd.h
-	$(INSTALL_DATA) $(INCDIR)/ansidecl.h $(DESTDIR)$(bfdincludedir)/ansidecl.h
-	$(INSTALL_DATA) $(INCDIR)/symcat.h $(DESTDIR)$(bfdincludedir)/symcat.h
-	$(INSTALL_DATA) $(INCDIR)/bfdlink.h $(DESTDIR)$(bfdincludedir)/bfdlink.h
-
-uninstall_libbfd:
-	list='$(bfdlib_LTLIBRARIES)'; for p in $$list; do \
-	  $(LIBTOOL)  --mode=uninstall rm -f $(DESTDIR)$(bfdlibdir)/$$p; \
-	done
-	rm -f $(DESTDIR)$(bfdincludedir)/bfd.h
-	rm -f $(DESTDIR)$(bfdincludedir)/ansidecl.h
-	rm -f $(DESTDIR)$(bfdincludedir)/symcat.h
-	rm -f $(DESTDIR)$(bfdincludedir)/bfdlink.h
-
 host-aout.lo: Makefile
 
 # The following program can be used to generate a simple config file
diff --git a/bfd/doc/Makefile.am b/bfd/doc/Makefile.am
index 2a10fc0..7476ee5 100644
--- a/bfd/doc/Makefile.am
+++ b/bfd/doc/Makefile.am
@@ -56,12 +56,12 @@ bfd_TEXINFOS = $(DOCFILES) bfdsumm.texi
 
 MKDOC = chew$(EXEEXT_FOR_BUILD)
 
-INCLUDES = -I.. -I$(srcdir)/.. -I$(srcdir)/../../include \
+AM_CPPFLAGS = -I.. -I$(srcdir)/.. -I$(srcdir)/../../include \
 	-I$(srcdir)/../../intl -I../../intl
 
 $(MKDOC): $(srcdir)/chew.c
 	$(CC_FOR_BUILD) -o chew.$$$$ $(CFLAGS_FOR_BUILD) $(LDFLAGS_FOR_BUILD) \
-	  $(H_CFLAGS) $(INCLUDES) $(srcdir)/chew.c; \
+	  $(H_CFLAGS) $(AM_CPPFLAGS) $(srcdir)/chew.c; \
 	$(SHELL) $(srcdir)/../../move-if-change chew.$$$$ $(MKDOC)
 
 protos: libbfd.h libcoff.h bfd.h
diff --git a/binutils/Makefile.am b/binutils/Makefile.am
index 9dc5295..aab446d 100644
--- a/binutils/Makefile.am
+++ b/binutils/Makefile.am
@@ -69,7 +69,7 @@ BASEDIR = $(srcdir)/..
 BFDDIR = $(BASEDIR)/bfd
 INCDIR	= $(BASEDIR)/include
 
-INCLUDES = -I. -I$(srcdir) -I../bfd -I$(BFDDIR) -I$(INCDIR) \
+AM_CPPFLAGS = -I. -I$(srcdir) -I../bfd -I$(BFDDIR) -I$(INCDIR) \
 	 @HDEFINES@ \
 	 @INCINTL@ \
 	 -DLOCALEDIR="\"$(datadir)/locale\"" \
@@ -150,7 +150,7 @@ check-DEJAGNU: site.exp
 	else echo "WARNING: could not find \`runtest'" 1>&2; :;\
 	fi
 
-installcheck:
+installcheck-local:
 	/bin/sh $(srcdir)/sanity.sh $(bindir)
 
 # There's no global DEPENDENCIES.  So, we must explicitly list everything
@@ -263,7 +263,7 @@ sysinfo.o: sysinfo.c
 	fi
 
 bin2c$(EXEEXT_FOR_BUILD):
-	$(CC_FOR_BUILD) -o $@ $(INCLUDES) $(AM_CFLAGS) $(CFLAGS) $(LDFLAGS) $(srcdir)/bin2c.c $(srcdir)/version.c
+	$(CC_FOR_BUILD) -o $@ $(AM_CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) $(LDFLAGS) $(srcdir)/bin2c.c $(srcdir)/version.c
 
 embedspu: embedspu.sh
 	sed "s@^program_transform_name=@program_transform_name=$(program_transform_name)@" < $< > $@
diff --git a/gas/Makefile.am b/gas/Makefile.am
index 177e7f3..a3adf0b 100644
--- a/gas/Makefile.am
+++ b/gas/Makefile.am
@@ -10,10 +10,6 @@ tooldir = $(exec_prefix)/$(target_alias)
 YACC = `if [ -f ../bison/bison ] ; then echo ../bison/bison -y -L../bison/bison ; else echo @YACC@ ; fi`
 LEX = `if [ -f ../flex/flex ] ; then echo ../flex/flex ; else echo @LEX@ ; fi`
 
-# We have to set this, because autoconf 2.59 does not substitute YFLAGS.
-# Autoconf 2.61 does, so this can be removed when we upgrade.
-YFLAGS =
-
 WARN_CFLAGS = @WARN_CFLAGS@
 NO_WERROR = @NO_WERROR@
 AM_CFLAGS = $(WARN_CFLAGS)
@@ -510,7 +506,7 @@ INCDIR = $(BASEDIR)/include
 # Both . and srcdir are used, in that order,
 # so that tm.h and config.h will be found in the compilation
 # subdirectory rather than in the source directory.
-INCLUDES = -I. -I$(srcdir) -I../bfd -I$(srcdir)/config \
+AM_CPPFLAGS = -I. -I$(srcdir) -I../bfd -I$(srcdir)/config \
 	-I$(INCDIR) -I$(srcdir)/.. -I$(BFDDIR) @INCINTL@ \
 	-DLOCALEDIR="\"$(datadir)/locale\""
 
diff --git a/gprof/Makefile.am b/gprof/Makefile.am
index 3f41b51..7df059b 100644
--- a/gprof/Makefile.am
+++ b/gprof/Makefile.am
@@ -16,7 +16,7 @@ WARN_CFLAGS = @WARN_CFLAGS@
 NO_WERROR = @NO_WERROR@
 AM_CFLAGS = $(WARN_CFLAGS)
 
-INCLUDES = -DDEBUG -I../bfd -I$(srcdir)/../include \
+AM_CPPFLAGS = -DDEBUG -I../bfd -I$(srcdir)/../include \
 	-I$(srcdir)/../bfd @INCINTL@ -I. \
 	-DLOCALEDIR="\"$(datadir)/locale\""
 
diff --git a/opcodes/Makefile.am b/opcodes/Makefile.am
index 3c1778c..35049ee 100644
--- a/opcodes/Makefile.am
+++ b/opcodes/Makefile.am
@@ -15,7 +15,14 @@ AM_CFLAGS = $(WARN_CFLAGS)
 bfdlibdir = @bfdlibdir@
 bfdincludedir = @bfdincludedir@
 
+libopcodes_la_LDFLAGS =
+if INSTALL_LIBBFD
 bfdlib_LTLIBRARIES = libopcodes.la
+bfdinclude_DATA = $(INCDIR)/dis-asm.h
+else
+noinst_LTLIBRARIES = libopcodes.la
+libopcodes_la_LDFLAGS += -rpath $(bfdlibdir)
+endif
 
 # This is where bfd.h lives.
 BFD_H = ../bfd/bfd.h
@@ -376,7 +383,7 @@ OFILES = @BFD_MACHINES@
 # that's where the version number in Makefile comes from.
 CONFIG_STATUS_DEPENDENCIES = $(BFDDIR)/configure.in
 
-INCLUDES = -I. -I$(srcdir) -I../bfd -I$(INCDIR) -I$(BFDDIR) @HDEFINES@ @INCINTL@
+AM_CPPFLAGS = -I. -I$(srcdir) -I../bfd -I$(INCDIR) -I$(BFDDIR) @HDEFINES@ @INCINTL@
 
 disassemble.lo: disassemble.c
 if am__fastdepCC
@@ -399,7 +406,7 @@ libopcodes_la_SOURCES =  dis-buf.c disassemble.c dis-init.c
 # hardcoded path to libbfd.so instead of relying on the entries in libbfd.la.
 libopcodes_la_DEPENDENCIES = $(OFILES) @SHARED_DEPENDENCIES@
 libopcodes_la_LIBADD = $(OFILES) @SHARED_LIBADD@
-libopcodes_la_LDFLAGS = -release `cat ../bfd/libtool-soversion` @SHARED_LDFLAGS@
+libopcodes_la_LDFLAGS += -release `cat ../bfd/libtool-soversion` @SHARED_LDFLAGS@
 # Allow dependency tracking to work on all the source files.
 EXTRA_libopcodes_la_SOURCES = $(CFILES)
 
@@ -426,30 +433,6 @@ po/POTFILES.in: @MAINT@ Makefile
 	for f in $(POTFILES); do echo $$f; done | LC_ALL=C sort > tmp \
 	  && mv tmp $(srcdir)/po/POTFILES.in
 
-install-bfdlibLTLIBRARIES: @INSTALL_LIBBFD_TRUE@install_libopcodes
-	@$(NORMAL_INSTALL)
-
-uninstall-bfdlibLTLIBRARIES: @INSTALL_LIBBFD_TRUE@uninstall_libopcodes
-	@$(NORMAL_UNINSTALL)
-
-.PHONY: install_libopcodes uninstall_libopcodes
-install_libopcodes: $(bfdlib_LTLIBRARIES)
-	$(mkinstalldirs) $(DESTDIR)$(bfdlibdir)
-	$(mkinstalldirs) $(DESTDIR)$(bfdincludedir)
-	@list='$(bfdlib_LTLIBRARIES)'; for p in $$list; do \
-	  if test -f $$p; then \
-	    echo "$(LIBTOOL)  --mode=install $(INSTALL) $$p $(DESTDIR)$(bfdlibdir)/$$p"; \
-	    $(LIBTOOL)  --mode=install $(INSTALL) $$p $(DESTDIR)$(bfdlibdir)/$$p; \
-	  else :; fi; \
-	done
-	$(INSTALL_DATA) $(INCDIR)/dis-asm.h $(DESTDIR)$(bfdincludedir)/dis-asm.h
-
-uninstall_libopcodes:
-	list='$(bfdlib_LTLIBRARIES)'; for p in $$list; do \
-	  $(LIBTOOL)  --mode=uninstall rm -f $(DESTDIR)$(bfdlibdir)/$$p; \
-	done
-	rm -f $(DESTDIR)$(bfdincludedir)/dis-asm.h
-
 CLEANFILES = \
 	stamp-ip2k stamp-m32c stamp-m32r stamp-fr30 stamp-frv \
 	stamp-openrisc stamp-iq2000 stamp-mep stamp-mt stamp-xstormy16 stamp-xc16x\



More information about the Binutils mailing list