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