No longer sanitize away h8s stuff.
[platform/upstream/binutils.git] / ld / Makefile.in
1 # Makefile for the GNU linker ld (version 2)
2 # Copyright (C) 1989, 90, 91, 92, 93, 94, 95, 1996
3 # Free Software Foundation, Inc.
4
5 # This file is part of GNU ld.
6
7 # This program is free software; you can redistribute it and/or modify
8 # it under the terms of the GNU General Public License as published by
9 # the Free Software Foundation; either version 2 of the License, or
10 # (at your option) any later version.
11
12 # This program is distributed in the hope that it will be useful,
13 # but WITHOUT ANY WARRANTY; without even the implied warranty of
14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15 # GNU General Public License for more details.
16
17 # You should have received a copy of the GNU General Public License
18 # along with this program; if not, write to the Free Software
19 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
20
21
22 VPATH = @srcdir@
23 srcdir = @srcdir@
24 objdir = .
25
26 target_alias = @target_alias@
27 prefix = @prefix@
28
29 program_transform_name = @program_transform_name@
30 exec_prefix = @exec_prefix@
31 bindir = @bindir@
32 libdir = @libdir@
33 tooldir = $(exec_prefix)/$(target_alias)
34 datadir = @datadir@
35 mandir = @mandir@
36 man1dir = $(mandir)/man1
37 man2dir = $(mandir)/man2
38 man3dir = $(mandir)/man3
39 man4dir = $(mandir)/man4
40 man5dir = $(mandir)/man5
41 man6dir = $(mandir)/man6
42 man7dir = $(mandir)/man7
43 man8dir = $(mandir)/man8
44 man9dir = $(mandir)/man9
45 infodir = @infodir@
46 includedir = @includedir@
47
48 # We put the scripts in the directory $(scriptdir)/ldscripts.
49 # We can't put the scripts in $(datadir) because the SEARCH_DIR
50 # directives need to be different for native and cross linkers.
51 scriptdir = $(tooldir)/lib
52
53 SHELL = /bin/sh
54
55 INSTALL = `cd $(srcdir); pwd`/../install.sh -c
56 INSTALL_PROGRAM = @INSTALL_PROGRAM@
57 INSTALL_DATA = @INSTALL_DATA@
58 INSTALL_XFORM = $(INSTALL) -t='$(program_transform_name)'
59 INSTALL_XFORM1 = $(INSTALL_XFORM) -b=.1
60
61 AR = ar
62 AR_FLAGS = qv
63 CC = @CC@
64 CFLAGS = @CFLAGS@
65 LDFLAGS = @LDFLAGS@
66 HLDFLAGS = @HLDFLAGS@
67 RPATH_ENVVAR = @RPATH_ENVVAR@
68 MAKEINFO = makeinfo
69 TEXI2DVI = texi2dvi
70 RANLIB = ranlib
71 BISON = `if [ -f ../bison/bison ] ; then echo ../bison/bison -y -L../bison/bison ; else echo bison -y ; fi`
72 LEX = `if [ -f ../flex/flex ] ; then echo ../flex/flex ;  else echo flex ; fi`
73
74 EMUL = @EMUL@
75 EMULATION_OFILES = @EMULATION_OFILES@
76
77 # Search path to override the default search path for -lfoo libraries.
78 # If LIB_PATH is empty, the ones in the script (if any) are left alone.
79 # (The default is usually /lib:/usr/lib:/usr/local/lib, unless building
80 # a cross-linker, in which case the default is empty.  See genscripts.sh.)
81 # Otherwise, they are replaced with the ones given in LIB_PATH,
82 # which may have the form: LIB_PATH=/lib:/usr/local/lib
83 LIB_PATH =
84
85 BASEDIR = $(srcdir)/..
86 BFDDIR = $(BASEDIR)/bfd
87 INCDIR  = $(BASEDIR)/include
88 INCLUDES = -I. -I$(srcdir) -I../bfd -I$(BFDDIR) -I$(INCDIR)
89 DEP = mkdep
90
91 # What version of the manual to build
92 DOCVER = gen
93
94 # Where to find texinfo.tex to format docn with TeX
95 TEXIDIR = $(srcdir)/../texinfo
96
97 # Where to find other docs needed to format with TeX
98 TEXINPUTS = $(TEXIDIR):$(BFDDIR)/doc:$(srcdir)
99
100 # Whether to get roff to put indexing entries on stderr
101 TEXI2OPT =
102 # You neeed this to generate ld-index.ms (or .mm or .me)
103 # TEXI2OPT = -i
104
105 TEXI2ROFF=texi2roff
106
107 # Which roff program to use to generate index for texi2roff'd doc
108 ROFF = groff
109
110 #stuff for self hosting (can be overridden in config file).
111 HOSTING_CRT0 = @HOSTING_CRT0@
112 HOSTING_LIBS = @HOSTING_LIBS@
113 HOSTING_EMU = -m $(EMUL)
114
115 # These were used by `make check-cdtest'
116 #
117 #CXX = `if [ -f ../gcc/xgcc ] ; then \
118 #               echo ../gcc/xgcc -B../gcc/; \
119 #           else echo gcc; \
120 #           fi`
121 #CXXFLAGS = -fgnu-linker
122 #
123 # FIX_ME: using ../gcc/xgcc breaks the cdtest. 
124 #CXX = g++
125
126 # Setup the testing framework, if you have one
127 EXPECT = `if [ -f $$r/../expect/expect ] ; \
128         then echo $$r/../expect/expect ; \
129         else echo expect ; fi`
130
131 RUNTEST = `if [ -f $${srcroot}/../dejagnu/runtest ] ; \
132         then echo $${srcroot}/../dejagnu/runtest ; \
133         else echo runtest ; fi`
134
135 RUNTESTFLAGS =
136
137 CC_FOR_TARGET = ` \
138   if [ -f $$r/../gcc/xgcc ] ; then \
139     if [ -f $$r/../newlib/Makefile ] ; then \
140       echo $$r/../gcc/xgcc -B$$r/../gcc/ -idirafter $$r/../newlib/targ-include -idirafter $${srcroot}/../newlib/libc/include -nostdinc; \
141     else \
142       echo $$r/../gcc/xgcc -B$$r/../gcc/; \
143     fi; \
144   else \
145     if [ "@host@" = "@target@" ] ; then \
146       echo $(CC); \
147     else \
148       echo gcc | sed '$(program_transform_name)'; \
149     fi; \
150   fi`
151
152 CXX = gcc
153 CXX_FOR_TARGET = ` \
154   if [ -f $$r/../gcc/xgcc ] ; then \
155     if [ -f $$r/../newlib/Makefile ] ; then \
156       echo $$r/../gcc/xgcc -B$$r/../gcc/ -idirafter $$r/../newlib/targ-include -idirafter $${srcroot}/../newlib/libc/include -nostdinc; \
157     else \
158       echo $$r/../gcc/xgcc -B$$r/../gcc/; \
159     fi; \
160   else \
161     if [ "@host@" = "@target@" ] ; then \
162       echo $(CXX); \
163     else \
164       echo gcc | sed '$(program_transform_name)'; \
165     fi; \
166   fi`
167
168 # go directly to ld.new in case this ld isn't capable of
169 # linking native object on this host.  It can be renamed on
170 # install.
171 LD_PROG = ld.new
172
173 all: $(LD_PROG)
174 .PHONY: all
175
176 LINTFLAGS = $(INCLUDES) $(EXTRA_DEF) 
177
178 # The .cc suffix was used by `make check-cdtest'.
179
180 .SUFFIXES: .y $(SUFFIXES) .cc
181
182 # Suppress smart makes who think they know how to automake Yacc files
183 .y.c:
184
185 # This rule was used for the check-cdtest target.
186 #.cc.o:
187 #       $(CXX) -c -I$(srcdir) $(CXXFLAGS) $(CFLAGS) $<
188
189 ALL_CFLAGS = $(INCLUDES) @HDEFINES@ $(CFLAGS)
190 .c.o:
191         $(CC) -c $(ALL_CFLAGS) $<
192
193 BFDDEP = ../bfd/libbfd.a
194 BFDLIB = @BFDLIB@
195 LIBIBERTY = ../libiberty/libiberty.a
196
197 ALL_EMULATIONS = \
198         ea29k.o \
199         eaixppc.o \
200         eaixrs6.o \
201         ealpha.o \
202         earmaoutb.o \
203         earmaoutl.o \
204         earmcoff.o \
205         earmpe.o \
206         ecoff_sparc.o \
207         edelta68.o \
208         eebmon29k.o \
209         eelf32_sparc.o \
210         eelf32b4300.o \
211         eelf32bmip.o \
212         eelf32l4300.o \
213         eelf32lmip.o \
214         eelf32lppc.o \
215         eelf32ppc.o \
216         eelf64alpha.o \
217         eelf64_sparc.o \
218         eelf_i386.o \
219         egld960.o \
220         egld960coff.o \
221         ego32.o \
222         eh8300.o \
223         eh8300h.o \
224         eh8300s.o \
225         eh8500.o \
226         eh8500b.o \
227         eh8500c.o \
228         eh8500m.o \
229         eh8500s.o \
230         ehp300bsd.o \
231         ehp3hpux.o \
232         ehppaelf.o \
233         ei386aout.o \
234         ei386bsd.o \
235         ei386coff.o \
236         ei386go32.o \
237         ei386linux.o \
238         ei386lynx.o \
239         ei386mach.o \
240         ei386moss.o \
241         ei386msdos.o \
242         ei386nbsd.o \
243         ei386nw.o \
244         ei386pe.o \
245         elnk960.o \
246         em68k4knbsd.o \
247         em68kaout.o \
248         em68kaux.o \
249         em68kcoff.o \
250         em68kelf.o \
251         em68klinux.o \
252         em68klynx.o \
253         em68knbsd.o \
254         em68kpsos.o \
255         em88kbcs.o \
256         emipsbig.o \
257         emipsbsd.o \
258         emipsidt.o \
259         emipsidtl.o \
260         emipslit.o \
261         enews.o \
262         ens32knbsd.o \
263         epc532macha.o \
264         eppcmacos.o \
265         eppcnw.o \
266         eppcpe.o \
267         eriscix.o \
268         esa29200.o \
269         esh.o \
270         eshl.o \
271         esparcaout.o \
272         esparclynx.o \
273         esparcnbsd.o \
274         est2000.o \
275         esun3.o \
276         esun4.o \
277         evanilla.o \
278         evax.o \
279         evsta.o \
280         ew65.o \
281         ez8001.o \
282         ez8002.o
283
284 CFILES = ldctor.c ldemul.c ldexp.c ldfile.c ldlang.c \
285         ldmain.c ldmisc.c ldver.c ldwrite.c lexsup.c \
286         mri.c ldcref.c
287
288 HFILES = config.h ld.h ldctor.h ldemul.h ldexp.h ldfile.h \
289         ldlang.h ldlex.h ldmain.h ldmisc.h ldver.h \
290         ldwrite.h mri.h
291
292 GENERATED_CFILES = ldgram.c ldlex.c
293 GENERATED_HFILES = ldgram.h ldemul-list.h
294
295 OFILES = ldgram.o ldlex.o lexsup.o ldlang.o mri.o ldctor.o ldmain.o \
296         ldwrite.o ldexp.o  ldemul.o ldver.o ldmisc.o \
297         ldfile.o ldcref.o ${EMULATION_OFILES}
298
299 LINTSOURCES = $(CFILES) $(GENERATED_CFILES) e*.c
300
301 STAGESTUFF = *.o ldscripts/* e*.c
302
303 info: ld.info
304 .PHONY: info
305
306 ldgram.c: ldgram.y
307         $(BISON) $(BISONFLAGS) -d $(srcdir)/ldgram.y
308         mv -f y.tab.c ldgram.c
309         mv -f y.tab.h ldgram.h
310
311 # Separate from ldgram.c so that a parallel make doesn't try to build
312 # both ldgram.c and ldgram.h simultaneously.
313 ldgram.h: ldgram.c
314
315 ldmain.o: ldmain.c config.status
316         $(CC) -c -DDEFAULT_EMULATION='"$(EMUL)"' -DSCRIPTDIR='"$(scriptdir)"' $(ALL_CFLAGS) $<
317
318 ldemul-list.h: Makefile
319         (echo "/* This file is automatically generated.  DO NOT EDIT! */";\
320         for f in `echo " " ${EMULATION_OFILES} "" \
321          | sed -e 's/ e/ ld/g' -e 's/ ld/ /g' -e 's/[.]o//g'`; do \
322             echo "extern ld_emulation_xfer_type ld_$${f}_emulation;"; \
323         done;\
324         echo "";\
325         echo "#define EMULATION_LIST \\";\
326         for f in `echo " " ${EMULATION_OFILES} "" \
327          | sed -e 's/ e/ ld/g' -e 's/ ld/ /g' -e 's/[.]o//g'`; do \
328             echo "  &ld_$${f}_emulation, \\"; \
329         done;\
330         echo "  0") >ldemul-tmp.h
331         mv ldemul-tmp.h ldemul-list.h
332
333 ldlex.c: ldlex.l
334         $(LEX) -I -Cem $(srcdir)/ldlex.l
335         -sed -e '/^int.*free();/d' \
336              -e '/^char.*malloc();/d' \
337              -e 's/malloc/xmalloc/g' \
338           < lex.yy.c > ldlex.c.new
339         -rm lex.yy.c
340         mv ldlex.c.new ./ldlex.c
341
342 # These all start with e so 'make clean' can find them.
343
344 GENSCRIPTS = $(SHELL) $(srcdir)/genscripts.sh ${srcdir} ${libdir} @host@ @target@ @target_alias@ ${EMUL} "@NATIVE_LIB_DIRS@"
345 GEN_DEPENDS = $(srcdir)/genscripts.sh $(srcdir)/emultempl/stringify.sed
346 @TDIRS@
347
348 ea29k.c: $(srcdir)/emulparams/a29k.sh \
349   $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/a29k.sc ${GEN_DEPENDS}
350         ${GENSCRIPTS} a29k "$(tdir_a29k)"
351 eaixppc.c: $(srcdir)/emulparams/aixppc.sh \
352   $(srcdir)/emultempl/aix.em $(srcdir)/scripttempl/aix.sc ${GEN_DEPENDS}
353         ${GENSCRIPTS} aixppc "$(tdir_aixppc)"
354 eaixrs6.c: $(srcdir)/emulparams/aixrs6.sh \
355   $(srcdir)/emultempl/aix.em $(srcdir)/scripttempl/aix.sc ${GEN_DEPENDS}
356         ${GENSCRIPTS} aixrs6 "$(tdir_aixrs6)"
357 ealpha.c: $(srcdir)/emulparams/alpha.sh \
358   $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/alpha.sc ${GEN_DEPENDS}
359         ${GENSCRIPTS} alpha "$(tdir_alpha)"
360 # start-sanitize-arc
361 earcelf.c: $(srcdir)/emulparams/arcelf.sh \
362   $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS}
363         ${GENSCRIPTS} arcelf "$(tdir_arcelf)"
364 # end-sanitize-arc
365 earmaoutb.c:    $(srcdir)/emulparams/armaoutb.sh \
366   $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/armaout.sc ${GEN_DEPENDS}
367         ${GENSCRIPTS} armaoutb "$(tdir_armaoutb)"
368 earmaoutl.c:    $(srcdir)/emulparams/armaoutl.sh \
369   $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/armaout.sc ${GEN_DEPENDS}
370         ${GENSCRIPTS} armaoutl "$(tdir_armaoutl)"
371 earmcoff.c:     $(srcdir)/emulparams/armcoff.sh \
372   $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/armcoff.sc ${GEN_DEPENDS}
373         ${GENSCRIPTS} armcoff "$(tdir_armcoff)"
374 earmpe.c: $(srcdir)/emulparams/armpe.sh \
375   $(srcdir)/emultempl/pe.em $(srcdir)/scripttempl/pe.sc ${GEN_DEPENDS}
376         ${GENSCRIPTS} armpe "$(tdir_armpe)"
377 ecoff_sparc.c: $(srcdir)/emulparams/coff_sparc.sh \
378   $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/sparccoff.sc ${GEN_DEPENDS}
379         ${GENSCRIPTS} coff_sparc "$(tdir_coff_sparc)"
380 edelta68.c: $(srcdir)/emulparams/delta68.sh \
381   $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/delta68.sc ${GEN_DEPENDS}
382         ${GENSCRIPTS} delta68 "$(tdir_delta68)"
383 eebmon29k.c: $(srcdir)/emulparams/ebmon29k.sh \
384   $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/ebmon29k.sc ${GEN_DEPENDS}
385         ${GENSCRIPTS} ebmon29k "$(tdir_ebmon29k)"
386 eelf32_sparc.c: $(srcdir)/emulparams/elf32_sparc.sh \
387   $(srcdir)/emultempl/elf32.em $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS}
388         ${GENSCRIPTS} elf32_sparc "$(tdir_elf32_sparc)"
389 eelf32b4300.c: $(srcdir)/emulparams/elf32b4300.sh \
390   $(srcdir)/emultempl/elf32.em $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS}
391         ${GENSCRIPTS} elf32b4300 "$(tdir_elf32b4300)"
392 eelf32bmip.c: $(srcdir)/emulparams/elf32bmip.sh \
393   $(srcdir)/emultempl/elf32.em $(srcdir)/scripttempl/elfmips.sc ${GEN_DEPENDS}
394         ${GENSCRIPTS} elf32bmip "$(tdir_elf32bmip)"
395 eelf32l4300.c: $(srcdir)/emulparams/elf32l4300.sh \
396   $(srcdir)/emultempl/elf32.em $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS}
397         ${GENSCRIPTS} elf32l4300 "$(tdir_elf32l4300)"
398 eelf32lmip.c: $(srcdir)/emulparams/elf32lmip.sh \
399   $(srcdir)/emultempl/elf32.em $(srcdir)/scripttempl/elfmips.sc ${GEN_DEPENDS}
400         ${GENSCRIPTS} elf32lmip "$(tdir_elf32lmip)"
401 eelf32lppc.c: $(srcdir)/emulparams/elf32lppc.sh \
402   $(srcdir)/emultempl/elf32.em $(srcdir)/scripttempl/elfppc.sc ${GEN_DEPENDS}
403         ${GENSCRIPTS} elf32lppc "$(tdir_elf32lppc)"
404 eelf32ppc.c: $(srcdir)/emulparams/elf32ppc.sh \
405   $(srcdir)/emultempl/elf32.em $(srcdir)/scripttempl/elfppc.sc ${GEN_DEPENDS}
406         ${GENSCRIPTS} elf32ppc "$(tdir_elf32ppc)"
407 eelf64alpha.c: $(srcdir)/emulparams/elf64alpha.sh \
408   $(srcdir)/emultempl/elf32.em $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS}
409         ${GENSCRIPTS} elf64alpha "$(tdir_elf64alpha)"
410 eelf64_sparc.c: $(srcdir)/emulparams/elf64_sparc.sh \
411   $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS}
412         ${GENSCRIPTS} elf64_sparc "$(tdir_elf64_sparc)"
413 eelf_i386.c: $(srcdir)/emulparams/elf_i386.sh \
414   $(srcdir)/emultempl/elf32.em $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS}
415         ${GENSCRIPTS} elf_i386 "$(tdir_elf_i386)"
416 egld960.c: $(srcdir)/emulparams/gld960.sh \
417   $(srcdir)/emultempl/gld960.em $(srcdir)/scripttempl/i960.sc ${GEN_DEPENDS}
418         ${GENSCRIPTS} gld960 "$(tdir_gld960)"
419 egld960coff.c: $(srcdir)/emulparams/gld960coff.sh \
420   $(srcdir)/emultempl/gld960c.em $(srcdir)/scripttempl/i960.sc ${GEN_DEPENDS}
421         ${GENSCRIPTS} gld960coff "$(tdir_gld960coff)"
422 ego32.c: $(srcdir)/emulparams/go32.sh \
423   $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/aout.sc ${GEN_DEPENDS}
424         ${GENSCRIPTS} go32 "$(tdir_go32)"
425 eh8300.c: $(srcdir)/emulparams/h8300.sh \
426   $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/h8300.sc ${GEN_DEPENDS}
427         ${GENSCRIPTS} h8300 "$(tdir_h8300)"
428 eh8300h.c: $(srcdir)/emulparams/h8300h.sh \
429   $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/h8300h.sc ${GEN_DEPENDS}
430         ${GENSCRIPTS} h8300h "$(tdir_h8300h)"
431 eh8300s.c: $(srcdir)/emulparams/h8300s.sh \
432   $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/h8300s.sc ${GEN_DEPENDS}
433         ${GENSCRIPTS} h8300s "$(tdir_h8300s)"
434 eh8500.c: $(srcdir)/emulparams/h8500.sh \
435   $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/h8500.sc ${GEN_DEPENDS}
436         ${GENSCRIPTS} h8500 "$(tdir_h8500)"
437 eh8500b.c: $(srcdir)/emulparams/h8500b.sh \
438   $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/h8500b.sc ${GEN_DEPENDS}
439         ${GENSCRIPTS} h8500b "$(tdir_h8500b)"
440 eh8500c.c: $(srcdir)/emulparams/h8500c.sh \
441   $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/h8500c.sc ${GEN_DEPENDS}
442         ${GENSCRIPTS} h8500c "$(tdir_h8500c)"
443 eh8500m.c: $(srcdir)/emulparams/h8500m.sh \
444   $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/h8500m.sc ${GEN_DEPENDS}
445         ${GENSCRIPTS} h8500m "$(tdir_h8500m)"
446 eh8500s.c: $(srcdir)/emulparams/h8500s.sh \
447   $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/h8500s.sc ${GEN_DEPENDS}
448         ${GENSCRIPTS} h8500s "$(tdir_h8500s)"
449 ehp300bsd.c: $(srcdir)/emulparams/hp300bsd.sh \
450   $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/aout.sc ${GEN_DEPENDS}
451         ${GENSCRIPTS} hp300bsd "$(tdir_hp300bsd)"
452 ehp3hpux.c: $(srcdir)/emulparams/hp3hpux.sh \
453   $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/aout.sc ${GEN_DEPENDS}
454         ${GENSCRIPTS} hp3hpux "$(tdir_hp3hpux)"
455 ehppaelf.c: $(srcdir)/emulparams/hppaelf.sh \
456   $(srcdir)/emultempl/hppaelf.em $(srcdir)/scripttempl/hppaelf.sc ${GEN_DEPENDS}
457         ${GENSCRIPTS} hppaelf "$(tdir_hppaelf)"
458 ei386aout.c: $(srcdir)/emulparams/i386aout.sh \
459   $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/aout.sc ${GEN_DEPENDS}
460         ${GENSCRIPTS} i386aout "$(tdir_i386aout)"
461 ei386bsd.c: $(srcdir)/emulparams/i386bsd.sh \
462   $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/aout.sc ${GEN_DEPENDS}
463         ${GENSCRIPTS} i386bsd "$(tdir_i386bsd)"
464 ei386coff.c: $(srcdir)/emulparams/i386coff.sh \
465   $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/i386coff.sc ${GEN_DEPENDS}
466         ${GENSCRIPTS} i386coff "$(tdir_i386coff)"
467 ei386go32.c: $(srcdir)/emulparams/i386go32.sh \
468   $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/i386go32.sc ${GEN_DEPENDS}
469         ${GENSCRIPTS} i386go32 "$(tdir_i386go32)"
470 ei386linux.c: $(srcdir)/emulparams/i386linux.sh \
471   $(srcdir)/emultempl/linux.em $(srcdir)/scripttempl/aout.sc ${GEN_DEPENDS}
472         ${GENSCRIPTS} i386linux "$(tdir_i386linux)"
473 ei386lynx.c: $(srcdir)/emulparams/i386lynx.sh \
474   $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/i386lynx.sc ${GEN_DEPENDS}
475         ${GENSCRIPTS} i386lynx "$(tdir_i386lynx)"
476 ei386mach.c: $(srcdir)/emulparams/i386mach.sh \
477   $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/aout.sc ${GEN_DEPENDS}
478         ${GENSCRIPTS} i386mach "$(tdir_i386mach)"
479 ei386moss.c: $(srcdir)/emulparams/i386moss.sh \
480   $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS}
481         ${GENSCRIPTS} i386moss "$(tdir_i386moss)"
482 ei386msdos.c: $(srcdir)/emulparams/i386msdos.sh \
483   $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/i386msdos.sc ${GEN_DEPENDS}
484         ${GENSCRIPTS} i386msdos "$(tdir_i386msdos)"
485 ei386nbsd.c:    $(srcdir)/emulparams/i386nbsd.sh \
486   $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/aout.sc ${GEN_DEPENDS}
487         ${GENSCRIPTS} i386nbsd "$(tdir_i386nbsd)"
488 ei386nw.c:      $(srcdir)/emulparams/i386nw.sh \
489   $(srcdir)/emultempl/elf32.em $(srcdir)/scripttempl/nw.sc ${GEN_DEPENDS}
490         ${GENSCRIPTS} i386nw "$(tdir_i386nw)"
491 ei386pe.c: $(srcdir)/emulparams/i386pe.sh \
492   $(srcdir)/emultempl/pe.em $(srcdir)/scripttempl/pe.sc ${GEN_DEPENDS}
493         ${GENSCRIPTS} i386pe "$(tdir_i386pe)"
494 elnk960.c: $(srcdir)/emulparams/lnk960.sh \
495   $(srcdir)/emultempl/lnk960.em $(srcdir)/scripttempl/i960.sc ${GEN_DEPENDS}
496         ${GENSCRIPTS} lnk960 "$(tdir_lnk960)"
497 em68k4knbsd.c:  $(srcdir)/emulparams/m68k4knbsd.sh \
498   $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/aout.sc ${GEN_DEPENDS}
499         ${GENSCRIPTS} m68k4knbsd "$(tdir_m68k4knbsd)"
500 em68kaout.c: $(srcdir)/emulparams/m68kaout.sh \
501   $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/aout.sc ${GEN_DEPENDS}
502         ${GENSCRIPTS} m68kaout "$(tdir_m68kaout)"
503 em68kaux.c: $(srcdir)/emulparams/m68kaux.sh \
504   $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/m68kaux.sc ${GEN_DEPENDS}
505         ${GENSCRIPTS} m68kaux "$(tdir_m68kaux)"
506 em68kcoff.c: $(srcdir)/emulparams/m68kcoff.sh \
507   $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/m68kcoff.sc ${GEN_DEPENDS}
508         ${GENSCRIPTS} m68kcoff "$(tdir_m68kcoff)"
509 em68kelf.c: $(srcdir)/emulparams/m68kelf.sh \
510   $(srcdir)/emultempl/elf32.em $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS}
511         ${GENSCRIPTS} m68kelf "$(tdir_m68kelf)"
512 em68klinux.c: $(srcdir)/emulparams/m68klinux.sh \
513   $(srcdir)/emultempl/linux.em $(srcdir)/scripttempl/aout.sc ${GEN_DEPENDS}
514         ${GENSCRIPTS} m68klinux "$(tdir_m68klinux)"
515 em68klynx.c: $(srcdir)/emulparams/m68klynx.sh \
516   $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/m68klynx.sc ${GEN_DEPENDS}
517         ${GENSCRIPTS} m68klynx "$(tdir_m68klynx)"
518 em68knbsd.c:    $(srcdir)/emulparams/m68knbsd.sh \
519   $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/aout.sc ${GEN_DEPENDS}
520         ${GENSCRIPTS} m68knbsd "$(tdir_m68knbsd)"
521 em68kpsos.c:    $(srcdir)/emulparams/m68kpsos.sh \
522   $(srcdir)/emultempl/elf32.em $(srcdir)/scripttempl/psos.sc ${GEN_DEPENDS}
523         ${GENSCRIPTS} m68kpsos "$(tdir_m68kpsos)"
524 em88kbcs.c: $(srcdir)/emulparams/m88kbcs.sh \
525   $(srcdir)/emultempl/m88kbcs.em $(srcdir)/scripttempl/m88kbcs.sc ${GEN_DEPENDS}
526         ${GENSCRIPTS} m88kbcs "$(tdir_m88kbcs)"
527 emipsbig.c:  $(srcdir)/emulparams/mipsbig.sh \
528   $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/mips.sc ${GEN_DEPENDS}
529         ${GENSCRIPTS} mipsbig
530 emipsbsd.c: $(srcdir)/emulparams/mipsbsd.sh \
531   $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/mipsbsd.sc ${GEN_DEPENDS}
532         ${GENSCRIPTS} mipsbsd
533 emipsidt.c: $(srcdir)/emulparams/mipsidt.sh \
534   $(srcdir)/emultempl/mipsecoff.em $(srcdir)/scripttempl/mips.sc ${GEN_DEPENDS}
535         ${GENSCRIPTS} mipsidt "$(tdir_mipsidt)"
536 emipsidtl.c: $(srcdir)/emulparams/mipsidtl.sh \
537   $(srcdir)/emultempl/mipsecoff.em $(srcdir)/scripttempl/mips.sc ${GEN_DEPENDS}
538         ${GENSCRIPTS} mipsidtl "$(tdir_mipsidtl)"
539 emipslit.c:  $(srcdir)/emulparams/mipslit.sh \
540   $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/mips.sc ${GEN_DEPENDS}
541         ${GENSCRIPTS} mipslit "$(tdir_mipslit)"
542 enews.c: $(srcdir)/emulparams/news.sh \
543   $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/aout.sc ${GEN_DEPENDS}
544         ${GENSCRIPTS} news "$(tdir_news)"
545 ens32knbsd.c:   $(srcdir)/emulparams/ns32knbsd.sh \
546   $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/aout.sc ${GEN_DEPENDS}
547         ${GENSCRIPTS} ns32knbsd "$(tdir_ns32knbsd)"
548 epc532macha.c: $(srcdir)/emulparams/pc532macha.sh \
549   $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/aout.sc ${GEN_DEPENDS}
550         ${GENSCRIPTS} pc532macha "$(tdir_pc532macha)"
551 eppcmacos.c:    $(srcdir)/emulparams/ppcmacos.sh \
552   $(srcdir)/emultempl/aix.em $(srcdir)/scripttempl/aix.sc ${GEN_DEPENDS}
553         ${GENSCRIPTS} ppcmacos "$(tdir_ppcmacos)"
554 eppcnw.c:       $(srcdir)/emulparams/ppcnw.sh \
555   $(srcdir)/emultempl/elf32.em $(srcdir)/scripttempl/nw.sc ${GEN_DEPENDS}
556         ${GENSCRIPTS} ppcnw "$(tdir_ppcnw)"
557 eppcpe.c: $(srcdir)/emulparams/ppcpe.sh \
558   $(srcdir)/emultempl/pe.em $(srcdir)/scripttempl/ppcpe.sc ${GEN_DEPENDS}
559         ${GENSCRIPTS} ppcpe "$(tdir_ppcpe)"
560 eriscix.c: $(srcdir)/emulparams/riscix.sh \
561   $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/aout.sc ${GEN_DEPENDS}
562         ${GENSCRIPTS} riscix "$(tdir_riscix)"
563 esa29200.c: $(srcdir)/emulparams/sa29200.sh \
564   $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/sa29200.sc ${GEN_DEPENDS}
565         ${GENSCRIPTS} sa29200 "$(tdir_sa29200)"
566 esh.c: $(srcdir)/emulparams/sh.sh \
567   $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/sh.sc ${GEN_DEPENDS}
568         ${GENSCRIPTS} sh "$(tdir_sh)"
569 eshl.c: $(srcdir)/emulparams/shl.sh \
570   $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/sh.sc ${GEN_DEPENDS}
571         ${GENSCRIPTS} shl "$(tdir_shl)"
572 esparcaout.c: $(srcdir)/emulparams/sparcaout.sh \
573   $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/aout.sc ${GEN_DEPENDS}
574         ${GENSCRIPTS} sparcaout "$(tdir_sparcaout)"
575 esparclynx.c: $(srcdir)/emulparams/sparclynx.sh \
576   $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/sparclynx.sc ${GEN_DEPENDS}
577         ${GENSCRIPTS} sparclynx "$(tdir_sparclynx)"
578 esparcnbsd.c:   $(srcdir)/emulparams/sparcnbsd.sh \
579   $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/aout.sc ${GEN_DEPENDS}
580         ${GENSCRIPTS} sparcnbsd "$(tdir_sparcnbsd)"
581 est2000.c: $(srcdir)/emulparams/st2000.sh \
582   $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/st2000.sc ${GEN_DEPENDS}
583         ${GENSCRIPTS} st2000 "$(tdir_st2000)"
584 esun3.c: $(srcdir)/emulparams/sun3.sh \
585   $(srcdir)/emultempl/sunos.em $(srcdir)/scripttempl/aout.sc ${GEN_DEPENDS}
586         ${GENSCRIPTS} sun3 "$(tdir_sun3)"
587 esun4.c: $(srcdir)/emulparams/sun4.sh \
588   $(srcdir)/emultempl/sunos.em $(srcdir)/scripttempl/aout.sc ${GEN_DEPENDS}
589         ${GENSCRIPTS} sun4 "$(tdir_sun4)"
590 evanilla.c: $(srcdir)/emulparams/vanilla.sh \
591   $(srcdir)/emultempl/vanilla.em $(srcdir)/scripttempl/vanilla.sc ${GEN_DEPENDS}
592         ${GENSCRIPTS} vanilla "$(tdir_vanilla)"
593 evax.c: $(srcdir)/emulparams/vax.sh \
594   $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/aout.sc ${GEN_DEPENDS}
595         ${GENSCRIPTS} vax "$(tdir_vax)"
596 evsta.c: $(srcdir)/emulparams/vsta.sh \
597   $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/aout.sc ${GEN_DEPENDS}
598         ${GENSCRIPTS} vsta "$(tdir_vsta)"
599 ew65.c: $(srcdir)/emulparams/w65.sh \
600   $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/w65.sc ${GEN_DEPENDS}
601         ${GENSCRIPTS} w65 "$(tdir_w65)"
602 ez8001.c: $(srcdir)/emulparams/z8001.sh \
603   $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/z8000.sc ${GEN_DEPENDS}
604         ${GENSCRIPTS} z8001 "$(tdir_z8001)"
605 ez8002.c: $(srcdir)/emulparams/z8002.sh \
606   $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/z8000.sc ${GEN_DEPENDS}
607         ${GENSCRIPTS} z8002 "$(tdir_z8002)"
608
609 $(LD_PROG): $(OFILES) $(BFDDEP) $(LIBIBERTY)
610         $(CC) $(HLDFLAGS) $(CFLAGS) $(LDFLAGS) -o $(LD_PROG) $(OFILES) $(BFDLIB) $(LIBIBERTY) $(EXTRALIBS)
611
612 # The generated emulation files mostly have the same dependencies.
613 $(EMULATION_OFILES): ../bfd/bfd.h sysdep.h config.h $(INCDIR)/bfdlink.h \
614   ld.h ldmain.h ldemul.h ldfile.h ldmisc.h ldexp.h ldlang.h \
615   ldctor.h ldexp.h ldlang.h ldgram.h
616
617 # These targets are for the dejagnu testsuites. The file site.exp 
618 # contains global variables that all the testsuites will use.
619
620 site.exp: ./config.status Makefile
621         @echo "Making a new config file..."
622         @rm -f ./tmp?
623         @touch site.exp
624         @mv site.exp site.bak
625         @echo "## variables are automatically generated by make ##" > ./tmp0
626         @echo "# Do not edit here. If you wish to override these" >> ./tmp0
627         @echo "# values, add them to the last section" >> ./tmp0
628         @echo "# HOST AND TARGET INFO" >> ./tmp0
629         @echo "set host_os @host_os@" >> ./tmp0
630         @echo "set host_alias @host_alias@" >> ./tmp0
631         @echo "set host_cpu @host_cpu@" >> ./tmp0
632         @echo "set host_vendor @host_vendor@" >> ./tmp0
633         @echo "set target_os @target_os@" >> ./tmp0
634         @echo "set target_alias @target_alias@" >> ./tmp0
635         @echo "set target_cpu @target_cpu@" >> ./tmp0
636         @echo "set target_vendor @target_vendor@" >> ./tmp0
637         @echo "set host_triplet @host@" >> ./tmp0
638         @echo "set target_triplet @target@" >> ./tmp0
639         @echo "# DIRECTORY INFO" >> ./tmp0
640         @echo "set objdir `pwd`" >> ./tmp0
641         @echo "" >> ./tmp0      
642         @echo "# LD DEPENDENCIES" >> ./tmp0     
643         @echo "set OFILES \"$(OFILES)\"" >> ./tmp0
644         @echo "set BFDLIB \"$(BFDLIB)\"" >> ./tmp0
645         @echo "set LIBIBERTY \"$(LIBIBERTY)\"" >> ./tmp0
646         @echo "set HOSTING_EMU \"$(HOSTING_EMU)\"" >> ./tmp0
647         @echo "set HOSTING_CRT0 \"$(HOSTING_CRT0)\"" >> ./tmp0
648         @echo "set HOSTING_LIBS \"$(HOSTING_LIBS)\"" >> ./tmp0
649         @echo "" >> ./tmp0      
650         @echo "## Variables generated by configure. Do Not Edit ##" >> ./tmp0
651         @cat ./tmp0 > site.exp
652         @cat site.bak | sed \
653                         -e '1,/^## Variables generated by.*##/ d' >> site.exp
654         -@rm -f ./tmp?
655
656 check: site.exp
657         r=`pwd`; export r; \
658         srcroot=`cd ${srcdir}; pwd` ; export srcroot ; \
659         EXPECT=${EXPECT} ; export EXPECT ; \
660         $(RPATH_ENVVAR)=$$r/../bfd:$$r/../opcodes:$$$(RPATH_ENVVAR); \
661         export $(RPATH_ENVVAR); \
662         if [ -f $$r/../expect/expect ] ; then  \
663            TCL_LIBRARY=$${srcroot}/../tcl/library ; \
664            export TCL_LIBRARY ; \
665         else true ; fi ; \
666         $(RUNTEST) --tool ld --srcdir $(srcdir)/testsuite $(RUNTESTFLAGS) \
667           CC="$(CC_FOR_TARGET)" CFLAGS="$(CFLAGS)" \
668           CXX="$(CXX_FOR_TARGET)" CXXFLAGS="$(CXXFLAGS)" \
669           CC_FOR_HOST="$(CC)" CFLAGS_FOR_HOST="$(CFLAGS)"
670
671 installcheck:
672 .PHONY: check installcheck
673
674 # Rules for testing by relinking ld itself.
675 # A similar test is in the testsuite.  This target is for ease of use
676 # when porting ld.
677
678 ld-partial.o: ld.new
679         ./ld.new $(HOSTING_EMU) -o ld-partial.o -r $(OFILES)
680 ld1: ld-partial.o
681         ./ld.new $(HOSTING_EMU) -o ld1 $(HOSTING_CRT0) ld-partial.o $(BFDLIB) $(LIBIBERTY) $(HOSTING_LIBS)
682
683 ld1-full: ld.new
684         ./ld.new $(HOSTING_EMU) -o ld1-full $(HOSTING_CRT0) $(OFILES) $(BFDLIB) $(LIBIBERTY) $(HOSTING_LIBS)
685
686 ld2: ld1
687         ./ld1 $(HOSTING_EMU) -o ld2 $(HOSTING_CRT0) $(OFILES) $(BFDLIB) $(LIBIBERTY) $(HOSTING_LIBS)
688
689 ld3: ld2
690         ./ld2 $(HOSTING_EMU) -o ld3 $(HOSTING_CRT0) $(OFILES) $(BFDLIB) $(LIBIBERTY) $(HOSTING_LIBS)
691
692 bootstrap: ld3
693         cmp ld2 ld3
694
695 .PHONY: bootstrap
696
697 # A test program for C++ constructors and destructors.
698 # This test is now in the testsuite.
699 #
700 #cdtest: cdtest-main.o cdtest-bar.o cdtest-foo.o ld.new
701 #       ./ld.new $(HOSTING_EMU) -o cdtest $(HOSTING_CRT0) \
702 #         cdtest-main.o cdtest-bar.o cdtest-foo.o $(HOSTING_LIBS)
703 #
704 #cdtest.out: cdtest
705 #       ./cdtest > cdtest.tmp
706 #       mv cdtest.tmp cdtest.out
707 #
708 #cdtest-ur.o: cdtest-main.o cdtest-bar.o cdtest-foo.o ld.new
709 #       ./ld.new $(HOSTING_EMU) -o cdtest-ur.o -Ur cdtest-main.o \
710 #         cdtest-bar.o cdtest-foo.o
711 #
712 #cdtest-ur: cdtest-ur.o
713 #       ./ld.new $(HOSTING_EMU) -o cdtest-ur $(HOSTING_CRT0) cdtest-ur.o \
714 #         $(HOSTING_LIBS)
715 #
716 #cdtest-ur.out: cdtest-ur
717 #       ./cdtest-ur > cdtest-ur.tmp
718 #       mv cdtest-ur.tmp cdtest-ur.out
719 #
720 #check-cdtest: cdtest.out cdtest-ur.out $(srcdir)/cdtest.exp
721 #       diff $(srcdir)/cdtest.exp cdtest.out
722 #       diff $(srcdir)/cdtest.exp cdtest-ur.out
723 #
724 #.PHONY: check-cdtest
725
726 # END OF CHECK TARGETS
727
728 # DOCUMENTATION TARGETS
729 # Manual configuration file; not usually attached to normal configuration,
730 # because almost all configs use "gen" version of manual.
731 #  Set DOCVER above to change.
732 configdoc.texi: ${DOCVER}-doc.texi
733         ln -s ${srcdir}/${DOCVER}-doc.texi ./configdoc.texi || \
734         ln ${srcdir}/${DOCVER}-doc.texi ./configdoc.texi || \
735         cp ${srcdir}/${DOCVER}-doc.texi ./configdoc.texi
736
737 # TeX output
738 dvi: ld.dvi
739 ld.dvi: $(srcdir)/ld.texinfo configdoc.texi $(BFDDIR)/doc/bfdsumm.texi
740         TEXINPUTS=$(BFDDIR)/doc:$$TEXINPUTS $(TEXI2DVI) $(srcdir)/ld.texinfo
741
742 ldint.dvi: $(srcdir)/ldint.texinfo
743         $(TEXI2DVI) $(srcdir)/ldint.texinfo
744
745 # info file for online browsing
746 ld.info: $(srcdir)/ld.texinfo configdoc.texi $(BFDDIR)/doc/bfdsumm.texi
747         $(MAKEINFO) -I$(BFDDIR)/doc -o ld.info $(srcdir)/ld.texinfo
748
749 ldint.info: $(srcdir)/ldint.texinfo
750         $(MAKEINFO) -o ldint.info $(srcdir)/ldint.texinfo
751
752 .PHONY: dvi
753
754 #separate targets for "ms", "me", and "mm" forms of roff doc
755 # Try to use a recent texi2roff.  v2 was put on prep in jan91.
756 # If you want an index, see texi2roff doc for postprocessing 
757 # and add -i to texi2roff invocations below.
758 # Workarounds for texi2roff-2 (probably fixed in later texi2roff's, delete
759 #    correspondint -e lines when later texi2roff's are current)
760 # + @ifinfo's deleted explicitly due to texi2roff-2 bug w nested constructs.
761 # + @c's deleted explicitly because texi2roff sees texinfo commands in them
762 # + @   (that's at-BLANK) not recognized by texi2roff, turned into blank
763 # + @alphaenumerate is ridiculously new, turned into @enumerate
764
765 ld.ms: $(srcdir)/ld.texinfo
766         sed -e '/\\input texinfo/d' \
767                 -e '/@c TEXI2ROFF-KILL/,/@c END TEXI2ROFF-KILL/d' \
768                 -e '/^@ifinfo/,/^@end ifinfo/d' \
769                 -e '/^@c/d' \
770                 -e 's/{.*,,/{/' \
771                 -e 's/@ / /g' \
772                 -e 's/^@alphaenumerate/@enumerate/g' \
773                 -e 's/^@end alphaenumerate/@end enumerate/g' \
774                 $(srcdir)/ld.texinfo | \
775         $(TEXI2ROFF) $(TEXI2OPT) -ms | \
776         sed -e 's/---/\\(em/g' \
777                 >>ld.ms 
778
779 # index for roff output
780 ld-index.ms: ld.ms
781         $(ROFF) -ms ld.ms 2>&1 1>/dev/null | \
782                 sed -e '/: warning:/d' | \
783                 texi2index >ld-index.ms
784
785 # roff output (-mm)
786 ld.mm: $(srcdir)/ld.texinfo
787         sed -e '/\\input texinfo/d' \
788                 -e '/@c TEXI2ROFF-KILL/,/@c END TEXI2ROFF-KILL/d' \
789                 -e '/^@ifinfo/,/^@end ifinfo/d' \
790                 -e '/^@c/d' \
791                 -e 's/{.*,,/{/' \
792                 -e '/@noindent/d' \
793                 -e 's/@ / /g' \
794                 -e 's/^@alphaenumerate/@enumerate/g' \
795                 -e 's/^@end alphaenumerate/@end enumerate/g' \
796                 $(srcdir)/ld.texinfo | \
797         $(TEXI2ROFF) $(TEXI2OPT) -mm | \
798         sed -e 's/---/\\(em/g' \
799         >ld.mm 
800
801 # index for roff output
802 ld-index.mm: ld.mm
803         $(ROFF) -mm ld.mm 2>&1 1>/dev/null | \
804                 sed -e '/: warning:/d' | \
805                 texi2index >ld-index.mm
806
807 # roff output (-me)
808 ld.me: $(srcdir)/ld.texinfo
809         sed -e '/\\input texinfo/d' \
810                 -e '/@c TEXI2ROFF-KILL/,/@c END TEXI2ROFF-KILL/d' \
811                 -e '/^@ifinfo/,/^@end ifinfo/d' \
812                 -e '/^@c/d' \
813                 -e 's/{.*,,/{/' \
814                 -e 's/@ / /g' \
815                 -e 's/^@alphaenumerate/@enumerate/g' \
816                 -e 's/^@end alphaenumerate/@end enumerate/g' \
817                 $(srcdir)/ld.texinfo | \
818         $(TEXI2ROFF) $(TEXI2OPT) -me | \
819         sed -e 's/---/\\(em/g' \
820                 >>ld.me 
821
822 # index for roff output
823 ld-index.me: ld.me
824         $(ROFF) -me ld.me 2>&1 1>/dev/null | \
825                 sed -e '/: warning:/d' | \
826                 texi2index >ld-index.me
827
828 stage1: force
829         -mkdir stage1
830         -mv -f $(STAGESTUFF) $(LD_PROG) stage1
831         -(cd stage1 ; ln -s $(LD_PROG) ld)
832
833 stage2: force
834         -mkdir stage2
835         -mv -f $(STAGESTUFF) $(LD_PROG) stage2
836         -(cd stage2 ; ln -s $(LD_PROG) ld)
837
838 stage3: force
839         -mkdir stage3
840         -mv -f $(STAGESTUFF) $(LD_PROG) stage3
841         -(cd stage3 ; ln -s $(LD_PROG) ld)
842
843 against = stage2
844
845 comparison: force
846         for i in $(STAGESTUFF) $(LD_PROG) ; do cmp $$i $(against)/$$i ; done
847
848 de-stage1: force
849         -(cd stage1 ; mv -f * ..)
850         -rm ld
851         -rmdir stage1
852
853 de-stage2: force
854         -(cd stage2 ; mv -f * ..)
855         -rm ld
856         -rmdir stage2
857
858 de-stage3: force
859         -(cd stage3 ; mv -f * ..)
860         -rm ld
861         -rmdir stage3
862
863 .PHONY: stage1 stage2 stage3 comparison de-stage1 de-stage2 de-stage3
864
865 # Stuff that should be included in a distribution:
866 LDDISTSTUFF = ldgram.c ldgram.h ldlex.c
867 diststuff: $(LDDISTSTUFF) info
868
869 mostlyclean:
870         -rm -f $(STAGESTUFF) ld.?? ld.??? ldlex.[qp] config.log
871         -rm -f ld ld1 ld2 ld3 *.o y.output cdtest cdtest.out cdtest.tmp
872         -rm -f cdtest-ur cdtest-ur.out cdtest-ur.tmp crtbegin.o crtend.o
873         -rm -f ldemul-list.h
874         -rm -fr tmpdir
875 clean: mostlyclean
876         -rm -f $(LD_PROG) configdoc.texi
877 distclean: clean
878         -rm -f Makefile config.status TAGS site.exp site.bak config.cache
879         -rm -f config.h stamp-h
880         -rm -rf ldscripts
881 maintainer-clean realclean: clean distclean
882         @echo "This command is intended for maintainers to use;"
883         @echo "it deletes files that may require special tools to rebuild."
884         -rm -f $(GENERATED_CFILES) $(GENERATED_HFILES)
885         -rm -f $(LDDISTSTUFF) *.info*
886
887 .PHONY: diststuff mostlyclean clean distclean realclean
888
889 lintlog:$(LINTSOURCES) Makefile
890         $(LINT) -abhxzn  $(LINTFLAGS)  $(LINTSOURCES) \
891 | grep -v "pointer casts may be troublesome" \
892 | grep -v "possible pointer alignment problem" \
893 | grep -v "ignore" \
894 | grep -v "conversion from long may lose accuracy" \
895 | grep -v "warning: constant argument to NOT" \
896 | grep -v "enumeration type clash, operator CAST" \
897 | grep -v "warning: constant in conditional context"\
898 | grep -v "archive\.c"
899
900
901 TAGS:
902         etags -t $(srcdir)/*.[chly] *.[chly]
903
904
905 install: 
906         $(INSTALL_XFORM) ld.new $(bindir)/ld
907         $(INSTALL_XFORM1) $(srcdir)/ld.1 $(man1dir)/ld.1
908         for f in ldscripts/*; do \
909           $(INSTALL_DATA) $$f $(scriptdir)/$$f ; \
910         done
911         test -d $(tooldir) || mkdir $(tooldir)
912         test -d $(tooldir)/bin || mkdir $(tooldir)/bin
913         -n=`echo ld | sed '$(program_transform_name)'`; \
914           rm -f $(tooldir)/bin/ld; \
915           ln $(bindir)/$$n $(tooldir)/bin/ld >/dev/null 2>/dev/null \
916            || $(INSTALL_PROGRAM) ld.new $(tooldir)/bin/ld
917
918 install-info: ld.info
919         if [ -r ld.info ]; then \
920           dir=. ; \
921         else \
922           dir=$(srcdir) ; \
923         fi ; \
924         for i in `cd $$dir ; echo ld.info*` ; do \
925                 $(INSTALL_DATA) $$dir/$$i $(infodir)/$$i ; \
926         done
927
928 clean-info:
929         -rm -rf *.info*
930
931 .PHONY: install install-info clean-info
932
933 # Targets to rebuild dependencies in this Makefile.
934 # Have to get rid of .dep1 here so that "$?" later includes all of $(CFILES).
935 .dep: dep.sed $(CFILES) $(HFILES) $(GENERATED_CFILES) $(GENERATED_HFILES) config.h
936         rm -f .dep1
937         $(MAKE) DEP=$(DEP) .dep1
938         sed -f dep.sed <.dep1 >.dep
939
940 # This rule really wants a mkdep that runs "gcc -MM".
941 .dep1: $(CFILES) $(GENERATED_CFILES)
942         rm -f .dep2
943         echo '# DO NOT DELETE THIS LINE -- mkdep uses it.' > .dep2
944         $(DEP) -f .dep2 $(ALL_CFLAGS) $?
945         $(srcdir)/../move-if-change .dep2 .dep1
946
947 dep.sed: dep-in.sed config.status
948         sed <$(srcdir)/dep-in.sed >dep.sed      \
949                 -e 's!@INCDIR@!$(INCDIR)!'      \
950                 -e 's!@SRCDIR@!$(srcdir)!'
951
952 dep: .dep
953         sed -e '/^..DO NOT DELETE THIS LINE/,$$d' < Makefile > tmp-Makefile
954         cat .dep >> tmp-Makefile
955         $(srcdir)/../move-if-change tmp-Makefile Makefile
956
957 dep-in: .dep
958         sed -e '/^..DO NOT DELETE THIS LINE/,$$d' < $(srcdir)/Makefile.in > tmp-Makefile.in
959         cat .dep >> tmp-Makefile.in
960         $(srcdir)/../move-if-change tmp-Makefile.in $(srcdir)/Makefile.in
961
962 .PHONY: dep dep-in
963
964 # Dummy target to force execution of dependent targets.
965 #
966 force:
967
968 .PHONY: force
969
970 Makefile: Makefile.in config.status
971         CONFIG_FILES=Makefile CONFIG_HEADERS= $(SHELL) ./config.status
972
973 config.h: stamp-h ; @true
974 stamp-h: config.in config.status
975         CONFIG_FILES= CONFIG_HEADERS=config.h:config.in $(SHELL) ./config.status
976
977 config.status: configure configure.host configure.tgt
978         $(SHELL) ./config.status --recheck
979
980 # What appears below is generated by a hacked mkdep using gcc -MM.
981
982 # DO NOT DELETE THIS LINE -- mkdep uses it.
983 # DO NOT PUT ANYTHING AFTER THIS LINE, IT WILL GO AWAY.
984
985 ldctor.o: ldctor.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \
986   $(INCDIR)/obstack.h sysdep.h config.h $(INCDIR)/fopen-same.h \
987   $(INCDIR)/bfdlink.h ld.h ldexp.h ldlang.h ldmisc.h \
988   ldgram.h ldmain.h ldctor.h
989 ldemul.o: ldemul.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \
990   $(INCDIR)/obstack.h sysdep.h config.h $(INCDIR)/fopen-same.h \
991   ld.h ldemul.h ldmisc.h ldexp.h ldlang.h ldfile.h ldmain.h \
992   ldemul-list.h
993 ldexp.o: ldexp.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \
994   $(INCDIR)/obstack.h sysdep.h config.h $(INCDIR)/fopen-same.h \
995   $(INCDIR)/bfdlink.h ld.h ldmain.h ldmisc.h ldexp.h \
996   ldgram.h ldlang.h
997 ldfile.o: ldfile.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \
998   $(INCDIR)/obstack.h sysdep.h config.h $(INCDIR)/fopen-same.h \
999   $(INCDIR)/bfdlink.h ld.h ldmisc.h ldexp.h ldlang.h \
1000   ldfile.h ldmain.h ldgram.h ldlex.h ldemul.h
1001 ldlang.o: ldlang.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \
1002   $(INCDIR)/obstack.h sysdep.h config.h $(INCDIR)/fopen-same.h \
1003   $(INCDIR)/libiberty.h $(INCDIR)/bfdlink.h ld.h ldmain.h \
1004   ldgram.h ldexp.h ldlang.h ldemul.h ldlex.h ldmisc.h \
1005   ldctor.h ldfile.h
1006 ldmain.o: ldmain.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \
1007   $(INCDIR)/obstack.h sysdep.h config.h $(INCDIR)/fopen-same.h \
1008   $(INCDIR)/libiberty.h $(INCDIR)/progress.h $(INCDIR)/bfdlink.h \
1009   ld.h ldmain.h ldmisc.h ldwrite.h ldgram.h ldexp.h ldlang.h \
1010   ldemul.h ldlex.h ldfile.h ldctor.h
1011 ldmisc.o: ldmisc.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \
1012   $(INCDIR)/obstack.h sysdep.h config.h $(INCDIR)/fopen-same.h \
1013   $(INCDIR)/libiberty.h $(INCDIR)/demangle.h ld.h ldmisc.h \
1014   ldexp.h ldlang.h ldgram.h ldlex.h ldmain.h ldfile.h
1015 ldver.o: ldver.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \
1016   $(INCDIR)/obstack.h sysdep.h config.h $(INCDIR)/fopen-same.h \
1017   ld.h ldver.h ldemul.h ldmain.h
1018 ldwrite.o: ldwrite.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \
1019   $(INCDIR)/obstack.h sysdep.h config.h $(INCDIR)/fopen-same.h \
1020   $(INCDIR)/bfdlink.h $(INCDIR)/libiberty.h ld.h ldexp.h \
1021   ldlang.h ldwrite.h ldmisc.h ldgram.h ldmain.h
1022 lexsup.o: lexsup.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \
1023   $(INCDIR)/obstack.h sysdep.h config.h $(INCDIR)/fopen-same.h \
1024   $(INCDIR)/getopt.h $(INCDIR)/bfdlink.h ld.h ldmain.h \
1025   ldmisc.h ldexp.h ldlang.h ldgram.h ldlex.h ldfile.h \
1026   ldver.h ldemul.h
1027 mri.o: mri.c ../bfd/bfd.h $(INCDIR)/ansidecl.h $(INCDIR)/obstack.h \
1028   sysdep.h config.h $(INCDIR)/fopen-same.h ld.h ldexp.h \
1029   ldlang.h ldmisc.h mri.h ldgram.h
1030 ldcref.o: ldcref.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \
1031   $(INCDIR)/obstack.h sysdep.h config.h $(INCDIR)/fopen-same.h \
1032   $(INCDIR)/bfdlink.h $(INCDIR)/libiberty.h ld.h ldmain.h \
1033   ldmisc.h
1034 ldgram.o: ldgram.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \
1035   $(INCDIR)/obstack.h sysdep.h config.h $(INCDIR)/fopen-same.h \
1036   $(INCDIR)/bfdlink.h ld.h ldexp.h ldver.h ldlang.h ldemul.h \
1037   ldfile.h ldmisc.h ldmain.h mri.h ldlex.h
1038 ldlex.o: ldlex.c ../bfd/bfd.h $(INCDIR)/obstack.h sysdep.h \
1039   config.h $(INCDIR)/fopen-same.h ld.h ldgram.h ldmisc.h \
1040   ldexp.h ldlang.h ldfile.h ldlex.h ldmain.h
1041
1042 # IF YOU PUT ANYTHING HERE IT WILL GO AWAY