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