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