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