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