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