Remove path name from test case
[binutils-gdb.git] / ld / Makefile.am
1 ## Process this file with automake to generate Makefile.in
2 #
3 # Copyright (C) 2012-2023 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 = dejagnu no-texinfo.tex no-dist foreign info-in-builddir
21 ACLOCAL_AMFLAGS = -I .. -I ../config -I ../bfd
22 TEXINFO_TEX = ../texinfo/texinfo.tex
23
24 SUBDIRS = po
25
26 tooldir = $(exec_prefix)/$(target_alias)
27
28 YACC = `if [ -f ../bison/bison ]; then echo ../bison/bison -y -L$(srcdir)/../bison/; else echo @YACC@; fi`
29 YFLAGS = -d
30 LEX = `if [ -f ../flex/flex ]; then echo ../flex/flex; else echo @LEX@; fi`
31
32 # Automake 1.10+ disables lex and yacc output file regeneration if
33 # maintainer mode is disabled. Avoid this.
34 am__skiplex =
35 am__skipyacc =
36
37 # This is where we get zlib from. zlibdir is -L../zlib and zlibinc is
38 # -I../zlib, unless we were configured with --with-system-zlib, in which
39 # case both are empty.
40 ZLIB = @zlibdir@ -lz
41 ZLIBINC = @zlibinc@
42
43 ELF_CFLAGS=-DELF_LIST_OPTIONS=@elf_list_options@ \
44 -DELF_SHLIB_LIST_OPTIONS=@elf_shlib_list_options@ \
45 -DELF_PLT_UNWIND_LIST_OPTIONS=@elf_plt_unwind_list_options@
46 WARN_CFLAGS = @WARN_CFLAGS@
47 NO_WERROR = @NO_WERROR@
48 AM_CFLAGS = $(WARN_CFLAGS) $(ELF_CFLAGS) $(JANSSON_CFLAGS) $(ZSTD_CFLAGS)
49
50 # We put the scripts in the directory $(scriptdir)/ldscripts.
51 # We can't put the scripts in $(datadir) because the SEARCH_DIR
52 # directives need to be different for native and cross linkers.
53 scriptdir = $(tooldir)/lib
54
55 EMUL = @EMUL@
56 EMULATION_OFILES = @EMULATION_OFILES@
57 EMUL_EXTRA_OFILES = @EMUL_EXTRA_OFILES@
58
59
60 # Search path to override the default search path for -lfoo libraries.
61 # If LIB_PATH is empty, the ones in the script (if any) are left alone.
62 # (The default is usually /lib:/usr/lib:/usr/local/lib, unless building
63 # a cross-linker, in which case the default is empty. See genscripts.sh.)
64 # Otherwise, they are replaced with the ones given in LIB_PATH,
65 # which may have the form: LIB_PATH=/lib:/usr/local/lib. This can be set
66 # when the linker is configured via the --with-lib-path configure switch.
67 LIB_PATH = @LIB_PATH@
68
69 BASEDIR = $(srcdir)/..
70 BFDDIR = $(BASEDIR)/bfd
71 INCDIR = $(BASEDIR)/include
72
73 # What version of the manual to build
74 DOCVER = gen
75
76 # Options to extract the man page from ld.texi
77 MANCONF = -Dman
78
79 TEXI2POD = perl $(BASEDIR)/etc/texi2pod.pl $(AM_MAKEINFOFLAGS)
80
81 POD2MAN = pod2man --center="GNU Development Tools" \
82 --release="binutils-$(VERSION)" --section=1
83
84 # Setup the testing framework, if you have one
85 EXPECT = expect
86 RUNTEST = runtest
87 RUNTESTFLAGS =
88
89 CC_FOR_TARGET = ` \
90 if [ -f $$r/../gcc/xgcc ] ; then \
91 if [ -f $$r/../newlib/Makefile ] ; then \
92 echo $$r/../gcc/xgcc -B$$r/../gcc/ -idirafter $$r/../newlib/targ-include -idirafter $${srcroot}/../newlib/libc/include -nostdinc; \
93 else \
94 echo $$r/../gcc/xgcc -B$$r/../gcc/; \
95 fi; \
96 else \
97 if [ "@host@" = "@target@" ] ; then \
98 echo $(CC); \
99 else \
100 echo gcc | sed '$(transform)'; \
101 fi; \
102 fi`
103
104 CXX_FOR_TARGET = ` \
105 if [ -f $$r/../gcc/g++ ] ; then \
106 if [ -f $$r/../newlib/Makefile ] ; then \
107 echo $$r/../gcc/g++ -B$$r/../gcc/ -idirafter $$r/../newlib/targ-include -idirafter $${srcroot}/../newlib/libc/include -nostdinc; \
108 else \
109 echo $$r/../gcc/g++ -B$$r/../gcc/; \
110 fi; \
111 elif [ -f $$r/../gcc/xg++ ] ; then \
112 if [ -f $$r/../newlib/Makefile ] ; then \
113 echo $$r/../gcc/xg++ -B$$r/../gcc/ -idirafter $$r/../newlib/targ-include -idirafter $${srcroot}/../newlib/libc/include -nostdinc; \
114 else \
115 echo $$r/../gcc/xg++ -B$$r/../gcc/; \
116 fi; \
117 else \
118 if [ "@host@" = "@target@" ] ; then \
119 echo $(CXX); \
120 else \
121 echo g++ | sed '$(transform)'; \
122 fi; \
123 fi`
124
125 # Strip out sanitization options as we want to test building binaries without any extra paraphernalia
126 CFLAGS_FOR_TARGET = `echo $(CFLAGS) | sed -e 's/-fsanitize=[^ ]*//g'`
127 CXXFLAGS_FOR_TARGET = `echo $(CXXFLAGS) | sed -e 's/-fsanitize=[^ ]*//g'`
128
129 transform = s/^ld-new$$/$(installed_linker)/;@program_transform_name@
130 bin_PROGRAMS = ld-new
131 info_TEXINFOS = ld.texi ldint.texi
132 ld_TEXINFOS = configdoc.texi
133 noinst_TEXINFOS = ldint.texi
134 man_MANS = ld.1
135
136 AM_MAKEINFOFLAGS = -I $(srcdir) -I $(BFDDIR)/doc -I ../bfd/doc \
137 -I $(top_srcdir)/../libiberty --no-split
138 TEXI2DVI = texi2dvi -I $(srcdir) -I $(BFDDIR)/doc -I ../bfd/doc \
139 -I $(top_srcdir)/../libiberty
140
141 AM_CPPFLAGS = -I. -I$(srcdir) -I../bfd -I$(BFDDIR) -I$(INCDIR) @zlibinc@ \
142 @INCINTL@ $(HDEFINES) $(CFLAGS) @LARGEFILE_CPPFLAGS@ \
143 -DLOCALEDIR="\"$(datadir)/locale\""
144
145 BFDLIB = ../bfd/libbfd.la
146 LIBIBERTY = ../libiberty/libiberty.a
147 if ENABLE_LIBCTF
148 LIBCTF = ../libctf/libctf.la
149 else
150 LIBCTF =
151 endif
152
153 # These all start with e so 'make clean' can find them.
154 ALL_EMULATION_SOURCES = \
155 eaix5ppc.c \
156 eaix5rs6.c \
157 eaixppc.c \
158 eaixrs6.c \
159 ealpha.c \
160 ealphavms.c \
161 earcelf.c \
162 earclinux.c \
163 earclinux_nps.c \
164 earcv2elf.c \
165 earcv2elfx.c \
166 earm_wince_pe.c \
167 earmelf.c \
168 earmelf_fbsd.c \
169 earmelf_fuchsia.c \
170 earmelf_haiku.c \
171 earmelf_linux.c \
172 earmelf_linux_eabi.c \
173 earmelf_linux_fdpiceabi.c \
174 earmelf_nacl.c \
175 earmelf_nbsd.c \
176 earmelf_phoenix.c \
177 earmelf_vxworks.c \
178 earmelfb.c \
179 earmelfb_fbsd.c \
180 earmelfb_fuchsia.c \
181 earmelfb_linux.c \
182 earmelfb_linux_eabi.c \
183 earmelfb_linux_fdpiceabi.c \
184 earmelfb_nacl.c \
185 earmelfb_nbsd.c \
186 earmnto.c \
187 earmpe.c \
188 eavr1.c \
189 eavr2.c \
190 eavr25.c \
191 eavr3.c \
192 eavr31.c \
193 eavr35.c \
194 eavr4.c \
195 eavr5.c \
196 eavr51.c \
197 eavr6.c \
198 eavrtiny.c \
199 eavrxmega1.c \
200 eavrxmega2.c \
201 eavrxmega3.c \
202 eavrxmega4.c \
203 eavrxmega5.c \
204 eavrxmega6.c \
205 eavrxmega7.c \
206 ecrisaout.c \
207 ecriself.c \
208 ecrislinux.c \
209 ecskyelf.c \
210 ecskyelf_linux.c \
211 ed10velf.c \
212 ed30v_e.c \
213 ed30v_o.c \
214 ed30velf.c \
215 eelf32_dlx.c \
216 eelf32_sparc.c \
217 eelf32_sparc_sol2.c \
218 eelf32_sparc_vxworks.c \
219 eelf32_spu.c \
220 eelf32_tic6x_be.c \
221 eelf32_tic6x_elf_be.c \
222 eelf32_tic6x_elf_le.c \
223 eelf32_tic6x_le.c \
224 eelf32_tic6x_linux_be.c \
225 eelf32_tic6x_linux_le.c \
226 eelf32am33lin.c \
227 eelf32bfin.c \
228 eelf32bfinfd.c \
229 eelf32cr16.c \
230 eelf32crx.c \
231 eelf32epiphany.c \
232 eelf32epiphany_4x4.c \
233 eelf32fr30.c \
234 eelf32frv.c \
235 eelf32frvfd.c \
236 eelf32ft32.c \
237 eelf32ip2k.c \
238 eelf32iq10.c \
239 eelf32iq2000.c \
240 eelf32lm32.c \
241 eelf32lm32fd.c \
242 eelf32lppc.c \
243 eelf32lppclinux.c \
244 eelf32lppcnto.c \
245 eelf32lppcsim.c \
246 eelf32m32c.c \
247 eelf32mb_linux.c \
248 eelf32mbel_linux.c \
249 eelf32mcore.c \
250 eelf32mep.c \
251 eelf32metag.c \
252 eelf32microblaze.c \
253 eelf32microblazeel.c \
254 eelf32moxie.c \
255 eelf32mt.c \
256 eelf32or1k.c \
257 eelf32or1k_linux.c \
258 eelf32ppc.c \
259 eelf32ppc_fbsd.c \
260 eelf32ppchaiku.c \
261 eelf32ppclinux.c \
262 eelf32ppcnto.c \
263 eelf32ppcsim.c \
264 eelf32ppcvxworks.c \
265 eelf32ppcwindiss.c \
266 eelf32rl78.c \
267 eelf32rx.c \
268 eelf32rx_linux.c \
269 eelf32tilegx.c \
270 eelf32tilegx_be.c \
271 eelf32tilepro.c \
272 eelf32vax.c \
273 eelf32visium.c \
274 eelf32xstormy16.c \
275 eelf32xtensa.c \
276 eelf32z80.c \
277 eelf_i386.c \
278 eelf_i386_be.c \
279 eelf_i386_fbsd.c \
280 eelf_i386_haiku.c \
281 eelf_i386_ldso.c \
282 eelf_i386_sol2.c \
283 eelf_i386_vxworks.c \
284 eelf_iamcu.c \
285 eelf_s390.c \
286 eh8300elf.c \
287 eh8300elf_linux.c \
288 eh8300helf.c \
289 eh8300helf_linux.c \
290 eh8300hnelf.c \
291 eh8300self.c \
292 eh8300self_linux.c \
293 eh8300snelf.c \
294 eh8300sxelf.c \
295 eh8300sxelf_linux.c \
296 eh8300sxnelf.c \
297 ehppaelf.c \
298 ehppalinux.c \
299 ehppanbsd.c \
300 ehppaobsd.c \
301 ei386aout.c \
302 ei386beos.c \
303 ei386bsd.c \
304 ei386go32.c \
305 ei386lynx.c \
306 ei386moss.c \
307 ei386msdos.c \
308 ei386nto.c \
309 ei386pe.c \
310 ei386pe_posix.c \
311 em32relf.c \
312 em32relf_linux.c \
313 em32rlelf.c \
314 em32rlelf_linux.c \
315 em68hc11elf.c \
316 em68hc11elfb.c \
317 em68hc12elf.c \
318 em68hc12elfb.c \
319 em68kelf.c \
320 em68kelfnbsd.c \
321 em9s12zelf.c \
322 emcorepe.c \
323 emn10200.c \
324 emn10300.c \
325 emoxiebox.c \
326 emsp430X.c \
327 emsp430elf.c \
328 ends32belf.c \
329 ends32belf16m.c \
330 ends32belf_linux.c \
331 ends32elf.c \
332 ends32elf16m.c \
333 ends32elf_linux.c \
334 enios2elf.c \
335 enios2linux.c \
336 ens32knbsd.c \
337 epc532macha.c \
338 epdp11.c \
339 epjelf.c \
340 epjlelf.c \
341 eppcmacos.c \
342 epruelf.c \
343 escore3_elf.c \
344 escore7_elf.c \
345 esh.c \
346 eshelf.c \
347 eshelf_fd.c \
348 eshelf_linux.c \
349 eshelf_nbsd.c \
350 eshelf_nto.c \
351 eshelf_uclinux.c \
352 eshelf_vxworks.c \
353 eshl.c \
354 eshlelf.c \
355 eshlelf_fd.c \
356 eshlelf_linux.c \
357 eshlelf_nbsd.c \
358 eshlelf_nto.c \
359 eshlelf_vxworks.c \
360 eshpe.c \
361 etic30coff.c \
362 etic3xcoff.c \
363 etic3xcoff_onchip.c \
364 etic4xcoff.c \
365 etic54xcoff.c \
366 ev850.c \
367 ev850_rh850.c \
368 evanilla.c \
369 evaxnbsd.c \
370 exgateelf.c \
371 ez80.c \
372 ez8001.c \
373 ez8002.c
374
375 ALL_EMULATIONS = $(ALL_EMULATION_SOURCES:.c=.@OBJEXT@)
376
377 ALL_64_EMULATION_SOURCES = \
378 eaarch64cloudabi.c \
379 eaarch64cloudabib.c \
380 eaarch64elf.c \
381 eaarch64elf32.c \
382 eaarch64elf32b.c \
383 eaarch64elfb.c \
384 eaarch64fbsd.c \
385 eaarch64fbsdb.c \
386 eaarch64haiku.c \
387 eaarch64linux.c \
388 eaarch64linux32.c \
389 eaarch64linux32b.c \
390 eaarch64linuxb.c \
391 eaarch64nto.c \
392 eaarch64pe.c \
393 earm64pe.c \
394 eelf32_x86_64.c \
395 eelf32b4300.c \
396 eelf32bmip.c \
397 eelf32bmipn32.c \
398 eelf32briscv.c \
399 eelf32briscv_ilp32.c \
400 eelf32briscv_ilp32f.c \
401 eelf32bsmip.c \
402 eelf32btsmip.c \
403 eelf32btsmip_fbsd.c \
404 eelf32btsmipn32.c \
405 eelf32btsmipn32_fbsd.c \
406 eelf32ebmip.c \
407 eelf32ebmipvxworks.c \
408 eelf32elmip.c \
409 eelf32elmipvxworks.c \
410 eelf32kvx.c \
411 eelf32l4300.c \
412 eelf32lmip.c \
413 eelf32loongarch.c \
414 eelf32lr5900.c \
415 eelf32lr5900n32.c \
416 eelf32lriscv.c \
417 eelf32lriscv_ilp32.c \
418 eelf32lriscv_ilp32f.c \
419 eelf32lsmip.c \
420 eelf32ltsmip.c \
421 eelf32ltsmip_fbsd.c \
422 eelf32ltsmipn32.c \
423 eelf32ltsmipn32_fbsd.c \
424 eelf32mipswindiss.c \
425 eelf64_aix.c \
426 eelf64_ia64.c \
427 eelf64_ia64_fbsd.c \
428 eelf64_ia64_vms.c \
429 eelf64_s390.c \
430 eelf64_sparc.c \
431 eelf64_sparc_fbsd.c \
432 eelf64_sparc_sol2.c \
433 eelf64alpha.c \
434 eelf64alpha_fbsd.c \
435 eelf64alpha_nbsd.c \
436 eelf64bmip.c \
437 eelf64bpf.c \
438 eelf64briscv.c \
439 eelf64briscv_lp64.c \
440 eelf64briscv_lp64f.c \
441 eelf64btsmip.c \
442 eelf64btsmip_fbsd.c \
443 eelf64hppa.c \
444 eelf64kvx.c \
445 eelf64kvx_linux.c \
446 eelf64loongarch.c \
447 eelf64lppc.c \
448 eelf64lppc_fbsd.c \
449 eelf64lriscv.c \
450 eelf64lriscv_lp64.c \
451 eelf64lriscv_lp64f.c \
452 eelf64ltsmip.c \
453 eelf64ltsmip_fbsd.c \
454 eelf64mmix.c \
455 eelf64ppc.c \
456 eelf64ppc_fbsd.c \
457 eelf64rdos.c \
458 eelf64tilegx.c \
459 eelf64tilegx_be.c \
460 eelf_mipsel_haiku.c \
461 eelf_x86_64.c \
462 eelf_x86_64_cloudabi.c \
463 eelf_x86_64_fbsd.c \
464 eelf_x86_64_haiku.c \
465 eelf_x86_64_sol2.c \
466 ehppa64linux.c \
467 ei386pep.c \
468 emmo.c
469
470 ALL_64_EMULATIONS = $(ALL_64_EMULATION_SOURCES:.c=.@OBJEXT@)
471
472 ALL_EMUL_EXTRA_OFILES = \
473 deffilep.@OBJEXT@ \
474 pdb.@OBJEXT@ \
475 pe-dll.@OBJEXT@ \
476 ldelf.@OBJEXT@ \
477 ldelfgen.@OBJEXT@
478
479 ALL_64_EMUL_EXTRA_OFILES = \
480 pep-dll.@OBJEXT@
481
482 CFILES = ldctor.c ldemul.c ldexp.c ldfile.c ldlang.c \
483 ldmain.c ldmisc.c ldver.c ldwrite.c lexsup.c \
484 mri.c ldcref.c pe-dll.c pep-dll.c ldlex-wrapper.c \
485 plugin.c ldbuildid.c ldelf.c ldelfgen.c \
486 pdb.c
487
488 HFILES = ld.h ldctor.h ldemul.h ldexp.h ldfile.h \
489 ldlang.h ldlex.h ldmain.h ldmisc.h ldver.h \
490 ldwrite.h mri.h deffile.h pe-dll.h pep-dll.h \
491 elf-hints-local.h plugin.h ldbuildid.h ldelf.h ldelfgen.h \
492 pdb.h
493
494 GENERATED_CFILES = ldgram.c ldlex.c deffilep.c
495 GENERATED_HFILES = ldgram.h ldemul-list.h deffilep.h
496
497 # Require an early dependency on the generated headers, as the dependency
498 # tracking will not cause them to be built beforehand.
499 BUILT_SOURCES = $(GENERATED_HFILES) @MAINT@ $(GENERATED_CFILES) \
500 $(ALL_EMULATION_SOURCES) $(ALL_64_EMULATION_SOURCES)
501
502 OFILES = ldgram.@OBJEXT@ ldlex-wrapper.@OBJEXT@ lexsup.@OBJEXT@ ldlang.@OBJEXT@ \
503 mri.@OBJEXT@ ldctor.@OBJEXT@ ldmain.@OBJEXT@ plugin.@OBJEXT@ \
504 ldwrite.@OBJEXT@ ldexp.@OBJEXT@ ldemul.@OBJEXT@ ldver.@OBJEXT@ ldmisc.@OBJEXT@ \
505 ldfile.@OBJEXT@ ldcref.@OBJEXT@ ${EMULATION_OFILES} ${EMUL_EXTRA_OFILES} \
506 ldbuildid.@OBJEXT@
507
508 STAGESTUFF = *.@OBJEXT@ ldscripts/* e*.c
509
510 # Disable -Werror, if it has been enabled, since old versions of bison/
511 # yacc will produce working code which contain compile time warnings.
512 ldgram.@OBJEXT@: ldgram.c
513 if am__fastdepCC
514 $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `test -f ldgram.c || echo $(srcdir)/`ldgram.c $(NO_WERROR)
515 $(AM_V_at)mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
516 else
517 if AMDEP
518 source='ldgram.c' object='$@' libtool=no @AMDEPBACKSLASH@
519 DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
520 endif
521 $(AM_V_CC)$(COMPILE) -c `test -f ldgram.c || echo $(srcdir)/`ldgram.c $(NO_WERROR)
522 endif
523
524 ldlex-wrapper.@OBJEXT@: ldlex-wrapper.c ldlex.c
525 if am__fastdepCC
526 $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $(srcdir)/ldlex-wrapper.c $(NO_WERROR)
527 $(AM_V_at)mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
528 else
529 if AMDEP
530 source='ldlex-wrapper.c' object='$@' libtool=no @AMDEPBACKSLASH@
531 DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
532 endif
533 $(AM_V_CC)$(COMPILE) -c $(srcdir)/ldlex-wrapper.c $(NO_WERROR)
534 endif
535
536 deffilep.@OBJEXT@: deffilep.c
537 if am__fastdepCC
538 $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `test -f deffilep.c || echo $(srcdir)/`deffilep.c $(NO_WERROR)
539 $(AM_V_at)mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
540 else
541 if AMDEP
542 source='deffilep.c' object='$@' libtool=no @AMDEPBACKSLASH@
543 DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
544 endif
545 $(AM_V_CC)$(COMPILE) -c `test -f deffilep.c || echo $(srcdir)/`deffilep.c $(NO_WERROR)
546 endif
547
548 SRC_POTFILES = $(CFILES) $(HFILES)
549 BLD_POTFILES = $(ALL_EMULATION_SOURCES) $(ALL_64_EMULATION_SOURCES)
550
551 po/SRC-POTFILES.in: @MAINT@ Makefile
552 for f in $(SRC_POTFILES); do echo $$f; done | LC_ALL=C sort > $@-tmp \
553 && mv $@-tmp $(srcdir)/po/SRC-POTFILES.in
554
555 po/BLD-POTFILES.in: @MAINT@ Makefile
556 for f in $(BLD_POTFILES); do echo $$f; done | LC_ALL=C sort > $@-tmp \
557 && mv $@-tmp $(srcdir)/po/BLD-POTFILES.in
558
559 ldmain.@OBJEXT@: ldmain.c config.status
560 if am__fastdepCC
561 $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ \
562 -DDEFAULT_EMULATION='"$(EMUL)"' \
563 -DBINDIR='"$(bindir)"' -DTOOLBINDIR='"$(tooldir)/bin"' \
564 -DTARGET='"@target@"' @TARGET_SYSTEM_ROOT_DEFINE@ \
565 $(srcdir)/ldmain.c
566 $(AM_V_at)mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
567 else
568 if AMDEP
569 source='ldmain.c' object='$@' libtool=no @AMDEPBACKSLASH@
570 DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
571 endif
572 $(AM_V_CC)$(COMPILE) -c -DDEFAULT_EMULATION='"$(EMUL)"' \
573 -DBINDIR='"$(bindir)"' -DTOOLBINDIR='"$(tooldir)/bin"' \
574 -DTARGET='"@target@"' @TARGET_SYSTEM_ROOT_DEFINE@ \
575 $(srcdir)/ldmain.c
576 endif
577
578 ldfile.@OBJEXT@: ldfile.c config.status
579 if am__fastdepCC
580 $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ \
581 -DSCRIPTDIR='"$(scriptdir)"' -DBINDIR='"$(bindir)"' -DTOOLBINDIR='"$(tooldir)/bin"' \
582 $(srcdir)/ldfile.c
583 $(AM_V_at)mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
584 else
585 if AMDEP
586 source='ldfile.c' object='$@' libtool=no @AMDEPBACKSLASH@
587 DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
588 endif
589 $(AM_V_CC)$(COMPILE) -c -DSCRIPTDIR='"$(scriptdir)"' -DBINDIR='"$(bindir)"' \
590 -DTOOLBINDIR='"$(tooldir)/bin"' \
591 $(srcdir)/ldfile.c
592 endif
593
594 eelf32_spu.@OBJEXT@: eelf32_spu.c
595 if am__fastdepCC
596 $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ \
597 -DEMBEDSPU="\"`echo embedspu | sed '$(transform)'`\"" eelf32_spu.c
598 $(AM_V_at)mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
599 else
600 if AMDEP
601 source='eelf32_spu.c' object='$@' libtool=no @AMDEPBACKSLASH@
602 DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
603 endif
604 $(AM_V_CC)$(COMPILE) -c -DEMBEDSPU="\"`echo embedspu | sed '$(transform)'`\"" \
605 eelf32_spu.c
606 endif
607
608 ldemul-list.h: Makefile
609 (echo "/* This file is automatically generated. DO NOT EDIT! */";\
610 for f in `echo " " ${EMULATION_OFILES} "" \
611 | sed -e 's/ e/ ld/g' -e 's/ ld/ /g' -e 's/[.]o//g'`; do \
612 echo "extern ld_emulation_xfer_type ld_$${f}_emulation;"; \
613 done;\
614 echo "";\
615 echo "#define EMULATION_LIST \\";\
616 for f in `echo " " ${EMULATION_OFILES} "" \
617 | sed -e 's/ e/ ld/g' -e 's/ ld/ /g' -e 's/[.]o//g'`; do \
618 echo " &ld_$${f}_emulation, \\"; \
619 done;\
620 echo " 0") >ldemul-tmp.h
621 mv ldemul-tmp.h ldemul-list.h
622
623 ldscripts/stamp:
624 $(AM_V_GEN)test -d $(@D) || mkdir $(@D); touch $@
625
626 if AMDEP
627 GENDEPDIR=$(DEPDIR)
628 else
629 GENDEPDIR=
630 endif
631 GENSCRIPTS = $(SHELL) $(srcdir)/genscripts.sh "${srcdir}" "${libdir}" "${prefix}" "${exec_prefix}" @host@ @target@ @target_alias@ "$(GENDEPDIR)" "${LIB_PATH}" "@EMULATION_LIBPATH@" "@NATIVE_LIB_DIRS@" @use_sysroot@ @enable_initfini_array@
632 GEN_DEPENDS = $(srcdir)/genscripts.sh ldscripts/stamp
633
634 @TDIRS@
635
636 e%.c:
637 $(AM_V_GEN)${GENSCRIPTS} $* "$(tdir_$*)"
638
639 $(ALL_EMULATION_SOURCES) $(ALL_64_EMULATION_SOURCES): $(GEN_DEPENDS)
640
641 #Dummy rule to prevent make considering e%.c as a source for missing
642 #.Pc files (and they are all missing until the e*.c files are generated).
643 #For example, we don't want e.deps/emmo.Pc.c to be tried when
644 #.deps/emmo.Pc is missing.
645 %.Pc:
646
647 @AMDEP_TRUE@-include $(patsubst %.c,./$(DEPDIR)/%.Pc,$(ALL_EMULATION_SOURCES) $(ALL_64_EMULATION_SOURCES))
648
649 # We need this for automake to use YLWRAP.
650 EXTRA_ld_new_SOURCES = deffilep.y ldlex.l
651 # Allow dependency tracking to work for these files, too.
652 EXTRA_ld_new_SOURCES += ldelf.c ldelfgen.c pdb.c pep-dll.c pe-dll.c \
653 pep-dll-aarch64.c pep-dll-x86_64.c
654
655 ld_new_SOURCES = ldgram.y ldlex-wrapper.c lexsup.c ldlang.c mri.c ldctor.c ldmain.c \
656 ldwrite.c ldexp.c ldemul.c ldver.c ldmisc.c ldfile.c ldcref.c plugin.c \
657 ldbuildid.c
658 ld_new_DEPENDENCIES = $(EMULATION_OFILES) $(EMUL_EXTRA_OFILES) \
659 $(BFDLIB) $(LIBCTF) $(LIBIBERTY) $(LIBINTL_DEP) $(JANSSON_LIBS)
660 ld_new_LDADD = $(EMULATION_OFILES) $(EMUL_EXTRA_OFILES) $(BFDLIB) $(LIBCTF) \
661 $(LIBIBERTY) $(LIBINTL) $(ZLIB) $(ZSTD_LIBS) $(JANSSON_LIBS)
662
663 # Dependency tracking for the generated emulation files.
664 EXTRA_ld_new_SOURCES += $(ALL_EMULATION_SOURCES) $(ALL_64_EMULATION_SOURCES)
665
666 # This is the real libbfd.a and libctf.a created by libtool.
667 TESTBFDLIB = @TESTBFDLIB@
668 TESTCTFLIB = @TESTCTFLIB@
669 TESTSFRAMELIB = @TESTSFRAMELIB@
670
671 check-DEJAGNU: site.exp
672 (cd .libs; test -e ldscripts || test ! -e ld-new || $(LN_S) ../ldscripts .)
673 srcroot=`cd $(srcdir) && pwd`; export srcroot; \
674 r=`pwd`; export r; \
675 LC_ALL=C; export LC_ALL; \
676 EXPECT=$(EXPECT); export EXPECT; \
677 runtest=$(RUNTEST); \
678 if $(SHELL) -c "$$runtest --version" > /dev/null 2>&1; then \
679 $$runtest --tool $(DEJATOOL) --srcdir $${srcroot}/testsuite \
680 CC="$(CC)" CFLAGS="$(CFLAGS)" \
681 CXX="$(CXX)" CXXFLAGS="$(CXXFLAGS)" \
682 CC_FOR_TARGET="$(CC_FOR_TARGET)" \
683 CFLAGS_FOR_TARGET="$(filter-out -ffile-prefix-map=%,$(CFLAGS_FOR_TARGET))" \
684 CXX_FOR_TARGET="$(CXX_FOR_TARGET)" \
685 CXXFLAGS_FOR_TARGET="$(filter-out -ffile-prefix-map=%,$(CXXFLAGS_FOR_TARGET))" \
686 OFILES="$(OFILES)" BFDLIB="$(TESTBFDLIB)" CTFLIB="$(TESTCTFLIB) $(ZLIB)" \
687 SFRAMELIB="$(TESTSFRAMELIB)" \
688 JANSSON_LIBS="$(JANSSON_LIBS)" ZSTD_LIBS="$(ZSTD_LIBS)" \
689 LIBIBERTY="$(LIBIBERTY) $(LIBINTL)" LIBS="$(LIBS)" \
690 DO_COMPARE="`echo '$(do_compare)' | sed -e 's,\\$$,,g'`" \
691 $(RUNTESTFLAGS); \
692 else echo "WARNING: could not find \`runtest'" 1>&2; :;\
693 fi
694
695 development.exp: $(BFDDIR)/development.sh
696 $(AM_V_GEN)$(EGREP) "(development|experimental)=" $(BFDDIR)/development.sh \
697 | $(AWK) -F= '{ print "set " $$1 " " $$2 }' > $@
698
699 enablings.exp:
700 $(AM_V_GEN)echo "set enable_libctf ${enable_libctf}" >> $@
701 #
702 #
703 # Build a dummy plugin using libtool.
704 #
705 noinst_LTLIBRARIES = libldtestplug.la libldtestplug2.la \
706 libldtestplug3.la libldtestplug4.la
707 libldtestplug_la_SOURCES = testplug.c
708 libldtestplug_la_CFLAGS= -g -O2
709 libldtestplug_la_LDFLAGS = -no-undefined -rpath /nowhere
710 libldtestplug2_la_SOURCES = testplug2.c
711 libldtestplug2_la_CFLAGS= -g -O2
712 libldtestplug2_la_LDFLAGS = -no-undefined -rpath /nowhere
713 libldtestplug3_la_SOURCES = testplug3.c
714 libldtestplug3_la_CFLAGS= -g -O2
715 libldtestplug3_la_LDFLAGS = -no-undefined -rpath /nowhere
716 libldtestplug4_la_SOURCES = testplug4.c
717 libldtestplug4_la_CFLAGS= -g -O2
718 libldtestplug4_la_LDFLAGS = -no-undefined -rpath /nowhere
719
720 bfdplugindir = $(libdir)/bfd-plugins
721 bfdplugin_LTLIBRARIES = libdep.la
722 libdep_la_SOURCES = libdep_plugin.c
723 libdep_la_LDFLAGS = -no-undefined -rpath /nowhere -module -avoid-version
724 libdep_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
725 --tag=disable-static \
726 $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
727 $(libdep_la_LDFLAGS) $(LDFLAGS) -o $@
728
729 # DOCUMENTATION TARGETS
730 # Manual configuration file; not usually attached to normal configuration,
731 # because almost all configs use "gen" version of manual.
732 # Set DOCVER above to change.
733 configdoc.texi: ${DOCVER}-doc.texi
734 $(AM_V_GEN)cp ${srcdir}/${DOCVER}-doc.texi ./configdoc.texi
735 $(AM_V_at)chmod u+w ./configdoc.texi
736
737 # Build the man page from the texinfo file
738 # The sed command removes the no-adjust Nroff command so that
739 # the man output looks standard.
740 ld.1: $(srcdir)/ld.texi configdoc.texi
741 $(AM_V_GEN)touch $@
742 $(AM_V_at)-$(TEXI2POD) $(MANCONF) < $(srcdir)/ld.texi > ld.pod
743 $(AM_V_at)-($(POD2MAN) ld.pod | \
744 sed -e '/^.if n .na/d' > $@.T$$$$ && \
745 mv -f $@.T$$$$ $@) || \
746 (rm -f $@.T$$$$ && exit 1)
747 $(AM_V_at)rm -f ld.pod
748
749 # Build the man page from the texinfo file
750 # The sed command removes the no-adjust Nroff command so that
751 # the man output looks standard.
752 ldint.1: $(srcdir)/ldint.texi configdoc.texi
753 $(AM_V_GEN)touch $@
754 $(AM_V_at)-$(TEXI2POD) $(MANCONF) < $(srcdir)/ldint.texi > ldint.pod
755 $(AM_V_at)-($(POD2MAN) ldint.pod | \
756 sed -e '/^.if n .na/d' > $@.T$$$$ && \
757 mv -f $@.T$$$$ $@) || \
758 (rm -f $@.T$$$$ && exit 1)
759 $(AM_V_at)rm -f ldint.pod
760
761 MAINTAINERCLEANFILES = configdoc.texi ld.1 ldint.1
762
763 # We want to reconfigure if configure.host or configure.tgt changes.
764 # development.sh is used to determine -Werror default.
765 CONFIG_STATUS_DEPENDENCIES = $(srcdir)/configure.host $(srcdir)/configure.tgt \
766 $(BFDDIR)/development.sh
767
768 EXTRA_DEJAGNU_SITE_CONFIG = development.exp enablings.exp
769
770 MOSTLYCLEANFILES = $(STAGESTUFF) ld1$(EXEEXT) ld2$(EXEEXT) ld3$(EXEEXT) \
771 ldemul-list.h crtbegin.@OBJEXT@ crtend.@OBJEXT@ ld.log ld.sum
772 mostlyclean-local:
773 -rm -rf tmpdir
774 CLEANFILES = dep.sed DEP DEPA DEP1 DEP2 spu_ovl.s spu_ovl.@OBJEXT@ spu_icache.s spu_icache.@OBJEXT@
775
776 .PHONY: install-exec-local install-data-local
777
778 install-exec-local: ld-new$(EXEEXT) install-binPROGRAMS
779 $(mkinstalldirs) $(DESTDIR)$(tooldir)/bin
780 n=`echo $(installed_linker) | sed '$(transform)'`; \
781 if test "$(bindir)" != "$(tooldir)/bin"; then \
782 rm -f $(DESTDIR)$(tooldir)/bin/$(installed_linker)$(EXEEXT); \
783 ln $(DESTDIR)$(bindir)/$$n$(EXEEXT) $(DESTDIR)$(tooldir)/bin/$(installed_linker)$(EXEEXT) >/dev/null 2>/dev/null \
784 || $(INSTALL_PROGRAM_ENV) $(LIBTOOL) --mode=install $(INSTALL_PROGRAM) ld-new$(EXEEXT) $(DESTDIR)$(tooldir)/bin/$(installed_linker)$(EXEEXT); \
785 fi; \
786 if test "x$(install_as_default)" = "xyes"; then \
787 ld=`echo ld | sed '$(transform)'`; \
788 rm -f $(DESTDIR)$(bindir)/$$ld$(EXEEXT); \
789 ln $(DESTDIR)$(bindir)/$$n$(EXEEXT) $(DESTDIR)$(bindir)/$$ld$(EXEEXT) >/dev/null 2>/dev/null \
790 || $(INSTALL_PROGRAM_ENV) $(LIBTOOL) --mode=install $(INSTALL_PROGRAM) ld-new$(EXEEXT) $(DESTDIR)$(bindir)/$$ld$(EXEEXT); \
791 if test "$(bindir)" != "$(tooldir)/bin"; then \
792 rm -f $(DESTDIR)$(tooldir)/bin/ld$(EXEEXT); \
793 ln $(DESTDIR)$(bindir)/$$n$(EXEEXT) $(DESTDIR)$(tooldir)/bin/ld$(EXEEXT) >/dev/null 2>/dev/null \
794 || $(INSTALL_PROGRAM_ENV) $(LIBTOOL) --mode=install $(INSTALL_PROGRAM) ld-new$(EXEEXT) $(DESTDIR)$(tooldir)/bin/ld$(EXEEXT); \
795 fi; \
796 fi
797
798 install-data-local: install-bfdpluginLTLIBRARIES
799 $(mkinstalldirs) $(DESTDIR)$(scriptdir)/ldscripts
800 for f in ldscripts/* ; do \
801 case $$f in \
802 stamp) ;; \
803 *) $(INSTALL_DATA) $$f $(DESTDIR)$(scriptdir)/$$f ; \
804 esac \
805 done
806 rm -f $(DESTDIR)$(bfdplugindir)/libdep.la
807 rm -f $(DESTDIR)$(bfdplugindir)/libdep.dll.a
808
809 # Stuff that should be included in a distribution. The diststuff
810 # target is run by the taz target in ../Makefile.in.
811 EXTRA_DIST = ldgram.c ldgram.h ldlex.c emultempl/spu_ovl.@OBJEXT@_c \
812 emultempl/spu_icache.@OBJEXT@_c deffilep.c deffilep.h $(man_MANS)
813 diststuff: info $(EXTRA_DIST)
814
815 # Both info (ld.info) and ld.1 depend on configdoc.texi.
816 # But info isn't a direct target. Make info-recursive to depend on
817 # ld.1 to support parallel build.
818 info-recursive: ld.1
819
820 html-local: doc/ld/index.html
821 doc/ld/index.html: ld.texi $(ld_TEXINFOS)
822 $(AM_V_at)$(MKDIR_P) doc
823 $(AM_V_GEN)$(MAKEINFOHTML) $(AM_MAKEINFOHTMLFLAGS) $(MAKEINFOFLAGS) \
824 --split=node -I$(srcdir) $(srcdir)/ld.texi -o doc/ld
825
826 DISTCLEANFILES = site.exp development.exp enablings.exp site.bak
827 distclean-local:
828 rm -rf ldscripts
829
830 MAINTAINERCLEANFILES += ld.info