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