1 ## Process this file with automake to generate Makefile.in
3 # Copyright 2012 Free Software Foundation
5 # This file is free software; you can redistribute it and/or modify
6 # it under the terms of the GNU General Public License as published by
7 # the Free Software Foundation; either version 3 of the License, or
8 # (at your option) any later version.
10 # This program is distributed in the hope that it will be useful,
11 # but WITHOUT ANY WARRANTY; without even the implied warranty of
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 # GNU General Public License for more details.
15 # You should have received a copy of the GNU General Public License
16 # along with this program; see the file COPYING3. If not see
17 # <http://www.gnu.org/licenses/>.
20 AUTOMAKE_OPTIONS = foreign
22 SUBDIRS = po testsuite
24 tooldir = $(exec_prefix)/$(target_alias)
26 ACLOCAL_AMFLAGS = -I ../bfd -I ../config
28 AM_CFLAGS = $(WARN_CFLAGS) $(LFS_CFLAGS) $(RANDOM_SEED_CFLAGS)
29 AM_CXXFLAGS = $(WARN_CXXFLAGS) $(LFS_CFLAGS) $(RANDOM_SEED_CFLAGS)
32 -I$(srcdir) -I$(srcdir)/../include -I$(srcdir)/../elfcpp \
33 -DLOCALEDIR="\"$(datadir)/locale\"" \
34 -DBINDIR="\"$(bindir)\"" -DTOOLBINDIR="\"$(tooldir)/bin\"" \
35 -DTOOLLIBDIR="\"$(tooldir)/lib\"" @INCINTL@
37 LIBIBERTY = ../libiberty/libiberty.a
44 THREADSLIB = -lpthread
49 # Automake 1.10+ disables lex and yacc output file regeneration if
50 # maintainer mode is disabled. Avoid this.
56 noinst_PROGRAMS = ld-new incremental-dump
57 noinst_LIBRARIES = libgold.a
64 compressed_output.cc \
93 reduced_debug_output.cc \
108 arm-reloc-property.h \
113 compressed_output.h \
141 reduced_debug_output.h \
161 DEFFILES = arm-reloc.def
163 EXTRA_DIST = yyscript.c yyscript.h
166 i386.cc x86_64.cc sparc.cc powerpc.cc arm.cc arm-reloc-property.cc tilegx.cc
169 i386.$(OBJEXT) x86_64.$(OBJEXT) sparc.$(OBJEXT) powerpc.$(OBJEXT) \
170 arm.$(OBJEXT) arm-reloc-property.$(OBJEXT) tilegx.$(OBJEXT)
172 libgold_a_SOURCES = $(CCFILES) $(HFILES) $(YFILES) $(DEFFILES)
173 libgold_a_LIBADD = $(LIBOBJS)
175 sources_var = main.cc
176 deps_var = $(TARGETOBJS) libgold.a $(LIBIBERTY) $(LIBINTL_DEP)
177 ldadd_var = $(TARGETOBJS) libgold.a $(LIBIBERTY) $(GOLD_LDADD) $(LIBINTL) \
178 $(THREADSLIB) $(LIBDL)
179 ldflags_var = $(GOLD_LDFLAGS)
181 ld_new_SOURCES = $(sources_var)
182 ld_new_DEPENDENCIES = $(deps_var)
183 ld_new_LDADD = $(ldadd_var)
184 ld_new_LDFLAGS = $(ldflags_var)
186 EXTRA_ld_new_SOURCES = $(TARGETSOURCES)
188 incremental_dump_SOURCES = incremental-dump.cc
189 incremental_dump_DEPENDENCIES = $(TARGETOBJS) libgold.a $(LIBIBERTY) \
191 incremental_dump_LDADD = $(TARGETOBJS) libgold.a $(LIBIBERTY) $(LIBINTL) \
192 $(THREADSLIB) $(LIBDL)
195 dwp_DEPENDENCIES = libgold.a $(LIBIBERTY) $(LIBINTL_DEP)
196 dwp_LDADD = libgold.a $(LIBIBERTY) $(GOLD_LDADD) $(LIBINTL) $(THREADSLIB) \
198 dwp_LDFLAGS = $(GOLD_LDFLAGS)
200 # Use an explicit dependency for the bison generated header file.
201 expression.$(OBJEXT): yyscript.h
202 script-sections.$(OBJEXT): yyscript.h
203 script.$(OBJEXT): yyscript.h
205 # We have to build libgold.a before we run the tests.
208 .PHONY: install-exec-local
210 install-exec-local: ld-new$(EXEEXT)
211 $(mkinstalldirs) $(DESTDIR)$(bindir) $(DESTDIR)$(tooldir)/bin
212 n=`echo $(installed_linker) | sed '$(transform)'`; \
213 $(INSTALL_PROGRAM) ld-new$(EXEEXT) $(DESTDIR)$(bindir)/$${n}$(EXEEXT); \
214 if test "$(bindir)" != "$(tooldir)/bin"; then \
215 rm -f $(DESTDIR)$(tooldir)/bin/$(installed_linker)$(EXEEXT); \
216 ln $(DESTDIR)$(bindir)/$${n}$(EXEEXT) $(DESTDIR)$(tooldir)/bin/$(installed_linker)$(EXEEXT) >/dev/null 2>/dev/null \
217 || $(INSTALL_PROGRAM) ld-new$(EXEEXT) $(DESTDIR)$(tooldir)/bin/$(installed_linker)$(EXEEXT); \
219 if test "x$(install_as_default)" = "xyes"; then \
220 ld=`echo ld | sed '$(transform)'`; \
221 rm -f $(DESTDIR)$(bindir)/$${ld}$(EXEEXT); \
222 ln $(DESTDIR)$(bindir)/$${n}$(EXEEXT) $(DESTDIR)$(bindir)/$${ld}$(EXEEXT) >/dev/null 2>/dev/null \
223 || $(INSTALL_PROGRAM) ld-new$(EXEEXT) $(DESTDIR)$(bindir)/$${ld}$(EXEEXT); \
224 if test "$(bindir)" != "$(tooldir)/bin"; then \
225 rm -f $(DESTDIR)$(tooldir)/bin/ld$(EXEEXT); \
226 ln $(DESTDIR)$(bindir)/$${n}$(EXEEXT) $(DESTDIR)$(tooldir)/bin/ld$(EXEEXT) >/dev/null 2>/dev/null \
227 || $(INSTALL_PROGRAM) ld-new$(EXEEXT) $(DESTDIR)$(tooldir)/bin/ld$(EXEEXT); \
231 # We want install to imply install-info as per GNU standards, despite
233 install-data-local: install-info
235 POTFILES= $(CCFILES) $(HFILES) $(TARGETSOURCES)
237 po/POTFILES.in: @MAINT@ Makefile
238 for f in $(POTFILES); do echo $$f; done | LC_ALL=C sort > tmp \
239 && mv tmp $(srcdir)/po/POTFILES.in
241 # Bootstrap test support. We use ld-new to build ld1, then use ld1 to
242 # build ld2. ld1 and ld2 should be identical. ld-new need not be
243 # identical to ld1, since it was linked with the host linker.
248 gcctestdir1/ld: ld-new
249 test -d gcctestdir1 || mkdir -p gcctestdir1
251 (cd gcctestdir1 && $(LN_S) ../ld-new ld)
253 ld1_SOURCES = $(sources_var)
254 ld1_DEPENDENCIES = $(deps_var) gcctestdir1/ld
255 ld1_LDADD = $(ldadd_var)
256 ld1_LDFLAGS = -Bgcctestdir1/
259 test -d gcctestdir2 || mkdir -p gcctestdir2
261 (cd gcctestdir2 && $(LN_S) ../ld1 ld)
263 ld2_SOURCES = $(sources_var)
264 ld2_DEPENDENCIES = $(deps_var) gcctestdir2/ld
265 ld2_LDADD = $(ldadd_var)
266 ld2_LDFLAGS = -Bgcctestdir2/
270 echo "#!/bin/sh" > $@
271 echo "cmp ld1 ld2" > $@
274 libgold-1-r.o: gcctestdir1/ld libgold.a
275 gcctestdir1/ld -o $@ -r --whole-archive libgold.a
277 ld1_r_SOURCES = $(sources_var)
278 ld1_r_DEPENDENCIES = libgold-1-r.o $(deps_var) gcctestdir1/ld
279 ld1_r_LDADD = libgold-1-r.o $(ldadd_var)
280 ld1_r_LDFLAGS = -Bgcctestdir1/
282 gcctestdir2-r/ld: ld1-r
283 test -d gcctestdir2-r || mkdir -p gcctestdir2-r
284 rm -f gcctestdir2-r/ld
285 (cd gcctestdir2-r && $(LN_S) ../ld1-r ld)
287 libgold-2-r.o: gcctestdir2-r/ld libgold.a
288 gcctestdir2-r/ld -o $@ -r --whole-archive libgold.a
290 ld2_r_SOURCES = $(sources_var)
291 ld2_r_DEPENDENCIES = libgold-2-r.o $(deps_var) gcctestdir2-r/ld
292 ld2_r_LDADD = libgold-2-r.o $(ldadd_var)
293 ld2_r_LDFLAGS = -Bgcctestdir2-r/
295 bootstrap-test-r: ld2-r
297 echo "#!/bin/sh" > $@
298 echo "cmp ld1-r ld2-r" > $@
301 check_PROGRAMS = ld1 ld2 ld1-r ld2-r
302 TESTS = bootstrap-test bootstrap-test-r