1 # Makefile for the GNU linker ld (version 2)
2 # Copyright (C) 1989-1993 Free Software Foundation, Inc.
4 # This file is part of GNU ld..
6 # This program is free software; you can redistribute it and/or modify
7 # it under the terms of the GNU General Public License as published by
8 # the Free Software Foundation; either version 2 of the License, or
9 # (at your option) any later version.
11 # This program is distributed in the hope that it will be useful,
12 # but WITHOUT ANY WARRANTY; without even the implied warranty of
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 # GNU General Public License for more details.
16 # You should have received a copy of the GNU General Public License
17 # along with this program; if not, write to the Free Software
18 # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
26 program_transform_name =
27 exec_prefix = $(prefix)
28 bindir = $(exec_prefix)/bin
29 libdir = $(exec_prefix)/lib
30 tooldir = $(exec_prefix)/$(target_alias)
31 datadir = $(prefix)/lib
32 mandir = $(prefix)/man
33 man1dir = $(mandir)/man1
34 man2dir = $(mandir)/man2
35 man3dir = $(mandir)/man3
36 man4dir = $(mandir)/man4
37 man5dir = $(mandir)/man5
38 man6dir = $(mandir)/man6
39 man7dir = $(mandir)/man7
40 man8dir = $(mandir)/man8
41 man9dir = $(mandir)/man9
42 infodir = $(prefix)/info
43 includedir = $(prefix)/include
44 docdir = $(datadir)/doc
45 # We put the scripts in the directory $(scriptdir)/ldscripts.
46 # We can't put the scripts in $(datadir) because the SEARCH_DIR
47 # directives need to be different for native and cross linkers.
48 scriptdir = $(tooldir)/lib
50 gcclibdir = $(libdir)/gcc/$(target_alias)
54 INSTALL = `cd $(srcdir); pwd`/../install.sh -c
55 INSTALL_PROGRAM = $(INSTALL)
56 INSTALL_DATA = $(INSTALL)
57 INSTALL_XFORM = $(INSTALL) -t='$(program_transform_name)'
58 INSTALL_XFORM1 = $(INSTALL_XFORM) -b=.1
67 BISON = `if [ -f ../bison/bison ] ; then echo ../bison/bison -y -L../bison/bison ; else echo bison -y ; fi`
68 LEX = `if [ -f ../flex/flex ] ; then echo ../flex/flex ; else echo flex ; fi`
70 #version=/`./../gcc/gcc -dumpversion`
73 # Seach path to override the default search path for -lfoo libraries.
74 # If LIB_PATH is empty, the ones in the script (if any) are left alone.
75 # (The default is usually /lib:usr/lib:/usr/local/lib, unless building
76 # a cross-linker, in which case the default is empty. See genscripts.sh.)
77 # Otherwise, they are replaced with the ones given in LIB_PATH,
78 # which may have the form: LIB_PATH=/lib:/usr/local/lib
81 # Additional libraries which are used when ld is built native. This
82 # is set by some host makefile fragments.
85 BASEDIR = $(srcdir)/..
86 BFDDIR = $(BASEDIR)/bfd
87 INCDIR = $(BASEDIR)/include
88 INCLUDES = -I. -I$(srcdir) -I../bfd -I$(BFDDIR) -I$(INCDIR)
90 # What version of the manual to build
93 # Where to find texinfo.tex to format docn with TeX
94 TEXIDIR = $(srcdir)/../texinfo
96 # Where to find other docs needed to format with TeX
97 TEXINPUTS = $(TEXIDIR):$(BFDDIR)/doc:$(srcdir)
99 # Whether to get roff to put indexing entries on stderr
101 # You neeed this to generate ld-index.ms (or .mm or .me)
106 # Which roff program to use to generate index for texi2roff'd doc
109 #stuff for self hosting (can be overridden in config file).
110 HOSTING_CRT0=/lib/crt0.o
111 HOSTING_LIBS=`if [ -f ../gcc/libgcc.a ] ; then echo ../gcc/libgcc.a ; else gcc -print-libgcc-file-name; fi` -lc
112 HOSTING_EMU=-m $(EMUL)
114 CXX = `if [ -f ../gcc/xgcc ] ; then \
115 echo ../gcc/xgcc -B../gcc/; \
118 CXXFLAGS = -fgnu-linker
120 # FIX_ME: using ../gcc/xgcc breaks the cdtest.
123 # Setup the testing framework, if you have one
126 RUNTEST_CC = `if [ -f ../gcc/xgcc ] ; then \
127 echo ../gcc/xgcc -B../gcc/; \
130 RUNTEST_CFLAGS = $(CFLAGS)
131 RUNTEST_CXX = `if [ -f ../gcc/xgcc ] ; then \
132 echo ../gcc/xgcc -B../gcc/; \
135 # FIX_ME: using ../gcc/xgcc breaks the cdtest.
137 RUNTEST_CXXFLAGS = $(CXXFLAGS)
141 ### Host, target, and site specific Makefile fragments come in here.
144 LINTFLAGS = $(INCLUDES) $(EXTRA_DEF)
146 # The .cc suffix is used by `make check'.
148 .SUFFIXES: .y $(SUFFIXES) .cc
150 # Suppress smart makes who think they know how to automake Yacc files
154 $(CXX) -c -I$(srcdir) $(CXXFLAGS) $(CFLAGS) $<
157 $(CC) -c $(INCLUDES) $(HDEFINES) $(TDEFINES) $(CDEFINES) $(CFLAGS) $<
159 # go directly to ld.new in case this ld isn't capable of
160 # linking native object on this host. It can be renamed on
165 BFDLIB = ../bfd/libbfd.a
166 LIBIBERTY = ../libiberty/libiberty.a
168 ALL_EMULATIONS=em_lnk960.o em_sun3.o em_i386aout.o em_go32.o \
169 em_m88kbcs.o em_a29k.o em_news.o em_hp300bsd.o em_hp3hpux.o \
170 em_h8300.o em_h8300h.o em_ebmon29k.o em_sun4.o em_gld960.o \
171 em_m68kcoff.o em_st2000.o em_sa29200.o em_i386mach.o \
172 em_vanilla.o em_i386coff.o em_z8ksim.o em_mipslit.o em_i386bsd.o \
173 em_mipsbig.o em_mipsbsd.o em_mipsidt.o em_vax.o em_h8500.o \
174 em_hppaosf.o em_mipsidtl.o em_sh.o em_elf_i386.o em_alpha.o \
175 em_i386lynx.o em_m68klynx.o em_sparclynx.o \
178 # This is now set by configure.in.
179 #EMULATION_OFILES=${ALL_EMULATIONS}
181 OFILES= ldgram.o ldlex.o lexsup.o ldlang.o mri.o ldctor.o ldmain.o ldindr.o \
182 ldwarn.o ldwrite.o ldexp.o ldemul.o ldver.o ldmisc.o ldsym.o \
183 ldfile.o relax.o lderror.o ${EMULATION_OFILES}
185 HEADERS=config.h ldmain.h ldmain.h ldwarn.h ldmisc.h ldindr.h \
186 ldsym.h ldctor.h ldlang.h ldexp.h \
187 ldlex.h ldwrite.h ldver.h ldemul.h ldfile.h ldgram.h ld.h
191 LDCSOURCES=ldlang.c lexsup.c ldctor.c mri.c ldindr.c ldmain.c ldwrite.c ldwarn.c ldlnk960.c \
192 em_gld.c em_sun3.c em_go32.c em_m88k.c em_ebmon29k.c em_hppaosf.c \
193 ldgld960.c ldemul.c ldver.c ldmisc.c ldexp.c ldsym.c ldfile.c \
196 GENERATED_SOURCES=ldgram.c ldlex.c em_*.c ldemul-list.h
197 GENERATED_HEADERS=ldgram.h ldemul-list.h
199 LDSOURCES=$(LDCSOURCES) ldgram.y ldlex.l ldgram.h
201 BFDSOURCES=../../bfd/common/*.c
203 SOURCES= $(LDSOURCES) $(BFDSOURCES)
204 LINTSOURCES= $(LDCSOURCES) $(BFDSOURCES) $(GENERATED_SOURCES)
206 STAGESTUFF = *.o ldscripts/* $(GENERATED_SOURCES) $(GENERATED_HEADERS)
212 ldgram.h ldgram.c: ldgram.y
213 $(BISON) $(BISONFLAGS) -d $(srcdir)/ldgram.y
214 mv -f y.tab.c ldgram.c
215 mv -f y.tab.h ldgram.h
217 # EMUL is the name of a file in the emulparams subdir, without the .sh.
218 DEF_EMUL = ` if [ -z "$(EMUL)" ] ; then \
219 echo "you must set a default emulation" 1>&2 ; \
222 echo -DDEFAULT_EMULATION='"$(EMUL)"' ; \
225 ldmain.o: ldmain.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \
226 $(INCDIR)/obstack.h ../bfd/sysdep.h $(BFDDIR)/hosts/std-host.h \
227 $(INCDIR)/fopen-same.h config.h ld.h \
228 ldmain.h ldmisc.h ldwrite.h ./ldgram.h \
229 ldsym.h ldlang.h ldemul.h ldlex.h \
230 ldfile.h ldindr.h ldwarn.h ldctor.h \
232 $(CC) -c $(INCLUDES) $(HDEFINES) $(TDEFINES) $(CDEFINES) $(DEF_EMUL) -DSCRIPTDIR='"$(scriptdir)"' $(CFLAGS) $<
234 ldemul-list.h: Makefile
235 (echo "/* This file is automatically generated. DO NOT EDIT! */";\
236 for f in `echo " " ${EMULATION_OFILES} "" \
237 | sed -e 's/em_/ld/g' -e 's/ ld/ /g' -e 's/[.]o//g'`; do \
238 echo "extern ld_emulation_xfer_type ld_$${f}_emulation;"; \
241 echo "#define EMULATION_LIST \\";\
242 for f in `echo " " ${EMULATION_OFILES} "" \
243 | sed -e 's/em_/ld/g' -e 's/ ld/ /g' -e 's/[.]o//g'`; do \
244 echo " &ld_$${f}_emulation, \\"; \
246 echo " 0") >ldemul-list.h
248 ldlex.c: ldlex.l ldgram.h
249 $(LEX) -I -Cem $(srcdir)/ldlex.l
252 # These all start with em_ so 'make clean' can find them.
254 GENSCRIPTS=$(SHELL) $(srcdir)/genscripts.sh ${srcdir} ${libdir} ${host_alias} ${target_alias} ${EMUL} "$(NATIVE_LIB_DIRS)"
255 GEN_DEPENDS=$(srcdir)/genscripts.sh
257 em_sun4.c: $(srcdir)/emulparams/sun4.sh \
258 $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/aout.sc ${GEN_DEPENDS}
260 em_sun3.c: $(srcdir)/emulparams/sun3.sh \
261 $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/aout.sc ${GEN_DEPENDS}
263 em_go32.c: $(srcdir)/emulparams/go32.sh \
264 $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/aout.sc ${GEN_DEPENDS}
266 em_news.c: $(srcdir)/emulparams/news.sh \
267 $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/aout.sc ${GEN_DEPENDS}
269 em_vax.c: $(srcdir)/emulparams/vax.sh \
270 $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/aout.sc ${GEN_DEPENDS}
272 em_hp300bsd.c: $(srcdir)/emulparams/hp300bsd.sh \
273 $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/aout.sc ${GEN_DEPENDS}
274 ${GENSCRIPTS} hp300bsd
275 em_hp3hpux.c: $(srcdir)/emulparams/hp3hpux.sh \
276 $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/aout.sc ${GEN_DEPENDS}
277 ${GENSCRIPTS} hp3hpux
278 em_hppaosf.c: $(srcdir)/emulparams/hppaosf.sh \
279 $(srcdir)/emultempl/hppaosf.em $(srcdir)/scripttempl/hppaosf.sc ${GEN_DEPENDS}
280 ${GENSCRIPTS} hppaosf
281 em_i386aout.c: $(srcdir)/emulparams/i386aout.sh \
282 $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/aout.sc ${GEN_DEPENDS}
283 ${GENSCRIPTS} i386aout
284 em_i386mach.c: $(srcdir)/emulparams/i386mach.sh \
285 $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/aout.sc ${GEN_DEPENDS}
286 ${GENSCRIPTS} i386mach
287 em_ebmon29k.c: $(srcdir)/emulparams/ebmon29k.sh \
288 $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/ebmon29k.sc ${GEN_DEPENDS}
289 ${GENSCRIPTS} ebmon29k
290 em_sa29200.c: $(srcdir)/emulparams/sa29200.sh \
291 $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/sa29200.sc ${GEN_DEPENDS}
292 ${GENSCRIPTS} sa29200
293 em_a29k.c: $(srcdir)/emulparams/a29k.sh \
294 $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/a29k.sc ${GEN_DEPENDS}
296 em_m88kbcs.c: $(srcdir)/emulparams/m88kbcs.sh \
297 $(srcdir)/emultempl/m88kbcs.em $(srcdir)/scripttempl/m88kbcs.sc ${GEN_DEPENDS}
298 ${GENSCRIPTS} m88kbcs
299 em_h8300.c: $(srcdir)/emulparams/h8300.sh \
300 $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/h8300.sc ${GEN_DEPENDS}
302 em_h8300h.c: $(srcdir)/emulparams/h8300h.sh \
303 $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/h8300h.sc ${GEN_DEPENDS}
305 em_h8500.c: $(srcdir)/emulparams/h8500.sh \
306 $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/h8500.sc ${GEN_DEPENDS}
308 em_sh.c: $(srcdir)/emulparams/sh.sh \
309 $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/sh.sc ${GEN_DEPENDS}
311 em_st2000.c: $(srcdir)/emulparams/st2000.sh \
312 $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/st2000.sc ${GEN_DEPENDS}
314 em_z8ksim.c: $(srcdir)/emulparams/z8ksim.sh \
315 $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/z8ksim.sc ${GEN_DEPENDS}
317 em_vanilla.c: $(srcdir)/emulparams/vanilla.sh \
318 $(srcdir)/emultempl/vanilla.em $(srcdir)/scripttempl/vanilla.sc ${GEN_DEPENDS}
319 ${GENSCRIPTS} vanilla
320 em_lnk960.c: $(srcdir)/emulparams/lnk960.sh \
321 $(srcdir)/emultempl/lnk960.em $(srcdir)/scripttempl/i960.sc ${GEN_DEPENDS}
323 em_gld960.c: $(srcdir)/emulparams/gld960.sh \
324 $(srcdir)/emultempl/gld960.em $(srcdir)/scripttempl/i960.sc ${GEN_DEPENDS}
326 em_m68kcoff.c: $(srcdir)/emulparams/m68kcoff.sh \
327 $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/m68kcoff.sc ${GEN_DEPENDS}
328 ${GENSCRIPTS} m68kcoff
329 em_m68klynx.c: $(srcdir)/emulparams/m68klynx.sh \
330 $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/m68kcoff.sc ${GEN_DEPENDS}
331 ${GENSCRIPTS} m68klynx
332 em_i386coff.c: $(srcdir)/emulparams/i386coff.sh \
333 $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/i386coff.sc ${GEN_DEPENDS}
334 ${GENSCRIPTS} i386coff
335 em_i386lynx.c: $(srcdir)/emulparams/i386lynx.sh \
336 $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/i386coff.sc ${GEN_DEPENDS}
337 ${GENSCRIPTS} i386lynx
338 em_sparclynx.c: $(srcdir)/emulparams/sparclynx.sh \
339 $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/sparccoff.sc ${GEN_DEPENDS}
340 ${GENSCRIPTS} sparclynx
341 em_mipslit.c: $(srcdir)/emulparams/mipslit.sh \
342 $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/mips.sc ${GEN_DEPENDS}
343 ${GENSCRIPTS} mipslit
344 em_i386bsd.c: $(srcdir)/emulparams/i386bsd.sh \
345 $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/aout.sc ${GEN_DEPENDS}
346 ${GENSCRIPTS} i386bsd
347 em_mipsbig.c: $(srcdir)/emulparams/mipsbig.sh \
348 $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/mips.sc ${GEN_DEPENDS}
349 ${GENSCRIPTS} mipsbig
350 em_mipsbsd.c: $(srcdir)/emulparams/mipsbsd.sh \
351 $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/aout.sc ${GEN_DEPENDS}
352 ${GENSCRIPTS} mipsbsd
353 em_mipsidt.c: $(srcdir)/emulparams/mipsidt.sh \
354 $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/mips.sc ${GEN_DEPENDS}
355 ${GENSCRIPTS} mipsidt
356 em_mipsidtl.c: $(srcdir)/emulparams/mipsidtl.sh \
357 $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/mips.sc ${GEN_DEPENDS}
358 ${GENSCRIPTS} mipsidtl
359 em_elf_i386.c: $(srcdir)/emulparams/elf_i386.sh \
360 $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS}
361 ${GENSCRIPTS} elf_i386
362 em_elf32mipb.c: $(srcdir)/emulparams/elf32mipb.sh \
363 $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS}
364 ${GENSCRIPTS} elf32mipb
365 em_alpha.c: $(srcdir)/emulparams/alpha.sh \
366 $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/alpha.sc ${GEN_DEPENDS}
369 $(LD_PROG): $(OFILES) $(BFDLIB) $(LIBIBERTY)
370 $(CC) $(INCLUDES) $(HDEFINES) $(TDEFINES) $(CDEFINES) $(CFLAGS) $(LDFLAGS) -o $(LD_PROG) $(OFILES) $(BFDLIB) $(LIBIBERTY) $(LOADLIBES)
372 # The generated emulation files mostly have the same dependencies.
373 $(EMULATION_OFILES): ../bfd/bfd.h ../bfd/sysdep.h ld.h ldemul.h \
374 ldfile.h ldmisc.h config.h
376 # This list of dependencies was generated by doing a make with gcc -MM
377 # saving the output in a file and removing the gcc commands
378 # changing "../../devo/ld/../bfd" to "$(BFDDIR)"
379 # removing "../../devo/ld/"
380 # changing "../include" to "$(INCDIR)"
382 ldgram.o: ldgram.c ../bfd/bfd.h $(INCDIR)/ansidecl.h $(INCDIR)/obstack.h \
383 ../bfd/sysdep.h $(BFDDIR)/hosts/std-host.h $(INCDIR)/fopen-same.h \
384 ld.h ldexp.h ldver.h ldlang.h \
385 ldemul.h ldfile.h ldmisc.h mri.h
386 ldlex.o: ldlex.c ../bfd/bfd.h $(INCDIR)/obstack.h ./ldgram.h
387 lexsup.o: lexsup.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \
388 $(INCDIR)/obstack.h ../bfd/sysdep.h $(BFDDIR)/hosts/std-host.h \
389 $(INCDIR)/fopen-same.h ldlex.h ld.h \
390 ldexp.h ./ldgram.h ldmisc.h
391 ldlang.o: ldlang.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \
392 $(INCDIR)/obstack.h ../bfd/sysdep.h $(BFDDIR)/hosts/std-host.h \
393 $(INCDIR)/fopen-same.h ld.h ldmain.h \
394 ldsym.h ./ldgram.h ldwarn.h ldlang.h \
395 ldexp.h ldemul.h ldlex.h ldmisc.h \
397 mri.o: mri.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \
398 $(INCDIR)/obstack.h ../bfd/sysdep.h $(BFDDIR)/hosts/std-host.h \
399 $(INCDIR)/fopen-same.h ld.h ldlang.h \
400 mri.h ./ldgram.h ldexp.h
401 ldctor.o: ldctor.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \
402 $(INCDIR)/obstack.h ../bfd/sysdep.h $(BFDDIR)/hosts/std-host.h \
403 $(INCDIR)/fopen-same.h ld.h ldlang.h \
404 ldsym.h ldmisc.h ldexp.h ./ldgram.h
405 ldmain.o: ldmain.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \
406 $(INCDIR)/obstack.h ../bfd/sysdep.h $(BFDDIR)/hosts/std-host.h \
407 $(INCDIR)/fopen-same.h config.h ld.h \
408 ldmain.h ldmisc.h ldwrite.h ./ldgram.h \
409 ldsym.h ldlang.h ldemul.h ldlex.h \
410 ldfile.h ldindr.h ldwarn.h ldctor.h \
412 ldindr.o: ldindr.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \
413 $(INCDIR)/obstack.h ../bfd/sysdep.h $(BFDDIR)/hosts/std-host.h \
414 $(INCDIR)/fopen-same.h ld.h ldsym.h \
416 ldwarn.o: ldwarn.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \
417 $(INCDIR)/obstack.h ../bfd/sysdep.h $(BFDDIR)/hosts/std-host.h \
418 $(INCDIR)/fopen-same.h ldsym.h ldwarn.h \
420 ldwrite.o: ldwrite.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \
421 $(INCDIR)/obstack.h ../bfd/sysdep.h $(BFDDIR)/hosts/std-host.h \
422 $(INCDIR)/fopen-same.h ldlang.h ld.h \
423 ldwrite.h ldmisc.h ldsym.h ./ldgram.h \
425 ldexp.o: ldexp.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \
426 $(INCDIR)/obstack.h ../bfd/sysdep.h $(BFDDIR)/hosts/std-host.h \
427 $(INCDIR)/fopen-same.h ld.h ldmain.h \
428 ldmisc.h ldexp.h ./ldgram.h ldsym.h \
430 ldemul.o: ldemul.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \
431 $(INCDIR)/obstack.h ../bfd/sysdep.h $(BFDDIR)/hosts/std-host.h \
432 $(INCDIR)/fopen-same.h config.h ld.h \
433 ldemul.h ldmisc.h ./ldemul-list.h
434 ldver.o: ldver.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \
435 $(INCDIR)/obstack.h ../bfd/sysdep.h $(BFDDIR)/hosts/std-host.h \
436 $(INCDIR)/fopen-same.h ldver.h ldemul.h
437 ldmisc.o: ldmisc.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \
438 $(INCDIR)/obstack.h ../bfd/sysdep.h $(BFDDIR)/hosts/std-host.h \
439 $(INCDIR)/fopen-same.h ld.h ldmisc.h \
441 ldsym.o: ldsym.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \
442 $(INCDIR)/obstack.h ../bfd/sysdep.h $(BFDDIR)/hosts/std-host.h \
443 $(INCDIR)/fopen-same.h ld.h ldsym.h \
445 ldfile.o: ldfile.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \
446 $(INCDIR)/obstack.h ../bfd/sysdep.h $(BFDDIR)/hosts/std-host.h \
447 $(INCDIR)/fopen-same.h ldmisc.h ldlang.h \
449 relax.o: relax.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \
450 $(INCDIR)/obstack.h $(BFDDIR)/seclet.h $(INCDIR)/coff/internal.h \
451 ../bfd/sysdep.h $(BFDDIR)/hosts/std-host.h $(INCDIR)/fopen-same.h \
452 ldlang.h ld.h ldwrite.h ldmisc.h \
453 ldsym.h ./ldgram.h relax.h
454 lderror.o: lderror.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \
455 $(INCDIR)/obstack.h ../bfd/sysdep.h $(BFDDIR)/hosts/std-host.h \
456 $(INCDIR)/fopen-same.h $(BFDDIR)/seclet.h ld.h \
459 # CYGNUS LOCAL targets.
460 # These targets are for the dejagnu testsuites. The file site.exp
461 # contains global variables that all the testsuites will use.
462 # There is a current debate as to how and where to generate test
463 # outputs. Rob feels each test should be built in $(objdir) with
464 # a unique name. Cassidy feels that we should create a directory
465 # called $(objdir)/tmpdir and do the work there. This way, there
466 # is no potential conflict with existing objects, ie: as there
467 # was in the past with loop.o and flow.o, and, there is no chance
468 # of filling /tmp, which would cause other problems. Lastly, this
469 # allow retention of the testcase name making debugging easier.
471 testdir = $(objdir)/tmpdir
473 site.exp: ./config.status Makefile
474 @if [ -d $(testdir) ]; then true; else mkdir $(testdir); fi
475 @echo "Making a new config file..."
478 @mv site.exp site.bak
479 @echo "## variables are automatically generated by make ##" > ./tmp0
480 @echo "# Do not edit here. If you wish to override these" >> ./tmp0
481 @echo "# values, add them to the last section" >> ./tmp0
482 @echo "# HOST AND TARGET INFO" >> ./tmp0
483 @echo "set host_os $(host_os)" >> ./tmp0
484 @echo "set host_alias $(host_alias)" >> ./tmp0
485 @echo "set host_cpu $(host_cpu)" >> ./tmp0
486 @echo "set host_vendor $(host_vendor)" >> ./tmp0
487 @echo "set target_os $(target_os)" >> ./tmp0
488 @echo "set target_alias $(target_alias)" >> ./tmp0
489 @echo "set target_cpu $(target_cpu)" >> ./tmp0
490 @echo "set target_vendor $(target_vendor)" >> ./tmp0
491 @echo "set host_triplet $(host_canonical)" >> ./tmp0
492 @echo "set target_triplet $(target_canonical)" >> ./tmp0
493 @echo "# DIRECTORY INFO" >> ./tmp0
494 @echo "set objdir `pwd`" >> ./tmp0
495 @echo "set tmpdir `cd $(testdir); pwd`" >> ./tmp0
497 @echo "# LD DEPENDANCIES" >> ./tmp0
498 @echo "set OFILES \"$(OFILES)\"" >> ./tmp0
499 @echo "set BFDLIB \"$(BFDLIB)\"" >> ./tmp0
500 @echo "set LIBIBERTY \"$(LIBIBERTY)\"" >> ./tmp0
501 @echo "set HOSTING_EMU \"$(HOSTING_EMU)\"" >> ./tmp0
502 @echo "set HOSTING_CRT0 \"$(HOSTING_CRT0)\"" >> ./tmp0
503 @echo "set HOSTING_LIBS \"$(HOSTING_LIBS)\"" >> ./tmp0
505 @echo "## Variables generated by configure. Do Not Edit ##" >> ./tmp0
506 @cat ./tmp0 > site.exp
507 @cat site.bak | sed \
508 -e '1,/^## Variables generated by.*##/ d' >> site.exp
511 check: ld.new site.exp
512 $(RUNTEST) --tool ld \
513 --srcdir $(srcdir)/testsuite $(RUNTEST_FLAGS) \
514 CC="$(RUNTEST_CC)" CFLAGS="$(RUNTEST_CFLAGS)" \
515 CXX="$(RUNTEST_CXX)" CXXFLAGS="$(RUNTEST_CXXFLAGS)"
519 # Rules for testing by relinking ld itself.
522 ./ld.new $(HOSTING_EMU) -o ld-partial.o -r $(OFILES)
524 ./ld.new $(HOSTING_EMU) -o ld1 $(HOSTING_CRT0) ld-partial.o $(BFDLIB) $(LIBIBERTY) $(HOSTING_LIBS)
527 ./ld.new $(HOSTING_EMU) -o ld1-full $(HOSTING_CRT0) $(OFILES) $(BFDLIB) $(LIBIBERTY) $(HOSTING_LIBS)
530 ./ld1 $(HOSTING_EMU) -o ld2 $(HOSTING_CRT0) $(OFILES) $(BFDLIB) $(LIBIBERTY) $(HOSTING_LIBS)
533 ./ld2 $(HOSTING_EMU) -o ld3 $(HOSTING_CRT0) $(OFILES) $(BFDLIB) $(LIBIBERTY) $(HOSTING_LIBS)
538 # A test program for C++ constructors and destructors.
540 cdtest: cdtest-main.o cdtest-func.o cdtest-foo.o ld.new
541 ./ld.new $(HOSTING_EMU) -o cdtest $(HOSTING_CRT0) \
542 cdtest-main.o cdtest-func.o cdtest-foo.o $(HOSTING_LIBS)
544 check-cdtest: cdtest $(srcdir)/cdtest.exp
546 diff $(srcdir)/cdtest.exp cdtest.out
547 # END OF CHECK TARGETS
549 # DOCUMENTATION TARGETS
550 # Manual configuration file; not usually attached to normal configuration,
551 # because almost all configs use "gen" version of manual.
552 # Set DOCVER above to change.
553 configdoc.texi: ${DOCVER}-doc.texi
554 ln -s ${srcdir}/${DOCVER}-doc.texi ./configdoc.texi || \
555 ln ${srcdir}/${DOCVER}-doc.texi ./configdoc.texi || \
556 cp ${srcdir}/${DOCVER}-doc.texi ./configdoc.texi
560 ld.dvi: $(srcdir)/ld.texinfo $(srcdir)/configdoc.texi $(BFDDIR)/doc/bfdsumm.texi
561 $(TEXI2DVI) -I$(BFDDIR)/doc $(srcdir)/ld.texinfo
563 ldint.dvi: $(srcdir)/ldint.texinfo
564 $(TEXI2DVI) $(srcdir)/ldint.texinfo
566 # info file for online browsing
567 ld.info: $(srcdir)/ld.texinfo configdoc.texi $(BFDDIR)/doc/bfdsumm.texi
568 $(MAKEINFO) -I$(BFDDIR)/doc -o ld.info $(srcdir)/ld.texinfo
570 ldint.info: $(srcdir)/ldint.texinfo
571 $(MAKEINFO) -o ldint.info $(srcdir)/ldint.texinfo
573 #separate targets for "ms", "me", and "mm" forms of roff doc
574 # Try to use a recent texi2roff. v2 was put on prep in jan91.
575 # If you want an index, see texi2roff doc for postprocessing
576 # and add -i to texi2roff invocations below.
577 # Workarounds for texi2roff-2 (probably fixed in later texi2roff's, delete
578 # correspondint -e lines when later texi2roff's are current)
579 # + @ifinfo's deleted explicitly due to texi2roff-2 bug w nested constructs.
580 # + @c's deleted explicitly because texi2roff sees texinfo commands in them
581 # + @ (that's at-BLANK) not recognized by texi2roff, turned into blank
582 # + @alphaenumerate is ridiculously new, turned into @enumerate
584 ld.ms: $(srcdir)/ld.texinfo
585 sed -e '/\\input texinfo/d' \
586 -e '/@c TEXI2ROFF-KILL/,/@c END TEXI2ROFF-KILL/d' \
587 -e '/^@ifinfo/,/^@end ifinfo/d' \
591 -e 's/^@alphaenumerate/@enumerate/g' \
592 -e 's/^@end alphaenumerate/@end enumerate/g' \
593 $(srcdir)/ld.texinfo | \
594 $(TEXI2ROFF) $(TEXI2OPT) -ms | \
595 sed -e 's/---/\\(em/g' \
598 # index for roff output
600 $(ROFF) -ms ld.ms 2>&1 1>/dev/null | \
601 sed -e '/: warning:/d' | \
602 texi2index >ld-index.ms
605 ld.mm: $(srcdir)/ld.texinfo
606 sed -e '/\\input texinfo/d' \
607 -e '/@c TEXI2ROFF-KILL/,/@c END TEXI2ROFF-KILL/d' \
608 -e '/^@ifinfo/,/^@end ifinfo/d' \
613 -e 's/^@alphaenumerate/@enumerate/g' \
614 -e 's/^@end alphaenumerate/@end enumerate/g' \
615 $(srcdir)/ld.texinfo | \
616 $(TEXI2ROFF) $(TEXI2OPT) -mm | \
617 sed -e 's/---/\\(em/g' \
620 # index for roff output
622 $(ROFF) -mm ld.mm 2>&1 1>/dev/null | \
623 sed -e '/: warning:/d' | \
624 texi2index >ld-index.mm
627 ld.me: $(srcdir)/ld.texinfo
628 sed -e '/\\input texinfo/d' \
629 -e '/@c TEXI2ROFF-KILL/,/@c END TEXI2ROFF-KILL/d' \
630 -e '/^@ifinfo/,/^@end ifinfo/d' \
634 -e 's/^@alphaenumerate/@enumerate/g' \
635 -e 's/^@end alphaenumerate/@end enumerate/g' \
636 $(srcdir)/ld.texinfo | \
637 $(TEXI2ROFF) $(TEXI2OPT) -me | \
638 sed -e 's/---/\\(em/g' \
641 # index for roff output
643 $(ROFF) -me ld.me 2>&1 1>/dev/null | \
644 sed -e '/: warning:/d' | \
645 texi2index >ld-index.me
649 -mv -f $(STAGESTUFF) $(LD_PROG) stage1
650 -(cd stage1 ; ln -s $(LD_PROG) ld)
654 -mv -f $(STAGESTUFF) $(LD_PROG) stage2
655 -(cd stage2 ; ln -s $(LD_PROG) ld)
659 -mv -f $(STAGESTUFF) $(LD_PROG) stage3
660 -(cd stage3 ; ln -s $(LD_PROG) ld)
665 for i in $(STAGESTUFF) $(LD_PROG) ; do cmp $$i $(against)/$$i ; done
668 -(cd stage1 ; mv -f * ..)
673 -(cd stage2 ; mv -f * ..)
678 -(cd stage3 ; mv -f * ..)
682 # Stuff that should be included in a distribution:
683 LDDISTSTUFF=ldgram.c ldgram.h ldlex.c
684 diststuff: $(LDDISTSTUFF)
687 -rm -f $(STAGESTUFF) ld.?? ld.??? ldlex.[qp]
688 -rm -f ld ld1 ld2 ld3 *.o y.output cdtest cdtest.out
692 -rm -fr Makefile config.status TAGS sysdep.h ldscripts site.exp \
693 $(STAGESTUFF) ld.?? ld.??s ld.toc ld.aux ld.log ldlex.[qp] \
694 $(LD_PROG) ld ld1 ld2 ld3 *.o y.output cdtest cdtest.out
695 realclean: clean distclean
696 -rm -f $(LDDISTSTUFF)
698 lintlog:$(SOURCES) Makefile
699 $(LINT) -abhxzn $(LINTFLAGS) $(LINTSOURCES) \
700 | grep -v "pointer casts may be troublesome" \
701 | grep -v "possible pointer alignment problem" \
703 | grep -v "conversion from long may lose accuracy" \
704 | grep -v "warning: constant argument to NOT" \
705 | grep -v "enumeration type clash, operator CAST" \
706 | grep -v "warning: constant in conditional context"\
707 | grep -v "archive\.c"
711 etags -t $(srcdir)/*.[chly] *.[chly]
716 $(INSTALL_XFORM) ld.new $(bindir)/ld
717 $(INSTALL_XFORM1) $(srcdir)/ld.1 $(man1dir)/ld.1
718 for f in ldscripts/*; do \
719 $(INSTALL_DATA) $$f $(scriptdir)/$$f ; \
721 -n=`t='$(program_transform_name)'; echo ld | sed -e "" $$t`; \
722 rm -f $(tooldir)/bin/ld; \
723 ln $(bindir)/$$n $(tooldir)/bin/ld \
724 || $(INSTALL_PROGRAM) ld.new $(tooldir)/bin/ld
727 for i in ld.info* ; do \
728 $(INSTALL_DATA) $$i $(infodir)/$$i ; \
734 #-----------------------------------------------------------------------------
735 # 'STANDARD' GNU/960 TARGETS BELOW THIS POINT
737 # 'VERSION' file must be present and contain a string of the form "x.y"
738 #-----------------------------------------------------------------------------
742 echo "char ${TARG}_ver[]= \"${TARG} `cat VERSION`, `date`\";" > ver960.c
745 # This target should be invoked before building a new release.
746 # 'VERSION' file must be present and contain a string of the form "x.y"
750 MAJ=`sed 's/\..*//' VERSION` ; \
751 MIN=`sed 's/.*\.//' VERSION` ; \
752 V=$$MAJ.`expr $$MIN + 1` ; \
754 echo $$V >VERSION ; \
761 # Dummy target to force execution of dependent targets.
765 # Target to uncomment host-specific lines in this makefile. Such lines must
766 # have the following string beginning in column 1: #__<hostname>__#
767 # Original Makefile is backed up as 'Makefile.old'.
769 # Invoke with: make make HOST=xxx
772 -@if test $(HOST)x = x ; then \
773 echo '
\aSpecify "make make HOST=???"'; \
776 grep -s "^#The next line was generated by 'make make'" Makefile; \
777 if test $$? = 0 ; then \
778 echo "
\aMakefile has already been processed with 'make make'";\
781 mv -f Makefile Makefile.old; \
782 echo "#The next line was generated by 'make make'" >Makefile ; \
783 echo "HOST=$(HOST)" >>Makefile ; \
785 sed "s/^#__$(HOST)__#//" < Makefile.old >>Makefile
789 Makefile: $(srcdir)/Makefile.in $(host_makefile_frag) $(target_makefile_frag)
790 $(SHELL) ./config.status
792 ### mode:fundamental ***
793 ### Local Variables: ***
794 ### page-delimiter: "^#
\f" ***
799 # IF YOU PUT ANYTHING HERE IT WILL GO AWAY