Makefile.am 11 KB

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