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