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