* Makefile.in: Add dependency for $(EMULATION_OFILES).
[external/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 \
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         $(OTHER_EMULATIONS)
176
177 # This is now set by configure.in.
178 #EMULATION_OFILES=${ALL_EMULATIONS}
179
180 OFILES= ldgram.o ldlex.o lexsup.o ldlang.o mri.o ldctor.o ldmain.o ldindr.o \
181         ldwarn.o ldwrite.o ldexp.o  ldemul.o ldver.o ldmisc.o ldsym.o \
182         ldfile.o relax.o  lderror.o ${EMULATION_OFILES}
183
184 HEADERS=config.h ldmain.h ldmain.h ldwarn.h ldmisc.h ldindr.h \
185         ldsym.h ldctor.h ldlang.h ldexp.h \
186         ldlex.h ldwrite.h ldver.h ldemul.h ldfile.h ldgram.h ld.h
187
188 MANSOURCES=ld.tex
189
190 LDCSOURCES=ldlang.c lexsup.c ldctor.c mri.c ldindr.c ldmain.c ldwrite.c ldwarn.c ldlnk960.c \
191         em_gld.c em_sun3.c em_go32.c em_m88k.c em_ebmon29k.c em_hppaosf.c \
192         ldgld960.c ldemul.c ldver.c ldmisc.c ldexp.c ldsym.c ldfile.c \
193         relax.c lderror.c
194
195 GENERATED_SOURCES=ldgram.c ldlex.c em_*.c ldemul-list.h
196 GENERATED_HEADERS=ldgram.h ldemul-list.h
197
198 LDSOURCES=$(LDCSOURCES) ldgram.y ldlex.l ldgram.h
199
200 BFDSOURCES=../../bfd/common/*.c
201
202 SOURCES= $(LDSOURCES) $(BFDSOURCES)
203 LINTSOURCES=   $(LDCSOURCES) $(BFDSOURCES) $(GENERATED_SOURCES)
204
205 STAGESTUFF = *.o ldscripts/* $(GENERATED_SOURCES) $(GENERATED_HEADERS)
206
207 all: $(LD_PROG)
208
209 info: ld.info
210
211 ldgram.h ldgram.c: ldgram.y
212         $(BISON) $(BISONFLAGS) -d $(srcdir)/ldgram.y
213         mv -f y.tab.c ldgram.c
214         mv -f y.tab.h ldgram.h
215
216 # EMUL is the name of a file in the emulparams subdir, without the .sh.
217 DEF_EMUL = ` if [ -z "$(EMUL)" ] ; then \
218                echo "you must set a default emulation" 1>&2 ; \
219                exit 1 ; \
220              else \
221                echo -DDEFAULT_EMULATION='"$(EMUL)"' ; \
222              fi`
223
224 ldmain.o: ldmain.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \
225   $(INCDIR)/obstack.h ../bfd/sysdep.h $(BFDDIR)/hosts/std-host.h \
226   $(INCDIR)/fopen-same.h config.h ld.h \
227   ldmain.h ldmisc.h ldwrite.h ./ldgram.h \
228   ldsym.h ldlang.h ldemul.h ldlex.h \
229   ldfile.h ldindr.h ldwarn.h ldctor.h \
230   lderror.h 
231         $(CC) -c $(INCLUDES) $(HDEFINES) $(TDEFINES) $(CDEFINES) $(DEF_EMUL) -DSCRIPTDIR='"$(scriptdir)"' $(CFLAGS) $<
232
233 ldemul-list.h: Makefile
234         (echo "/* This file is automatically generated.  DO NOT EDIT! */";\
235         for f in `echo " " ${EMULATION_OFILES} "" \
236          | sed -e 's/em_/ld/g' -e 's/ ld/ /g' -e 's/[.]o//g'`; do \
237             echo "extern ld_emulation_xfer_type ld_$${f}_emulation;"; \
238         done;\
239         echo "";\
240         echo "#define EMULATION_LIST \\";\
241         for f in `echo " " ${EMULATION_OFILES} "" \
242          | sed -e 's/em_/ld/g' -e 's/ ld/ /g' -e 's/[.]o//g'`; do \
243             echo "  &ld_$${f}_emulation, \\"; \
244         done;\
245         echo "  0") >ldemul-list.h
246
247 ldlex.c: ldlex.l ldgram.h
248         $(LEX) -I -Cem $(srcdir)/ldlex.l
249         mv lex.yy.c ldlex.c
250
251 # These all start with em_ so 'make clean' can find them.
252
253 GENSCRIPTS=$(SHELL) $(srcdir)/genscripts.sh ${srcdir} ${libdir} ${host_alias} ${target_alias} ${EMUL} "$(NATIVE_LIB_DIRS)"
254 GEN_DEPENDS=$(srcdir)/genscripts.sh
255
256 em_sun4.c: $(srcdir)/emulparams/sun4.sh \
257   $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/aout.sc ${GEN_DEPENDS}
258         ${GENSCRIPTS} sun4
259 em_sun3.c: $(srcdir)/emulparams/sun3.sh \
260   $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/aout.sc ${GEN_DEPENDS}
261         ${GENSCRIPTS} sun3
262 em_go32.c: $(srcdir)/emulparams/go32.sh \
263   $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/aout.sc ${GEN_DEPENDS}
264         ${GENSCRIPTS} go32
265 em_news.c: $(srcdir)/emulparams/news.sh \
266   $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/aout.sc ${GEN_DEPENDS}
267         ${GENSCRIPTS} news
268 em_vax.c: $(srcdir)/emulparams/vax.sh \
269   $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/aout.sc ${GEN_DEPENDS}
270         ${GENSCRIPTS} vax
271 em_hp300bsd.c: $(srcdir)/emulparams/hp300bsd.sh \
272   $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/aout.sc ${GEN_DEPENDS}
273         ${GENSCRIPTS} hp300bsd
274 em_hp3hpux.c: $(srcdir)/emulparams/hp3hpux.sh \
275   $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/aout.sc ${GEN_DEPENDS}
276         ${GENSCRIPTS} hp3hpux
277 em_hppaosf.c: $(srcdir)/emulparams/hppaosf.sh \
278   $(srcdir)/emultempl/hppaosf.em $(srcdir)/scripttempl/hppaosf.sc ${GEN_DEPENDS}
279         ${GENSCRIPTS} hppaosf
280 em_i386aout.c: $(srcdir)/emulparams/i386aout.sh \
281   $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/aout.sc ${GEN_DEPENDS}
282         ${GENSCRIPTS} i386aout
283 em_ebmon29k.c: $(srcdir)/emulparams/ebmon29k.sh \
284   $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/ebmon29k.sc ${GEN_DEPENDS}
285         ${GENSCRIPTS} ebmon29k
286 em_sa29200.c: $(srcdir)/emulparams/sa29200.sh \
287   $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/sa29200.sc ${GEN_DEPENDS}
288         ${GENSCRIPTS} sa29200
289 em_a29k.c: $(srcdir)/emulparams/a29k.sh \
290   $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/a29k.sc ${GEN_DEPENDS}
291         ${GENSCRIPTS} a29k
292 em_m88kbcs.c: $(srcdir)/emulparams/m88kbcs.sh \
293   $(srcdir)/emultempl/m88kbcs.em $(srcdir)/scripttempl/m88kbcs.sc ${GEN_DEPENDS}
294         ${GENSCRIPTS} m88kbcs
295 em_h8300.c: $(srcdir)/emulparams/h8300.sh \
296   $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/h8300.sc ${GEN_DEPENDS}
297         ${GENSCRIPTS} h8300
298 em_h8300h.c: $(srcdir)/emulparams/h8300h.sh \
299   $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/h8300h.sc ${GEN_DEPENDS}
300         ${GENSCRIPTS} h8300h
301 em_h8500.c: $(srcdir)/emulparams/h8500.sh \
302   $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/h8500.sc ${GEN_DEPENDS}
303         ${GENSCRIPTS} h8500
304 em_sh.c: $(srcdir)/emulparams/sh.sh \
305   $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/sh.sc ${GEN_DEPENDS}
306         ${GENSCRIPTS} sh
307 em_st2000.c: $(srcdir)/emulparams/st2000.sh \
308   $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/st2000.sc ${GEN_DEPENDS}
309         ${GENSCRIPTS} st2000
310 em_z8ksim.c: $(srcdir)/emulparams/z8ksim.sh \
311   $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/z8ksim.sc ${GEN_DEPENDS}
312         ${GENSCRIPTS} z8ksim
313 em_vanilla.c: $(srcdir)/emulparams/vanilla.sh \
314   $(srcdir)/emultempl/vanilla.em $(srcdir)/scripttempl/vanilla.sc ${GEN_DEPENDS}
315         ${GENSCRIPTS} vanilla
316 em_lnk960.c: $(srcdir)/emulparams/lnk960.sh \
317   $(srcdir)/emultempl/lnk960.em $(srcdir)/scripttempl/i960.sc ${GEN_DEPENDS}
318         ${GENSCRIPTS} lnk960
319 em_gld960.c: $(srcdir)/emulparams/gld960.sh \
320   $(srcdir)/emultempl/gld960.em $(srcdir)/scripttempl/i960.sc ${GEN_DEPENDS}
321         ${GENSCRIPTS} gld960
322 em_m68kcoff.c: $(srcdir)/emulparams/m68kcoff.sh \
323   $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/m68kcoff.sc ${GEN_DEPENDS}
324         ${GENSCRIPTS} m68kcoff
325 em_m68klynx.c: $(srcdir)/emulparams/m68klynx.sh \
326   $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/m68kcoff.sc ${GEN_DEPENDS}
327         ${GENSCRIPTS} m68klynx
328 em_i386coff.c: $(srcdir)/emulparams/i386coff.sh \
329   $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/i386coff.sc ${GEN_DEPENDS}
330         ${GENSCRIPTS} i386coff
331 em_i386lynx.c: $(srcdir)/emulparams/i386lynx.sh \
332   $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/i386coff.sc ${GEN_DEPENDS}
333         ${GENSCRIPTS} i386lynx
334 em_mipslit.c:  $(srcdir)/emulparams/mipslit.sh \
335   $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/mips.sc ${GEN_DEPENDS}
336         ${GENSCRIPTS} mipslit
337 em_i386bsd.c: $(srcdir)/emulparams/i386bsd.sh \
338   $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/aout.sc ${GEN_DEPENDS}
339         ${GENSCRIPTS} i386bsd
340 em_mipsbig.c:  $(srcdir)/emulparams/mipsbig.sh \
341   $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/mips.sc ${GEN_DEPENDS}
342         ${GENSCRIPTS} mipsbig
343 em_mipsbsd.c: $(srcdir)/emulparams/mipsbsd.sh \
344   $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/aout.sc ${GEN_DEPENDS}
345         ${GENSCRIPTS} mipsbsd
346 em_mipsidt.c: $(srcdir)/emulparams/mipsidt.sh \
347   $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/mips.sc ${GEN_DEPENDS}
348         ${GENSCRIPTS} mipsidt
349 em_mipsidtl.c: $(srcdir)/emulparams/mipsidtl.sh \
350   $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/mips.sc ${GEN_DEPENDS}
351         ${GENSCRIPTS} mipsidtl
352 em_elf_i386.c: $(srcdir)/emulparams/elf_i386.sh \
353   $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS}
354         ${GENSCRIPTS} elf_i386
355 em_elf32mipb.c: $(srcdir)/emulparams/elf32mipb.sh \
356   $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS}
357         ${GENSCRIPTS} elf32mipb
358 em_alpha.c: $(srcdir)/emulparams/alpha.sh \
359   $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/alpha.sc ${GEN_DEPENDS}
360         ${GENSCRIPTS} alpha
361
362 $(LD_PROG): $(OFILES) $(BFDLIB) $(LIBIBERTY)
363         $(CC) $(INCLUDES) $(HDEFINES) $(TDEFINES) $(CDEFINES) $(CFLAGS) $(LDFLAGS) -o $(LD_PROG) $(OFILES) $(BFDLIB) $(LIBIBERTY) $(LOADLIBES)
364
365 # The generated emulation files mostly have the same dependencies.
366 $(EMULATION_OFILES): ../bfd/bfd.h ../bfd/sysdep.h ld.h ldemul.h \
367   ldfile.h ldmisc.h config.h
368
369 # This list of dependencies was generated by doing a make with gcc -MM
370 # saving the output in a file and removing the gcc commands
371 # changing "../../devo/ld/../bfd" to "$(BFDDIR)"
372 # removing "../../devo/ld/"
373 # changing "../include" to "$(INCDIR)"
374
375 ldgram.o: ldgram.c ../bfd/bfd.h $(INCDIR)/ansidecl.h $(INCDIR)/obstack.h \
376   ../bfd/sysdep.h $(BFDDIR)/hosts/std-host.h $(INCDIR)/fopen-same.h \
377   ld.h ldexp.h ldver.h ldlang.h \
378   ldemul.h ldfile.h ldmisc.h mri.h 
379 ldlex.o: ldlex.c ../bfd/bfd.h $(INCDIR)/obstack.h ./ldgram.h 
380 lexsup.o: lexsup.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \
381   $(INCDIR)/obstack.h ../bfd/sysdep.h $(BFDDIR)/hosts/std-host.h \
382   $(INCDIR)/fopen-same.h ldlex.h ld.h \
383   ldexp.h ./ldgram.h ldmisc.h 
384 ldlang.o: ldlang.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \
385   $(INCDIR)/obstack.h ../bfd/sysdep.h $(BFDDIR)/hosts/std-host.h \
386   $(INCDIR)/fopen-same.h ld.h ldmain.h \
387   ldsym.h ./ldgram.h ldwarn.h ldlang.h \
388   ldexp.h ldemul.h ldlex.h ldmisc.h \
389   ldindr.h ldctor.h 
390 mri.o: mri.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \
391   $(INCDIR)/obstack.h ../bfd/sysdep.h $(BFDDIR)/hosts/std-host.h \
392   $(INCDIR)/fopen-same.h ld.h ldlang.h \
393   mri.h ./ldgram.h ldexp.h 
394 ldctor.o: ldctor.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \
395   $(INCDIR)/obstack.h ../bfd/sysdep.h $(BFDDIR)/hosts/std-host.h \
396   $(INCDIR)/fopen-same.h ld.h ldlang.h \
397   ldsym.h ldmisc.h ldexp.h ./ldgram.h 
398 ldmain.o: ldmain.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \
399   $(INCDIR)/obstack.h ../bfd/sysdep.h $(BFDDIR)/hosts/std-host.h \
400   $(INCDIR)/fopen-same.h config.h ld.h \
401   ldmain.h ldmisc.h ldwrite.h ./ldgram.h \
402   ldsym.h ldlang.h ldemul.h ldlex.h \
403   ldfile.h ldindr.h ldwarn.h ldctor.h \
404   lderror.h 
405 ldindr.o: ldindr.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \
406   $(INCDIR)/obstack.h ../bfd/sysdep.h $(BFDDIR)/hosts/std-host.h \
407   $(INCDIR)/fopen-same.h ld.h ldsym.h \
408   ldmisc.h 
409 ldwarn.o: ldwarn.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \
410   $(INCDIR)/obstack.h ../bfd/sysdep.h $(BFDDIR)/hosts/std-host.h \
411   $(INCDIR)/fopen-same.h ldsym.h ldwarn.h \
412   ldmisc.h 
413 ldwrite.o: ldwrite.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \
414   $(INCDIR)/obstack.h ../bfd/sysdep.h $(BFDDIR)/hosts/std-host.h \
415   $(INCDIR)/fopen-same.h ldlang.h ld.h \
416   ldwrite.h ldmisc.h ldsym.h ./ldgram.h \
417   relax.h 
418 ldexp.o: ldexp.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \
419   $(INCDIR)/obstack.h ../bfd/sysdep.h $(BFDDIR)/hosts/std-host.h \
420   $(INCDIR)/fopen-same.h ld.h ldmain.h \
421   ldmisc.h ldexp.h ./ldgram.h ldsym.h \
422   ldlang.h 
423 ldemul.o: ldemul.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \
424   $(INCDIR)/obstack.h ../bfd/sysdep.h $(BFDDIR)/hosts/std-host.h \
425   $(INCDIR)/fopen-same.h config.h ld.h \
426   ldemul.h ldmisc.h ./ldemul-list.h 
427 ldver.o: ldver.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \
428   $(INCDIR)/obstack.h ../bfd/sysdep.h $(BFDDIR)/hosts/std-host.h \
429   $(INCDIR)/fopen-same.h ldver.h ldemul.h 
430 ldmisc.o: ldmisc.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \
431   $(INCDIR)/obstack.h ../bfd/sysdep.h $(BFDDIR)/hosts/std-host.h \
432   $(INCDIR)/fopen-same.h ld.h ldmisc.h \
433   ldlang.h ldlex.h 
434 ldsym.o: ldsym.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \
435   $(INCDIR)/obstack.h ../bfd/sysdep.h $(BFDDIR)/hosts/std-host.h \
436   $(INCDIR)/fopen-same.h ld.h ldsym.h \
437   ldmisc.h ldlang.h 
438 ldfile.o: ldfile.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \
439   $(INCDIR)/obstack.h ../bfd/sysdep.h $(BFDDIR)/hosts/std-host.h \
440   $(INCDIR)/fopen-same.h ldmisc.h ldlang.h \
441   ldfile.h 
442 relax.o: relax.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \
443   $(INCDIR)/obstack.h $(BFDDIR)/seclet.h $(INCDIR)/coff/internal.h \
444   ../bfd/sysdep.h $(BFDDIR)/hosts/std-host.h $(INCDIR)/fopen-same.h \
445   ldlang.h ld.h ldwrite.h ldmisc.h \
446   ldsym.h ./ldgram.h relax.h 
447 lderror.o: lderror.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \
448   $(INCDIR)/obstack.h ../bfd/sysdep.h $(BFDDIR)/hosts/std-host.h \
449   $(INCDIR)/fopen-same.h $(BFDDIR)/seclet.h ld.h \
450   ldmisc.h 
451
452 # CYGNUS LOCAL targets.
453 # These targets are for the dejagnu testsuites. The file site.exp 
454 # contains global variables that all the testsuites will use.
455 # There is a current debate as to how and where to generate test
456 # outputs. Rob feels each test should be built in $(objdir) with
457 # a unique name. Cassidy feels that we should create a directory
458 # called $(objdir)/tmpdir and do the work there. This way, there
459 # is no potential conflict with existing objects, ie: as there
460 # was in the past with loop.o and flow.o, and, there is no chance
461 # of filling /tmp, which would cause other problems. Lastly, this 
462 # allow retention of the testcase name making debugging easier.
463 #
464 testdir = $(objdir)/tmpdir
465
466 site.exp: ./config.status Makefile
467         @if [ -d $(testdir) ]; then true; else mkdir $(testdir); fi
468         @echo "Making a new config file..."
469         @rm -f ./tmp?
470         @touch site.exp
471         @mv site.exp site.bak
472         @echo "## variables are automatically generated by make ##" > ./tmp0
473         @echo "# Do not edit here. If you wish to override these" >> ./tmp0
474         @echo "# values, add them to the last section" >> ./tmp0
475         @echo "# HOST AND TARGET INFO" >> ./tmp0
476         @echo "set host_os $(host_os)" >> ./tmp0
477         @echo "set host_alias $(host_alias)" >> ./tmp0
478         @echo "set host_cpu $(host_cpu)" >> ./tmp0
479         @echo "set host_vendor $(host_vendor)" >> ./tmp0
480         @echo "set target_os $(target_os)" >> ./tmp0
481         @echo "set target_alias $(target_alias)" >> ./tmp0
482         @echo "set target_cpu $(target_cpu)" >> ./tmp0
483         @echo "set target_vendor $(target_vendor)" >> ./tmp0
484         @echo "set host_triplet $(host_canonical)" >> ./tmp0
485         @echo "set target_triplet $(target_canonical)" >> ./tmp0
486         @echo "# DIRECTORY INFO" >> ./tmp0
487         @echo "set objdir `pwd`" >> ./tmp0
488         @echo "set tmpdir `cd $(testdir); pwd`" >> ./tmp0
489         @echo "" >> ./tmp0      
490         @echo "# LD DEPENDANCIES" >> ./tmp0     
491         @echo "set OFILES \"$(OFILES)\"" >> ./tmp0
492         @echo "set BFDLIB \"$(BFDLIB)\"" >> ./tmp0
493         @echo "set LIBIBERTY \"$(LIBIBERTY)\"" >> ./tmp0
494         @echo "set HOSTING_EMU \"$(HOSTING_EMU)\"" >> ./tmp0
495         @echo "set HOSTING_CRT0 \"$(HOSTING_CRT0)\"" >> ./tmp0
496         @echo "set HOSTING_LIBS \"$(HOSTING_LIBS)\"" >> ./tmp0
497         @echo "" >> ./tmp0      
498         @echo "## Variables generated by configure. Do Not Edit ##" >> ./tmp0
499         @cat ./tmp0 > site.exp
500         @cat site.bak | sed \
501                         -e '1,/^## Variables generated by.*##/ d' >> site.exp
502         -@rm -f ./tmp?
503
504 check: ld.new site.exp
505         $(RUNTEST) --tool ld \
506         --srcdir $(srcdir)/testsuite $(RUNTEST_FLAGS) \
507         CC="$(RUNTEST_CC)" CFLAGS="$(RUNTEST_CFLAGS)" \
508         CXX="$(RUNTEST_CXX)" CXXFLAGS="$(RUNTEST_CXXFLAGS)"
509
510 installcheck:
511
512 # Rules for testing by relinking ld itself.
513
514 ld-partial.o: ld.new
515         ./ld.new $(HOSTING_EMU) -o ld-partial.o -r $(OFILES)
516 ld1: ld-partial.o
517         ./ld.new $(HOSTING_EMU) -o ld1 $(HOSTING_CRT0) ld-partial.o $(BFDLIB) $(LIBIBERTY) $(HOSTING_LIBS)
518
519 ld1-full: ld.new
520         ./ld.new $(HOSTING_EMU) -o ld1-full $(HOSTING_CRT0) $(OFILES) $(BFDLIB) $(LIBIBERTY) $(HOSTING_LIBS)
521
522 ld2: ld1
523         ./ld1 $(HOSTING_EMU) -o ld2 $(HOSTING_CRT0) $(OFILES) $(BFDLIB) $(LIBIBERTY) $(HOSTING_LIBS)
524
525 ld3: ld2
526         ./ld2 $(HOSTING_EMU) -o ld3 $(HOSTING_CRT0) $(OFILES) $(BFDLIB) $(LIBIBERTY) $(HOSTING_LIBS)
527
528 bootstrap: ld3
529         cmp ld2 ld3
530
531 # A test program for C++ constructors and destructors.
532
533 cdtest: cdtest-main.o cdtest-func.o cdtest-foo.o ld.new
534         ./ld.new $(HOSTING_EMU) -o cdtest $(HOSTING_CRT0) \
535           cdtest-main.o cdtest-func.o cdtest-foo.o $(HOSTING_LIBS)
536
537 check-cdtest: cdtest $(srcdir)/cdtest.exp
538         ./cdtest >cdtest.out
539         diff $(srcdir)/cdtest.exp cdtest.out
540 # END OF CHECK TARGETS
541
542 # DOCUMENTATION TARGETS
543 # Manual configuration file; not usually attached to normal configuration,
544 # because almost all configs use "gen" version of manual.
545 #  Set DOCVER above to change.
546 configdoc.texi: ${DOCVER}-doc.texi
547         ln -s ${srcdir}/${DOCVER}-doc.texi ./configdoc.texi || \
548         ln ${srcdir}/${DOCVER}-doc.texi ./configdoc.texi || \
549         cp ${srcdir}/${DOCVER}-doc.texi ./configdoc.texi
550
551 # TeX output
552 dvi: ld.dvi
553 ld.dvi: $(srcdir)/ld.texinfo $(srcdir)/configdoc.texi
554         $(TEXI2DVI) $(srcdir)/ld.texinfo
555
556 ldint.dvi: $(srcdir)/ldint.texinfo
557         $(TEXI2DVI) $(srcdir)/ldint.texinfo
558
559 # info file for online browsing
560 ld.info: $(srcdir)/ld.texinfo configdoc.texi
561         $(MAKEINFO) -I$(BFDDIR)/doc -o ld.info $(srcdir)/ld.texinfo
562
563 ldint.info: $(srcdir)/ldint.texinfo
564         $(MAKEINFO) -o ldint.info $(srcdir)/ldint.texinfo
565
566 #separate targets for "ms", "me", and "mm" forms of roff doc
567 # Try to use a recent texi2roff.  v2 was put on prep in jan91.
568 # If you want an index, see texi2roff doc for postprocessing 
569 # and add -i to texi2roff invocations below.
570 # Workarounds for texi2roff-2 (probably fixed in later texi2roff's, delete
571 #    correspondint -e lines when later texi2roff's are current)
572 # + @ifinfo's deleted explicitly due to texi2roff-2 bug w nested constructs.
573 # + @c's deleted explicitly because texi2roff sees texinfo commands in them
574 # + @   (that's at-BLANK) not recognized by texi2roff, turned into blank
575 # + @alphaenumerate is ridiculously new, turned into @enumerate
576
577 ld.ms: $(srcdir)/ld.texinfo
578         sed -e '/\\input texinfo/d' \
579                 -e '/@c TEXI2ROFF-KILL/,/@c END TEXI2ROFF-KILL/d' \
580                 -e '/^@ifinfo/,/^@end ifinfo/d' \
581                 -e '/^@c/d' \
582                 -e 's/{.*,,/{/' \
583                 -e 's/@ / /g' \
584                 -e 's/^@alphaenumerate/@enumerate/g' \
585                 -e 's/^@end alphaenumerate/@end enumerate/g' \
586                 $(srcdir)/ld.texinfo | \
587         $(TEXI2ROFF) $(TEXI2OPT) -ms | \
588         sed -e 's/---/\\(em/g' \
589                 >>ld.ms 
590
591 # index for roff output
592 ld-index.ms: ld.ms
593         $(ROFF) -ms ld.ms 2>&1 1>/dev/null | \
594                 sed -e '/: warning:/d' | \
595                 texi2index >ld-index.ms
596
597 # roff output (-mm)
598 ld.mm: $(srcdir)/ld.texinfo
599         sed -e '/\\input texinfo/d' \
600                 -e '/@c TEXI2ROFF-KILL/,/@c END TEXI2ROFF-KILL/d' \
601                 -e '/^@ifinfo/,/^@end ifinfo/d' \
602                 -e '/^@c/d' \
603                 -e 's/{.*,,/{/' \
604                 -e '/@noindent/d' \
605                 -e 's/@ / /g' \
606                 -e 's/^@alphaenumerate/@enumerate/g' \
607                 -e 's/^@end alphaenumerate/@end enumerate/g' \
608                 $(srcdir)/ld.texinfo | \
609         $(TEXI2ROFF) $(TEXI2OPT) -mm | \
610         sed -e 's/---/\\(em/g' \
611         >ld.mm 
612
613 # index for roff output
614 ld-index.mm: ld.mm
615         $(ROFF) -mm ld.mm 2>&1 1>/dev/null | \
616                 sed -e '/: warning:/d' | \
617                 texi2index >ld-index.mm
618
619 # roff output (-me)
620 ld.me: $(srcdir)/ld.texinfo
621         sed -e '/\\input texinfo/d' \
622                 -e '/@c TEXI2ROFF-KILL/,/@c END TEXI2ROFF-KILL/d' \
623                 -e '/^@ifinfo/,/^@end ifinfo/d' \
624                 -e '/^@c/d' \
625                 -e 's/{.*,,/{/' \
626                 -e 's/@ / /g' \
627                 -e 's/^@alphaenumerate/@enumerate/g' \
628                 -e 's/^@end alphaenumerate/@end enumerate/g' \
629                 $(srcdir)/ld.texinfo | \
630         $(TEXI2ROFF) $(TEXI2OPT) -me | \
631         sed -e 's/---/\\(em/g' \
632                 >>ld.me 
633
634 # index for roff output
635 ld-index.me: ld.me
636         $(ROFF) -me ld.me 2>&1 1>/dev/null | \
637                 sed -e '/: warning:/d' | \
638                 texi2index >ld-index.me
639
640 stage1: force
641         -mkdir stage1
642         -mv -f $(STAGESTUFF) $(LD_PROG) stage1
643         -(cd stage1 ; ln -s $(LD_PROG) ld)
644
645 stage2: force
646         -mkdir stage2
647         -mv -f $(STAGESTUFF) $(LD_PROG) stage2
648         -(cd stage2 ; ln -s $(LD_PROG) ld)
649
650 stage3: force
651         -mkdir stage3
652         -mv -f $(STAGESTUFF) $(LD_PROG) stage3
653         -(cd stage3 ; ln -s $(LD_PROG) ld)
654
655 against=stage2
656
657 comparison: force
658         for i in $(STAGESTUFF) $(LD_PROG) ; do cmp $$i $(against)/$$i ; done
659
660 de-stage1: force
661         -(cd stage1 ; mv -f * ..)
662         -rm ld
663         -rmdir stage1
664
665 de-stage2: force
666         -(cd stage2 ; mv -f * ..)
667         -rm ld
668         -rmdir stage2
669
670 de-stage3: force
671         -(cd stage3 ; mv -f * ..)
672         -rm ld
673         -rmdir stage3
674
675 # Stuff that should be included in a distribution:
676 LDDISTSTUFF=ldgram.c ldgram.h ldlex.c
677 diststuff: $(LDDISTSTUFF)
678
679 mostlyclean:
680         -rm -f $(STAGESTUFF) ld.?? ld.??? ldlex.[qp]
681         -rm -f ld ld1 ld2 ld3 *.o y.output cdtest cdtest.out
682 clean: mostlyclean
683         -rm -f $(LD_PROG)
684 distclean: clean
685         -rm -fr Makefile config.status TAGS sysdep.h ldscripts site.exp
686 realclean: distclean
687         -rm -f $(LDDISTSTUFF)
688
689 lintlog:$(SOURCES) Makefile
690         $(LINT) -abhxzn  $(LINTFLAGS)  $(LINTSOURCES) \
691 | grep -v "pointer casts may be troublesome" \
692 | grep -v "possible pointer alignment problem" \
693 | grep -v "ignore" \
694 | grep -v "conversion from long may lose accuracy" \
695 | grep -v "warning: constant argument to NOT" \
696 | grep -v "enumeration type clash, operator CAST" \
697 | grep -v "warning: constant in conditional context"\
698 | grep -v "archive\.c"
699
700
701 TAGS:
702         etags -t $(srcdir)/*.[chly] *.[chly]
703
704
705 .PHONY: install
706 install: 
707         $(INSTALL_XFORM) ld.new $(bindir)/ld
708         $(INSTALL_XFORM1) $(srcdir)/ld.1 $(man1dir)/ld.1
709         for f in ldscripts/*; do \
710           $(INSTALL_DATA) $$f $(scriptdir)/$$f ; \
711         done
712         -n=`t='$(program_transform_name)'; echo ld | sed -e "" $$t`; \
713           rm -f $(tooldir)/bin/ld; \
714           ln $(bindir)/$$n $(tooldir)/bin/ld \
715            || $(INSTALL_PROGRAM) ld.new $(tooldir)/bin/ld
716
717 install-info: 
718         for i in ld.info* ; do \
719                 $(INSTALL_DATA) $$i $(infodir)/$$i ; \
720         done
721
722 clean-info:
723         -rm -rf *.info*
724
725 #-----------------------------------------------------------------------------
726 #               'STANDARD' GNU/960 TARGETS BELOW THIS POINT
727 #
728 # 'VERSION' file must be present and contain a string of the form "x.y"
729 #-----------------------------------------------------------------------------
730
731 ver960.c: FORCE
732         rm -f ver960.c
733         echo "char ${TARG}_ver[]= \"${TARG} `cat VERSION`, `date`\";" > ver960.c
734
735
736 # This target should be invoked before building a new release.
737 # 'VERSION' file must be present and contain a string of the form "x.y"
738 #
739 roll:
740         @V=`cat VERSION`                ; \
741         MAJ=`sed 's/\..*//' VERSION`    ; \
742         MIN=`sed 's/.*\.//' VERSION`    ; \
743         V=$$MAJ.`expr $$MIN + 1`        ; \
744         rm -f VERSION                   ; \
745         echo $$V >VERSION               ; \
746         echo Version $$V
747
748
749 dep: $(LDSOURCES)
750         mkdep $(CFLAGS) $?
751
752 # Dummy target to force execution of dependent targets.
753 #
754 force:
755
756 # Target to uncomment host-specific lines in this makefile.  Such lines must
757 # have the following string beginning in column 1: #__<hostname>__#
758 # Original Makefile is backed up as 'Makefile.old'.
759 #
760 # Invoke with:  make make HOST=xxx
761 #
762 make:
763         -@if test $(HOST)x = x ; then \
764                 echo '\aSpecify "make make HOST=???"'; \
765                 exit 1; \
766         fi ; \
767         grep -s "^#The next line was generated by 'make make'" Makefile; \
768         if test $$? = 0 ; then  \
769                 echo "\aMakefile has already been processed with 'make make'";\
770                 exit 1; \
771         fi ; \
772         mv -f Makefile Makefile.old; \
773         echo "#The next line was generated by 'make make'"       >Makefile ; \
774         echo "HOST=$(HOST)"                                     >>Makefile ; \
775         echo                                                    >>Makefile ; \
776         sed "s/^#__$(HOST)__#//" < Makefile.old                 >>Makefile
777
778 #\f
779
780 Makefile: $(srcdir)/Makefile.in $(host_makefile_frag) $(target_makefile_frag)
781         $(SHELL) ./config.status
782
783 ### mode:fundamental ***
784 ### Local Variables: ***
785 ### page-delimiter: "^#\f" ***
786 ### End: ***
787 ### end of file
788
789
790 # IF YOU PUT ANYTHING HERE IT WILL GO AWAY