]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blob - gold/Makefile.am
Add diststuff target to Makefile.
[thirdparty/binutils-gdb.git] / gold / Makefile.am
1 ## Process this file with automake to generate Makefile.in
2 #
3 # Copyright (C) 2006-2015 Free Software Foundation, Inc.
4 #
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.
9 #
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.
14 #
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/>.
18 #
19
20 AUTOMAKE_OPTIONS = foreign
21
22 SUBDIRS = po testsuite
23
24 tooldir = $(exec_prefix)/$(target_alias)
25
26 ACLOCAL_AMFLAGS = -I ../bfd -I ../config
27
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.
31 ZLIB = @zlibdir@ -lz
32 ZLIBINC = @zlibinc@
33
34 AM_CFLAGS = $(WARN_CFLAGS) $(LFS_CFLAGS) $(RANDOM_SEED_CFLAGS) $(ZLIBINC)
35 AM_CXXFLAGS = $(WARN_CXXFLAGS) $(LFS_CFLAGS) $(RANDOM_SEED_CFLAGS) $(ZLIBINC)
36
37 AM_CPPFLAGS = \
38 -I$(srcdir) -I$(srcdir)/../include -I$(srcdir)/../elfcpp \
39 -DLOCALEDIR="\"$(datadir)/locale\"" \
40 -DBINDIR="\"$(bindir)\"" -DTOOLBINDIR="\"$(tooldir)/bin\"" \
41 -DTOOLLIBDIR="\"$(tooldir)/lib\"" @INCINTL@
42
43 LIBIBERTY = ../libiberty/libiberty.a
44
45 if PLUGINS
46 LIBDL = @DLOPEN_LIBS@
47 endif
48
49 if THREADS
50 THREADSLIB = -lpthread
51 endif
52
53 AM_YFLAGS = -d
54
55 # Automake 1.10+ disables lex and yacc output file regeneration if
56 # maintainer mode is disabled. Avoid this.
57 am__skiplex =
58 am__skipyacc =
59
60 bin_PROGRAMS = dwp
61
62 noinst_PROGRAMS = ld-new incremental-dump
63 noinst_LIBRARIES = libgold.a
64
65 CCFILES = \
66 archive.cc \
67 attributes.cc \
68 binary.cc \
69 common.cc \
70 compressed_output.cc \
71 copy-relocs.cc \
72 cref.cc \
73 defstd.cc \
74 descriptors.cc \
75 dirsearch.cc \
76 dynobj.cc \
77 dwarf_reader.cc \
78 ehframe.cc \
79 errors.cc \
80 expression.cc \
81 fileread.cc \
82 gc.cc \
83 gdb-index.cc \
84 gold.cc \
85 gold-threads.cc \
86 icf.cc \
87 incremental.cc \
88 int_encoding.cc \
89 layout.cc \
90 mapfile.cc \
91 merge.cc \
92 nacl.cc \
93 object.cc \
94 options.cc \
95 output.cc \
96 parameters.cc \
97 plugin.cc \
98 readsyms.cc \
99 reduced_debug_output.cc \
100 reloc.cc \
101 resolve.cc \
102 script-sections.cc \
103 script.cc \
104 stringpool.cc \
105 symtab.cc \
106 target.cc \
107 target-select.cc \
108 timer.cc \
109 version.cc \
110 workqueue.cc \
111 workqueue-threads.cc
112
113 HFILES = \
114 arm-reloc-property.h \
115 aarch64-reloc-property.h \
116 archive.h \
117 attributes.h \
118 binary.h \
119 common.h \
120 compressed_output.h \
121 copy-relocs.h \
122 cref.h \
123 defstd.h \
124 dirsearch.h \
125 descriptors.h \
126 dynobj.h \
127 dwarf_reader.h \
128 ehframe.h \
129 errors.h \
130 fileread.h \
131 freebsd.h \
132 gc.h \
133 gdb-index.h \
134 gold.h \
135 gold-threads.h \
136 icf.h \
137 int_encoding.h \
138 layout.h \
139 mapfile.h \
140 merge.h \
141 nacl.h \
142 object.h \
143 options.h \
144 output.h \
145 parameters.h \
146 plugin.h \
147 readsyms.h \
148 reduced_debug_output.h \
149 reloc.h \
150 reloc-types.h \
151 script-c.h \
152 script-sections.h \
153 script.h \
154 stringpool.h \
155 symtab.h \
156 target.h \
157 target-reloc.h \
158 target-select.h \
159 timer.h \
160 tls.h \
161 token.h \
162 workqueue.h \
163 workqueue-internal.h
164
165 YFILES = \
166 yyscript.y
167
168 DEFFILES = arm-reloc.def aarch64-reloc.def
169
170 EXTRA_DIST = yyscript.c yyscript.h
171
172 diststuff: $(EXTRA_DIST)
173
174 TARGETSOURCES = \
175 i386.cc x86_64.cc sparc.cc powerpc.cc arm.cc arm-reloc-property.cc tilegx.cc \
176 mips.cc aarch64.cc aarch64-reloc-property.cc
177
178 ALL_TARGETOBJS = \
179 i386.$(OBJEXT) x86_64.$(OBJEXT) sparc.$(OBJEXT) powerpc.$(OBJEXT) \
180 arm.$(OBJEXT) arm-reloc-property.$(OBJEXT) tilegx.$(OBJEXT) \
181 mips.$(OBJEXT) aarch64.$(OBJEXT) aarch64-reloc-property.$(OBJEXT)
182
183 libgold_a_SOURCES = $(CCFILES) $(HFILES) $(YFILES) $(DEFFILES)
184 libgold_a_LIBADD = $(LIBOBJS)
185
186 sources_var = main.cc
187 deps_var = $(TARGETOBJS) libgold.a $(LIBIBERTY) $(LIBINTL_DEP)
188 ldadd_var = $(TARGETOBJS) libgold.a $(LIBIBERTY) $(GOLD_LDADD) $(LIBINTL) \
189 $(THREADSLIB) $(LIBDL) $(ZLIB)
190 ldflags_var = $(GOLD_LDFLAGS)
191
192 ld_new_SOURCES = $(sources_var)
193 ld_new_DEPENDENCIES = $(deps_var)
194 ld_new_LDADD = $(ldadd_var)
195 ld_new_LDFLAGS = $(ldflags_var)
196
197 EXTRA_ld_new_SOURCES = $(TARGETSOURCES)
198
199 incremental_dump_SOURCES = incremental-dump.cc
200 incremental_dump_DEPENDENCIES = $(TARGETOBJS) libgold.a $(LIBIBERTY) \
201 $(LIBINTL_DEP)
202 incremental_dump_LDADD = $(TARGETOBJS) libgold.a $(LIBIBERTY) $(LIBINTL) \
203 $(THREADSLIB) $(LIBDL) $(ZLIB)
204
205 dwp_SOURCES = dwp.cc
206 dwp_DEPENDENCIES = libgold.a $(LIBIBERTY) $(LIBINTL_DEP)
207 dwp_LDADD = libgold.a $(LIBIBERTY) $(GOLD_LDADD) $(LIBINTL) $(THREADSLIB) \
208 $(LIBDL) $(ZLIB)
209 dwp_LDFLAGS = $(GOLD_LDFLAGS)
210
211 CONFIG_STATUS_DEPENDENCIES = $(srcdir)/../bfd/development.sh
212
213 # Use an explicit dependency for the bison generated header file.
214 expression.$(OBJEXT): yyscript.h
215 script-sections.$(OBJEXT): yyscript.h
216 script.$(OBJEXT): yyscript.h
217
218 # We have to build libgold.a before we run the tests.
219 check: libgold.a
220
221 .PHONY: install-exec-local
222
223 install-exec-local: ld-new$(EXEEXT)
224 $(mkinstalldirs) $(DESTDIR)$(bindir) $(DESTDIR)$(tooldir)/bin
225 n=`echo $(installed_linker) | sed '$(transform)'`; \
226 $(INSTALL_PROGRAM_ENV) $(INSTALL_PROGRAM) \
227 ld-new$(EXEEXT) $(DESTDIR)$(bindir)/$${n}$(EXEEXT); \
228 if test "$(bindir)" != "$(tooldir)/bin"; then \
229 rm -f $(DESTDIR)$(tooldir)/bin/$(installed_linker)$(EXEEXT); \
230 ln $(DESTDIR)$(bindir)/$${n}$(EXEEXT) $(DESTDIR)$(tooldir)/bin/$(installed_linker)$(EXEEXT) >/dev/null 2>/dev/null \
231 || $(INSTALL_PROGRAM_ENV) $(INSTALL_PROGRAM) ld-new$(EXEEXT) $(DESTDIR)$(tooldir)/bin/$(installed_linker)$(EXEEXT); \
232 fi; \
233 if test "x$(install_as_default)" = "xyes"; then \
234 ld=`echo ld | sed '$(transform)'`; \
235 rm -f $(DESTDIR)$(bindir)/$${ld}$(EXEEXT); \
236 ln $(DESTDIR)$(bindir)/$${n}$(EXEEXT) $(DESTDIR)$(bindir)/$${ld}$(EXEEXT) >/dev/null 2>/dev/null \
237 || $(INSTALL_PROGRAM_ENV) $(INSTALL_PROGRAM) ld-new$(EXEEXT) $(DESTDIR)$(bindir)/$${ld}$(EXEEXT); \
238 if test "$(bindir)" != "$(tooldir)/bin"; then \
239 rm -f $(DESTDIR)$(tooldir)/bin/ld$(EXEEXT); \
240 ln $(DESTDIR)$(bindir)/$${n}$(EXEEXT) $(DESTDIR)$(tooldir)/bin/ld$(EXEEXT) >/dev/null 2>/dev/null \
241 || $(INSTALL_PROGRAM_ENV) $(INSTALL_PROGRAM) ld-new$(EXEEXT) $(DESTDIR)$(tooldir)/bin/ld$(EXEEXT); \
242 fi; \
243 fi
244
245 # We want install to imply install-info as per GNU standards, despite
246 # the cygnus option.
247 install-data-local: install-info
248
249 POTFILES= $(CCFILES) $(HFILES) $(TARGETSOURCES)
250
251 po/POTFILES.in: @MAINT@ Makefile
252 for f in $(POTFILES); do echo $$f; done | LC_ALL=C sort > tmp \
253 && mv tmp $(srcdir)/po/POTFILES.in
254
255 # Bootstrap test support. We use ld-new to build ld1, then use ld1 to
256 # build ld2. ld1 and ld2 should be identical. ld-new need not be
257 # identical to ld1, since it was linked with the host linker.
258
259 if GCC
260 if NATIVE_LINKER
261
262 gcctestdir1/ld: ld-new
263 test -d gcctestdir1 || mkdir -p gcctestdir1
264 rm -f gcctestdir1/ld
265 (cd gcctestdir1 && $(LN_S) ../ld-new ld)
266
267 ld1_SOURCES = $(sources_var)
268 ld1_DEPENDENCIES = $(deps_var) gcctestdir1/ld
269 ld1_LDADD = $(ldadd_var)
270 ld1_LDFLAGS = -Bgcctestdir1/
271
272 gcctestdir2/ld: ld1
273 test -d gcctestdir2 || mkdir -p gcctestdir2
274 rm -f gcctestdir2/ld
275 (cd gcctestdir2 && $(LN_S) ../ld1 ld)
276
277 ld2_SOURCES = $(sources_var)
278 ld2_DEPENDENCIES = $(deps_var) gcctestdir2/ld
279 ld2_LDADD = $(ldadd_var)
280 ld2_LDFLAGS = -Bgcctestdir2/
281
282 bootstrap-test: ld2
283 rm -f $@
284 echo "#!/bin/sh" > $@
285 echo "cmp ld1 ld2" >> $@
286 chmod +x $@
287
288 libgold-1-r.o: gcctestdir1/ld libgold.a
289 gcctestdir1/ld -o $@ -r --whole-archive libgold.a
290
291 ld1_r_SOURCES = $(sources_var)
292 ld1_r_DEPENDENCIES = libgold-1-r.o $(deps_var) gcctestdir1/ld
293 ld1_r_LDADD = libgold-1-r.o $(ldadd_var)
294 ld1_r_LDFLAGS = -Bgcctestdir1/
295
296 gcctestdir2-r/ld: ld1-r
297 test -d gcctestdir2-r || mkdir -p gcctestdir2-r
298 rm -f gcctestdir2-r/ld
299 (cd gcctestdir2-r && $(LN_S) ../ld1-r ld)
300
301 libgold-2-r.o: gcctestdir2-r/ld libgold.a
302 gcctestdir2-r/ld -o $@ -r --whole-archive libgold.a
303
304 ld2_r_SOURCES = $(sources_var)
305 ld2_r_DEPENDENCIES = libgold-2-r.o $(deps_var) gcctestdir2-r/ld
306 ld2_r_LDADD = libgold-2-r.o $(ldadd_var)
307 ld2_r_LDFLAGS = -Bgcctestdir2-r/
308
309 bootstrap-test-r: ld2-r
310 rm -f $@
311 echo "#!/bin/sh" > $@
312 echo "cmp ld1-r ld2-r" >> $@
313 chmod +x $@
314
315 check_PROGRAMS = ld1 ld2 ld1-r ld2-r
316 TESTS = bootstrap-test bootstrap-test-r
317
318 # Verify that changing the number of threads doesn't change the
319 # treehash computation, by building ld1 and ld3 the same way except
320 # for the number of threads. However, the build ID should change if
321 # we change the chunk size for --build-id=tree, so ld4 should be
322 # different. We run the latter test even if multithreading is unavailable,
323 # because the treehash can still operate in that mode.
324 check_PROGRAMS += ld4
325 TESTS += bootstrap-test-treehash-chunksize
326
327 gcctestdir3/ld: ld-new
328 test -d gcctestdir3 || mkdir -p gcctestdir3
329 rm -f gcctestdir3/ld
330 (cd gcctestdir3 && $(LN_S) ../ld-new ld)
331
332 ld3_SOURCES = $(sources_var)
333 ld3_DEPENDENCIES = $(deps_var) gcctestdir3/ld
334 ld3_LDADD = $(ldadd_var)
335 ld3_LDFLAGS = -Bgcctestdir3/
336
337 gcctestdir4/ld: ld-new
338 test -d gcctestdir4 || mkdir -p gcctestdir4
339 rm -f gcctestdir4/ld
340 (cd gcctestdir4 && $(LN_S) ../ld-new ld)
341
342 ld4_SOURCES = $(sources_var)
343 ld4_DEPENDENCIES = $(deps_var) gcctestdir4/ld
344 ld4_LDADD = $(ldadd_var)
345 ld4_LDFLAGS = -Bgcctestdir4/
346
347 ld1_LDFLAGS += -Wl,--build-id=tree -Wl,--build-id-chunk-size-for-treehash=12345 -Wl,--build-id-min-file-size-for-treehash=0
348 ld2_LDFLAGS += -Wl,--build-id=tree -Wl,--build-id-chunk-size-for-treehash=12345 -Wl,--build-id-min-file-size-for-treehash=0
349 ld3_LDFLAGS += -Wl,--build-id=tree -Wl,--build-id-chunk-size-for-treehash=12345 -Wl,--build-id-min-file-size-for-treehash=0
350 ld4_LDFLAGS += -Wl,--build-id=tree -Wl,--build-id-chunk-size-for-treehash=12346 -Wl,--build-id-min-file-size-for-treehash=0
351
352 if THREADS
353
354 ld1_LDFLAGS += -Wl,--thread-count=3
355 ld2_LDFLAGS += -Wl,--thread-count=3
356 ld3_LDFLAGS += -Wl,--thread-count=13
357 ld4_LDFLAGS += -Wl,--thread-count=3
358 check_PROGRAMS += ld3
359 TESTS += bootstrap-test-treehash-chunksize
360
361 bootstrap-test-treehash: ld1 ld3
362 rm -f $@
363 echo "#!/bin/sh" > $@
364 echo "cmp ld1 ld3" >> $@
365 chmod +x $@
366
367 endif
368
369 bootstrap-test-treehash-chunksize: ld1 ld4
370 rm -f $@
371 echo "#!/bin/sh" > $@
372 echo "cmp ld1 ld4 | grep ." >> $@
373 chmod +x $@
374
375 endif
376 endif