1 ## Process this file with automake to generate Makefile.in
3 # Copyright (C) 2006-2015 Free Software Foundation, Inc.
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 # This is where we get zlib from. zlibdir is -L../zlib and zlibinc is
29 # -I../zlib, unless we were configured with --with-system-zlib, in which
30 # case both are empty.
34 AM_CFLAGS = $(WARN_CFLAGS) $(LFS_CFLAGS) $(RANDOM_SEED_CFLAGS) $(ZLIBINC)
35 AM_CXXFLAGS = $(WARN_CXXFLAGS) $(LFS_CFLAGS) $(RANDOM_SEED_CFLAGS) $(ZLIBINC)
38 -I$(srcdir) -I$(srcdir)/../include -I$(srcdir)/../elfcpp \
39 -DLOCALEDIR="\"$(datadir)/locale\"" \
40 -DBINDIR="\"$(bindir)\"" -DTOOLBINDIR="\"$(tooldir)/bin\"" \
41 -DTOOLLIBDIR="\"$(tooldir)/lib\"" @INCINTL@
43 LIBIBERTY = ../libiberty/libiberty.a
50 THREADSLIB = -lpthread
55 # Automake 1.10+ disables lex and yacc output file regeneration if
56 # maintainer mode is disabled. Avoid this.
62 noinst_PROGRAMS = ld-new incremental-dump
63 noinst_LIBRARIES = libgold.a
70 compressed_output.cc \
99 reduced_debug_output.cc \
114 arm-reloc-property.h \
115 aarch64-reloc-property.h \
120 compressed_output.h \
148 reduced_debug_output.h \
168 DEFFILES = arm-reloc.def aarch64-reloc.def
170 EXTRA_DIST = yyscript.c yyscript.h
173 i386.cc x86_64.cc sparc.cc powerpc.cc arm.cc arm-reloc-property.cc tilegx.cc \
174 mips.cc aarch64.cc aarch64-reloc-property.cc
177 i386.$(OBJEXT) x86_64.$(OBJEXT) sparc.$(OBJEXT) powerpc.$(OBJEXT) \
178 arm.$(OBJEXT) arm-reloc-property.$(OBJEXT) tilegx.$(OBJEXT) \
179 mips.$(OBJEXT) aarch64.$(OBJEXT) aarch64-reloc-property.$(OBJEXT)
181 libgold_a_SOURCES = $(CCFILES) $(HFILES) $(YFILES) $(DEFFILES)
182 libgold_a_LIBADD = $(LIBOBJS)
184 sources_var = main.cc
185 deps_var = $(TARGETOBJS) libgold.a $(LIBIBERTY) $(LIBINTL_DEP)
186 ldadd_var = $(TARGETOBJS) libgold.a $(LIBIBERTY) $(GOLD_LDADD) $(LIBINTL) \
187 $(THREADSLIB) $(LIBDL) $(ZLIB)
188 ldflags_var = $(GOLD_LDFLAGS)
190 ld_new_SOURCES = $(sources_var)
191 ld_new_DEPENDENCIES = $(deps_var)
192 ld_new_LDADD = $(ldadd_var)
193 ld_new_LDFLAGS = $(ldflags_var)
195 EXTRA_ld_new_SOURCES = $(TARGETSOURCES)
197 incremental_dump_SOURCES = incremental-dump.cc
198 incremental_dump_DEPENDENCIES = $(TARGETOBJS) libgold.a $(LIBIBERTY) \
200 incremental_dump_LDADD = $(TARGETOBJS) libgold.a $(LIBIBERTY) $(LIBINTL) \
201 $(THREADSLIB) $(LIBDL) $(ZLIB)
204 dwp_DEPENDENCIES = libgold.a $(LIBIBERTY) $(LIBINTL_DEP)
205 dwp_LDADD = libgold.a $(LIBIBERTY) $(GOLD_LDADD) $(LIBINTL) $(THREADSLIB) \
207 dwp_LDFLAGS = $(GOLD_LDFLAGS)
209 CONFIG_STATUS_DEPENDENCIES = $(srcdir)/../bfd/development.sh
211 # Use an explicit dependency for the bison generated header file.
212 expression.$(OBJEXT): yyscript.h
213 script-sections.$(OBJEXT): yyscript.h
214 script.$(OBJEXT): yyscript.h
216 # We have to build libgold.a before we run the tests.
219 .PHONY: install-exec-local
221 install-exec-local: ld-new$(EXEEXT)
222 $(mkinstalldirs) $(DESTDIR)$(bindir) $(DESTDIR)$(tooldir)/bin
223 n=`echo $(installed_linker) | sed '$(transform)'`; \
224 $(INSTALL_PROGRAM_ENV) $(INSTALL_PROGRAM) \
225 ld-new$(EXEEXT) $(DESTDIR)$(bindir)/$${n}$(EXEEXT); \
226 if test "$(bindir)" != "$(tooldir)/bin"; then \
227 rm -f $(DESTDIR)$(tooldir)/bin/$(installed_linker)$(EXEEXT); \
228 ln $(DESTDIR)$(bindir)/$${n}$(EXEEXT) $(DESTDIR)$(tooldir)/bin/$(installed_linker)$(EXEEXT) >/dev/null 2>/dev/null \
229 || $(INSTALL_PROGRAM_ENV) $(INSTALL_PROGRAM) ld-new$(EXEEXT) $(DESTDIR)$(tooldir)/bin/$(installed_linker)$(EXEEXT); \
231 if test "x$(install_as_default)" = "xyes"; then \
232 ld=`echo ld | sed '$(transform)'`; \
233 rm -f $(DESTDIR)$(bindir)/$${ld}$(EXEEXT); \
234 ln $(DESTDIR)$(bindir)/$${n}$(EXEEXT) $(DESTDIR)$(bindir)/$${ld}$(EXEEXT) >/dev/null 2>/dev/null \
235 || $(INSTALL_PROGRAM_ENV) $(INSTALL_PROGRAM) ld-new$(EXEEXT) $(DESTDIR)$(bindir)/$${ld}$(EXEEXT); \
236 if test "$(bindir)" != "$(tooldir)/bin"; then \
237 rm -f $(DESTDIR)$(tooldir)/bin/ld$(EXEEXT); \
238 ln $(DESTDIR)$(bindir)/$${n}$(EXEEXT) $(DESTDIR)$(tooldir)/bin/ld$(EXEEXT) >/dev/null 2>/dev/null \
239 || $(INSTALL_PROGRAM_ENV) $(INSTALL_PROGRAM) ld-new$(EXEEXT) $(DESTDIR)$(tooldir)/bin/ld$(EXEEXT); \
243 # We want install to imply install-info as per GNU standards, despite
245 install-data-local: install-info
247 POTFILES= $(CCFILES) $(HFILES) $(TARGETSOURCES)
249 po/POTFILES.in: @MAINT@ Makefile
250 for f in $(POTFILES); do echo $$f; done | LC_ALL=C sort > tmp \
251 && mv tmp $(srcdir)/po/POTFILES.in
253 # Bootstrap test support. We use ld-new to build ld1, then use ld1 to
254 # build ld2. ld1 and ld2 should be identical. ld-new need not be
255 # identical to ld1, since it was linked with the host linker.
260 gcctestdir1/ld: ld-new
261 test -d gcctestdir1 || mkdir -p gcctestdir1
263 (cd gcctestdir1 && $(LN_S) ../ld-new ld)
265 ld1_SOURCES = $(sources_var)
266 ld1_DEPENDENCIES = $(deps_var) gcctestdir1/ld
267 ld1_LDADD = $(ldadd_var)
268 ld1_LDFLAGS = -Bgcctestdir1/
271 test -d gcctestdir2 || mkdir -p gcctestdir2
273 (cd gcctestdir2 && $(LN_S) ../ld1 ld)
275 ld2_SOURCES = $(sources_var)
276 ld2_DEPENDENCIES = $(deps_var) gcctestdir2/ld
277 ld2_LDADD = $(ldadd_var)
278 ld2_LDFLAGS = -Bgcctestdir2/
282 echo "#!/bin/sh" > $@
283 echo "cmp ld1 ld2" >> $@
286 libgold-1-r.o: gcctestdir1/ld libgold.a
287 gcctestdir1/ld -o $@ -r --whole-archive libgold.a
289 ld1_r_SOURCES = $(sources_var)
290 ld1_r_DEPENDENCIES = libgold-1-r.o $(deps_var) gcctestdir1/ld
291 ld1_r_LDADD = libgold-1-r.o $(ldadd_var)
292 ld1_r_LDFLAGS = -Bgcctestdir1/
294 gcctestdir2-r/ld: ld1-r
295 test -d gcctestdir2-r || mkdir -p gcctestdir2-r
296 rm -f gcctestdir2-r/ld
297 (cd gcctestdir2-r && $(LN_S) ../ld1-r ld)
299 libgold-2-r.o: gcctestdir2-r/ld libgold.a
300 gcctestdir2-r/ld -o $@ -r --whole-archive libgold.a
302 ld2_r_SOURCES = $(sources_var)
303 ld2_r_DEPENDENCIES = libgold-2-r.o $(deps_var) gcctestdir2-r/ld
304 ld2_r_LDADD = libgold-2-r.o $(ldadd_var)
305 ld2_r_LDFLAGS = -Bgcctestdir2-r/
307 bootstrap-test-r: ld2-r
309 echo "#!/bin/sh" > $@
310 echo "cmp ld1-r ld2-r" >> $@
313 check_PROGRAMS = ld1 ld2 ld1-r ld2-r
314 TESTS = bootstrap-test bootstrap-test-r
316 # Verify that changing the number of threads doesn't change the
317 # treehash computation, by building ld1 and ld3 the same way except
318 # for the number of threads. However, the build ID should change if
319 # we change the chunk size for --build-id=tree, so ld4 should be
320 # different. We run the latter test even if multithreading is unavailable,
321 # because the treehash can still operate in that mode.
322 check_PROGRAMS += ld4
323 TESTS += bootstrap-test-treehash-chunksize
325 gcctestdir3/ld: ld-new
326 test -d gcctestdir3 || mkdir -p gcctestdir3
328 (cd gcctestdir3 && $(LN_S) ../ld-new ld)
330 ld3_SOURCES = $(sources_var)
331 ld3_DEPENDENCIES = $(deps_var) gcctestdir3/ld
332 ld3_LDADD = $(ldadd_var)
333 ld3_LDFLAGS = -Bgcctestdir3/
335 gcctestdir4/ld: ld-new
336 test -d gcctestdir4 || mkdir -p gcctestdir4
338 (cd gcctestdir4 && $(LN_S) ../ld-new ld)
340 ld4_SOURCES = $(sources_var)
341 ld4_DEPENDENCIES = $(deps_var) gcctestdir4/ld
342 ld4_LDADD = $(ldadd_var)
343 ld4_LDFLAGS = -Bgcctestdir4/
345 ld1_LDFLAGS += -Wl,--build-id=tree -Wl,--build-id-chunk-size-for-treehash=12345 -Wl,--build-id-min-file-size-for-treehash=0
346 ld2_LDFLAGS += -Wl,--build-id=tree -Wl,--build-id-chunk-size-for-treehash=12345 -Wl,--build-id-min-file-size-for-treehash=0
347 ld3_LDFLAGS += -Wl,--build-id=tree -Wl,--build-id-chunk-size-for-treehash=12345 -Wl,--build-id-min-file-size-for-treehash=0
348 ld4_LDFLAGS += -Wl,--build-id=tree -Wl,--build-id-chunk-size-for-treehash=12346 -Wl,--build-id-min-file-size-for-treehash=0
352 ld1_LDFLAGS += -Wl,--thread-count=3
353 ld2_LDFLAGS += -Wl,--thread-count=3
354 ld3_LDFLAGS += -Wl,--thread-count=13
355 ld4_LDFLAGS += -Wl,--thread-count=3
356 check_PROGRAMS += ld3
357 TESTS += bootstrap-test-treehash-chunksize
359 bootstrap-test-treehash: ld1 ld3
361 echo "#!/bin/sh" > $@
362 echo "cmp ld1 ld3" >> $@
367 bootstrap-test-treehash-chunksize: ld1 ld4
369 echo "#!/bin/sh" > $@
370 echo "cmp ld1 ld4 | grep ." >> $@