1 # Makefile for the GNU linker ld (version 2)
2 # Copyright (C) 1989-1993 Free Software Foundation, Inc.
4 # This file is part of GNU ld..
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.
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.
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.
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
50 gcclibdir = $(libdir)/gcc/$(target_alias)
54 INSTALL = `cd $(srcdir); pwd`/../install.sh -c
55 INSTALL_PROGRAM = $(INSTALL)
56 INSTALL_DATA = $(INSTALL)
57 INSTALL_XFORM = $(INSTALL) -t='$(program_transform_name)'
58 INSTALL_XFORM1 = $(INSTALL_XFORM) -b=.1
67 BISON = `if [ -f ../bison/bison ] ; then echo ../bison/bison -y -L../bison/bison ; else echo bison -y ; fi`
68 LEX = `if [ -f ../flex/flex ] ; then echo ../flex/flex ; else echo flex ; fi`
70 #version=/`./../gcc/gcc -dumpversion`
73 # Seach path to override the default search path for -lfoo libraries.
74 # If LIB_PATH is empty, the ones in the script (if any) are left alone.
75 # (The default is usually /lib:usr/lib:/usr/local/lib, unless building
76 # a cross-linker, in which case the default is empty. See genscripts.sh.)
77 # Otherwise, they are replaced with the ones given in LIB_PATH,
78 # which may have the form: LIB_PATH=/lib:/usr/local/lib
81 BASEDIR = $(srcdir)/..
82 BFDDIR = $(BASEDIR)/bfd
83 INCDIR = $(BASEDIR)/include
84 INCLUDES = -I. -I$(srcdir) -I../bfd -I$(BFDDIR) -I$(INCDIR)
86 # What version of the manual to build
89 # Where to find texinfo.tex to format docn with TeX
90 TEXIDIR = $(srcdir)/../texinfo/fsf
92 # Where to find other docs needed to format with TeX
93 TEXINPUTS = $(TEXIDIR):$(BFDDIR)/doc:$(srcdir)
95 # Whether to get roff to put indexing entries on stderr
97 # You neeed this to generate ld-index.ms (or .mm or .me)
102 # Which roff program to use to generate index for texi2roff'd doc
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)
110 CXX = `if [ -f ../gcc/xgcc ] ; then \
111 echo ../gcc/xgcc -B../gcc/; \
114 CXXFLAGS = -fgnu-linker
116 # FIX_ME: using ../gcc/xgcc breaks the cdtest.
119 # Setup the testing framework, if you have one
122 RUNTEST_CC = `if [ -f ../gcc/xgcc ] ; then \
123 echo ../gcc/xgcc -B../gcc/; \
126 RUNTEST_CFLAGS = $(CFLAGS)
127 RUNTEST_CXX = `if [ -f ../gcc/xgcc ] ; then \
128 echo ../gcc/xgcc -B../gcc/; \
131 # FIX_ME: using ../gcc/xgcc breaks the cdtest.
133 RUNTEST_CXXFLAGS = $(CXXFLAGS)
137 ### Host, target, and site specific Makefile fragments come in here.
140 LINTFLAGS = $(INCLUDES) $(EXTRA_DEF)
142 # The .cc suffix is used by `make check'.
144 .SUFFIXES: .y $(SUFFIXES) .cc
146 # Suppress smart makes who think they know how to automake Yacc files
150 $(CXX) -c -I$(srcdir) $(CXXFLAGS) $(CFLAGS) $<
153 $(CC) -c $(INCLUDES) $(HDEFINES) $(TDEFINES) $(CDEFINES) $(CFLAGS) $<
155 # go directly to ld.new in case this ld isn't capable of
156 # linking native object on this host. It can be renamed on
161 BFDLIB = ../bfd/libbfd.a
162 LIBIBERTY = ../libiberty/libiberty.a
164 ALL_EMULATIONS=em_lnk960.o em_sun3.o em_i386aout.o em_go32.o \
165 em_m88kbcs.o em_a29k.o em_news.o em_hp300bsd.o em_hp3hpux.o \
166 em_h8300.o em_h8300h.o em_ebmon29k.o em_sun4.o em_gld960.o \
167 em_m68kcoff.o em_st2000.o em_sa29200.o \
168 em_vanilla.o em_i386coff.o em_z8ksim.o em_mipslit.o em_i386bsd.o \
169 em_mipsbig.o em_mipsbsd.o em_mipsidt.o em_vax.o em_h8500.o \
170 em_hppaosf.o em_mipsidtl.o em_sh.o \
173 # This is now set by configure.in.
174 #EMULATION_OFILES=${ALL_EMULATIONS}
176 OFILES= ldgram.o ldlex.o lexsup.o ldlang.o mri.o ldctor.o ldmain.o ldindr.o \
177 ldwarn.o ldwrite.o ldexp.o ldemul.o ldver.o ldmisc.o ldsym.o \
178 ldfile.o relax.o lderror.o ${EMULATION_OFILES}
180 HEADERS=config.h ldmain.h ldmain.h ldwarn.h ldmisc.h ldindr.h \
181 ldsym.h ldctor.h ldlang.h ldexp.h \
182 ldlex.h ldwrite.h ldver.h ldemul.h ldfile.h ldgram.h ld.h
186 LDCSOURCES=ldlang.c lexsup.c ldctor.c mri.c ldindr.c ldmain.c ldwrite.c ldwarn.c ldlnk960.c \
187 em_gld.c em_sun3.c em_go32.c em_m88k.c em_ebmon29k.c em_hppaosf.c \
188 ldgld960.c ldemul.c ldver.c ldmisc.c ldexp.c ldsym.c ldfile.c \
191 GENERATED_SOURCES=ldgram.c ldlex.c em_*.c ldemul-list.h
192 GENERATED_HEADERS=ldgram.h ldemul-list.h
194 LDSOURCES=$(LDCSOURCES) ldgram.y ldlex.l ldgram.h
196 BFDSOURCES=../../bfd/common/*.c
198 SOURCES= $(LDSOURCES) $(BFDSOURCES)
199 LINTSOURCES= $(LDCSOURCES) $(BFDSOURCES) $(GENERATED_SOURCES)
201 STAGESTUFF = *.o ldscripts/* $(GENERATED_SOURCES) $(GENERATED_HEADERS)
207 ldgram.h ldgram.c: ldgram.y
208 $(BISON) $(BISONFLAGS) -d $(srcdir)/ldgram.y
209 mv -f y.tab.c ldgram.c
210 mv -f y.tab.h ldgram.h
212 # EMUL is the name of a file in the emulparams subdir, without the .sh.
213 DEF_EMUL = ` if [ -z "$(EMUL)" ] ; then \
214 echo "you must set a default emulation" 1>&2 ; \
217 echo -DDEFAULT_EMULATION='"$(EMUL)"' ; \
220 ldmain.o: ldmain.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \
221 $(INCDIR)/obstack.h ../bfd/sysdep.h $(BFDDIR)/hosts/std-host.h \
222 $(INCDIR)/fopen-same.h config.h ld.h \
223 ldmain.h ldmisc.h ldwrite.h ./ldgram.h \
224 ldsym.h ldlang.h ldemul.h ldlex.h \
225 ldfile.h ldindr.h ldwarn.h ldctor.h \
227 $(CC) -c $(INCLUDES) $(HDEFINES) $(TDEFINES) $(CDEFINES) $(DEF_EMUL) -DSCRIPTDIR='"$(scriptdir)"' $(CFLAGS) $<
229 ldemul-list.h: Makefile
230 (echo "/* This file is automatically generated. DO NOT EDIT! */";\
231 for f in `echo " " ${EMULATION_OFILES} "" \
232 | sed -e 's/em_/ld/g' -e 's/ ld/ /g' -e 's/[.]o//g'`; do \
233 echo "extern ld_emulation_xfer_type ld_$${f}_emulation;"; \
236 echo "#define EMULATION_LIST \\";\
237 for f in `echo " " ${EMULATION_OFILES} "" \
238 | sed -e 's/em_/ld/g' -e 's/ ld/ /g' -e 's/[.]o//g'`; do \
239 echo " &ld_$${f}_emulation, \\"; \
241 echo " 0") >ldemul-list.h
243 ldlex.c: ldlex.l ldgram.h
244 $(LEX) -I -Cem $(srcdir)/ldlex.l
247 # These all start with em_ so 'make clean' can find them.
249 GENSCRIPTS=sh $(srcdir)/genscripts.sh ${srcdir} ${libdir} ${host_alias} ${target_alias} ${EMUL}
250 GEN_DEPENDS=$(srcdir)/genscripts.sh
252 em_sun4.c: $(srcdir)/emulparams/sun4.sh \
253 $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/aout.sc ${GEN_DEPENDS}
255 em_sun3.c: $(srcdir)/emulparams/sun3.sh \
256 $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/aout.sc ${GEN_DEPENDS}
258 em_go32.c: $(srcdir)/emulparams/go32.sh \
259 $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/aout.sc ${GEN_DEPENDS}
261 em_news.c: $(srcdir)/emulparams/news.sh \
262 $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/aout.sc ${GEN_DEPENDS}
264 em_vax.c: $(srcdir)/emulparams/vax.sh \
265 $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/aout.sc ${GEN_DEPENDS}
267 em_hp300bsd.c: $(srcdir)/emulparams/hp300bsd.sh \
268 $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/aout.sc ${GEN_DEPENDS}
269 ${GENSCRIPTS} hp300bsd
270 em_hp3hpux.c: $(srcdir)/emulparams/hp3hpux.sh \
271 $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/aout.sc ${GEN_DEPENDS}
272 ${GENSCRIPTS} hp3hpux
273 em_hppaosf.c: $(srcdir)/emulparams/hppaosf.sh \
274 $(srcdir)/emultempl/hppaosf.em $(srcdir)/scripttempl/hppaosf.sc ${GEN_DEPENDS}
275 ${GENSCRIPTS} hppaosf
276 em_i386aout.c: $(srcdir)/emulparams/i386aout.sh \
277 $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/aout.sc ${GEN_DEPENDS}
278 ${GENSCRIPTS} i386aout
279 em_ebmon29k.c: $(srcdir)/emulparams/ebmon29k.sh \
280 $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/ebmon29k.sc ${GEN_DEPENDS}
281 ${GENSCRIPTS} ebmon29k
282 em_sa29200.c: $(srcdir)/emulparams/sa29200.sh \
283 $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/sa29200.sc ${GEN_DEPENDS}
284 ${GENSCRIPTS} sa29200
285 em_a29k.c: $(srcdir)/emulparams/a29k.sh \
286 $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/a29k.sc ${GEN_DEPENDS}
288 em_m88kbcs.c: $(srcdir)/emulparams/m88kbcs.sh \
289 $(srcdir)/emultempl/m88kbcs.em $(srcdir)/scripttempl/m88kbcs.sc ${GEN_DEPENDS}
290 ${GENSCRIPTS} m88kbcs
291 em_h8300.c: $(srcdir)/emulparams/h8300.sh \
292 $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/h8300.sc ${GEN_DEPENDS}
294 em_h8300h.c: $(srcdir)/emulparams/h8300h.sh \
295 $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/h8300h.sc ${GEN_DEPENDS}
297 em_h8500.c: $(srcdir)/emulparams/h8500.sh \
298 $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/h8500.sc ${GEN_DEPENDS}
300 em_sh.c: $(srcdir)/emulparams/sh.sh \
301 $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/sh.sc ${GEN_DEPENDS}
303 em_st2000.c: $(srcdir)/emulparams/st2000.sh \
304 $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/st2000.sc ${GEN_DEPENDS}
306 em_z8ksim.c: $(srcdir)/emulparams/z8ksim.sh \
307 $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/z8ksim.sc ${GEN_DEPENDS}
309 em_vanilla.c: $(srcdir)/emulparams/vanilla.sh \
310 $(srcdir)/emultempl/vanilla.em $(srcdir)/scripttempl/vanilla.sc ${GEN_DEPENDS}
311 ${GENSCRIPTS} vanilla
312 em_lnk960.c: $(srcdir)/emulparams/lnk960.sh \
313 $(srcdir)/emultempl/lnk960.em $(srcdir)/scripttempl/i960.sc ${GEN_DEPENDS}
315 em_gld960.c: $(srcdir)/emulparams/gld960.sh \
316 $(srcdir)/emultempl/gld960.em $(srcdir)/scripttempl/i960.sc ${GEN_DEPENDS}
318 em_m68kcoff.c: $(srcdir)/emulparams/m68kcoff.sh \
319 $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/m68kcoff.sc ${GEN_DEPENDS}
320 ${GENSCRIPTS} m68kcoff
321 em_i386coff.c: $(srcdir)/emulparams/i386coff.sh \
322 $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/i386coff.sc ${GEN_DEPENDS}
323 ${GENSCRIPTS} i386coff
324 em_mipslit.c: $(srcdir)/emulparams/mipslit.sh \
325 $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/mips.sc ${GEN_DEPENDS}
326 ${GENSCRIPTS} mipslit
327 em_i386bsd.c: $(srcdir)/emulparams/i386bsd.sh \
328 $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/aout.sc ${GEN_DEPENDS}
329 ${GENSCRIPTS} i386bsd
330 em_mipsbig.c: $(srcdir)/emulparams/mipsbig.sh \
331 $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/mips.sc ${GEN_DEPENDS}
332 ${GENSCRIPTS} mipsbig
333 em_mipsbsd.c: $(srcdir)/emulparams/mipsbsd.sh \
334 $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/aout.sc ${GEN_DEPENDS}
335 ${GENSCRIPTS} mipsbsd
336 em_mipsidt.c: $(srcdir)/emulparams/mipsidt.sh \
337 $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/mips.sc ${GEN_DEPENDS}
338 ${GENSCRIPTS} mipsidt
339 em_mipsidtl.c: $(srcdir)/emulparams/mipsidtl.sh \
340 $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/mips.sc ${GEN_DEPENDS}
341 ${GENSCRIPTS} mipsidtl
343 $(LD_PROG): $(OFILES) $(BFDLIB) $(LIBIBERTY)
344 $(CC) $(INCLUDES) $(HDEFINES) $(TDEFINES) $(CDEFINES) $(LDFLAGS) -o $(LD_PROG) $(OFILES) $(BFDLIB) $(LIBIBERTY) $(LOADLIBES)
346 # This list of dependencies was generated by doing a make with gcc -MM
347 # saving the output in a file and removing the gcc commands
348 # changing "../../devo/ld/../bfd" to "$(BFDDIR)"
349 # removing "../../devo/ld/"
350 # changing "../include" to "$(INCDIR)"
352 ldgram.o: ldgram.c ../bfd/bfd.h $(INCDIR)/ansidecl.h $(INCDIR)/obstack.h \
353 ../bfd/sysdep.h $(BFDDIR)/hosts/std-host.h $(INCDIR)/fopen-same.h \
354 ld.h ldexp.h ldver.h ldlang.h \
355 ldemul.h ldfile.h ldmisc.h mri.h
356 ldlex.o: ldlex.c ../bfd/bfd.h $(INCDIR)/obstack.h ./ldgram.h
357 lexsup.o: lexsup.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \
358 $(INCDIR)/obstack.h ../bfd/sysdep.h $(BFDDIR)/hosts/std-host.h \
359 $(INCDIR)/fopen-same.h ldlex.h ld.h \
360 ldexp.h ./ldgram.h ldmisc.h
361 ldlang.o: ldlang.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \
362 $(INCDIR)/obstack.h ../bfd/sysdep.h $(BFDDIR)/hosts/std-host.h \
363 $(INCDIR)/fopen-same.h ld.h ldmain.h \
364 ldsym.h ./ldgram.h ldwarn.h ldlang.h \
365 ldexp.h ldemul.h ldlex.h ldmisc.h \
367 mri.o: mri.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \
368 $(INCDIR)/obstack.h ../bfd/sysdep.h $(BFDDIR)/hosts/std-host.h \
369 $(INCDIR)/fopen-same.h ld.h ldlang.h \
370 mri.h ./ldgram.h ldexp.h
371 ldctor.o: ldctor.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \
372 $(INCDIR)/obstack.h ../bfd/sysdep.h $(BFDDIR)/hosts/std-host.h \
373 $(INCDIR)/fopen-same.h ld.h ldlang.h \
374 ldsym.h ldmisc.h ldexp.h ./ldgram.h
375 ldmain.o: ldmain.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \
376 $(INCDIR)/obstack.h ../bfd/sysdep.h $(BFDDIR)/hosts/std-host.h \
377 $(INCDIR)/fopen-same.h config.h ld.h \
378 ldmain.h ldmisc.h ldwrite.h ./ldgram.h \
379 ldsym.h ldlang.h ldemul.h ldlex.h \
380 ldfile.h ldindr.h ldwarn.h ldctor.h \
382 ldindr.o: ldindr.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \
383 $(INCDIR)/obstack.h ../bfd/sysdep.h $(BFDDIR)/hosts/std-host.h \
384 $(INCDIR)/fopen-same.h ld.h ldsym.h \
386 ldwarn.o: ldwarn.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \
387 $(INCDIR)/obstack.h ../bfd/sysdep.h $(BFDDIR)/hosts/std-host.h \
388 $(INCDIR)/fopen-same.h ldsym.h ldwarn.h \
390 ldwrite.o: ldwrite.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \
391 $(INCDIR)/obstack.h ../bfd/sysdep.h $(BFDDIR)/hosts/std-host.h \
392 $(INCDIR)/fopen-same.h ldlang.h ld.h \
393 ldwrite.h ldmisc.h ldsym.h ./ldgram.h \
395 ldexp.o: ldexp.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \
396 $(INCDIR)/obstack.h ../bfd/sysdep.h $(BFDDIR)/hosts/std-host.h \
397 $(INCDIR)/fopen-same.h ld.h ldmain.h \
398 ldmisc.h ldexp.h ./ldgram.h ldsym.h \
400 ldemul.o: ldemul.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \
401 $(INCDIR)/obstack.h ../bfd/sysdep.h $(BFDDIR)/hosts/std-host.h \
402 $(INCDIR)/fopen-same.h config.h ld.h \
403 ldemul.h ldmisc.h ./ldemul-list.h
404 ldver.o: ldver.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \
405 $(INCDIR)/obstack.h ../bfd/sysdep.h $(BFDDIR)/hosts/std-host.h \
406 $(INCDIR)/fopen-same.h ldver.h ldemul.h
407 ldmisc.o: ldmisc.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \
408 $(INCDIR)/obstack.h ../bfd/sysdep.h $(BFDDIR)/hosts/std-host.h \
409 $(INCDIR)/fopen-same.h ld.h ldmisc.h \
411 ldsym.o: ldsym.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \
412 $(INCDIR)/obstack.h ../bfd/sysdep.h $(BFDDIR)/hosts/std-host.h \
413 $(INCDIR)/fopen-same.h ld.h ldsym.h \
415 ldfile.o: ldfile.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \
416 $(INCDIR)/obstack.h ../bfd/sysdep.h $(BFDDIR)/hosts/std-host.h \
417 $(INCDIR)/fopen-same.h ldmisc.h ldlang.h \
419 relax.o: relax.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \
420 $(INCDIR)/obstack.h $(BFDDIR)/seclet.h $(INCDIR)/coff/internal.h \
421 ../bfd/sysdep.h $(BFDDIR)/hosts/std-host.h $(INCDIR)/fopen-same.h \
422 ldlang.h ld.h ldwrite.h ldmisc.h \
423 ldsym.h ./ldgram.h relax.h
424 lderror.o: lderror.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \
425 $(INCDIR)/obstack.h ../bfd/sysdep.h $(BFDDIR)/hosts/std-host.h \
426 $(INCDIR)/fopen-same.h $(BFDDIR)/seclet.h ld.h \
429 # CYGNUS LOCAL targets.
430 # These targets are for the dejagnu testsuites. The file site.exp
431 # contains global variables that all the testsuites will use.
432 # There is a current debate as to how and where to generate test
433 # outputs. Rob feels each test should be built in $(objdir) with
434 # a unique name. Cassidy feels that we should create a directory
435 # called $(objdir)/tmpdir and do the work there. This way, there
436 # is no potential conflict with existing objects, ie: as there
437 # was in the past with loop.o and flow.o, and, there is no chance
438 # of filling /tmp, which would cause other problems. Lastly, this
439 # allow retention of the testcase name making debugging easier.
441 testdir = $(objdir)/tmpdir
443 site.exp: ./config.status Makefile
444 @if [ -d $(testdir) ]; then true; else mkdir $(testdir); fi
445 @echo "Making a new config file..."
448 @mv site.exp site.bak
449 @echo "## variables are automatically generated by make ##" > ./tmp0
450 @echo "# Do not edit here. If you wish to override these" >> ./tmp0
451 @echo "# values, add them to the last section" >> ./tmp0
452 @echo "# HOST AND TARGET INFO" >> ./tmp0
453 @echo "set host_os $(host_os)" >> ./tmp0
454 @echo "set host_alias $(host_alias)" >> ./tmp0
455 @echo "set host_cpu $(host_cpu)" >> ./tmp0
456 @echo "set host_vendor $(host_vendor)" >> ./tmp0
457 @echo "set target_os $(target_os)" >> ./tmp0
458 @echo "set target_alias $(target_alias)" >> ./tmp0
459 @echo "set target_cpu $(target_cpu)" >> ./tmp0
460 @echo "set target_vendor $(target_vendor)" >> ./tmp0
461 @echo "set host_triplet $(host_canonical)" >> ./tmp0
462 @echo "set target_triplet $(target_canonical)" >> ./tmp0
463 @echo "# DIRECTORY INFO" >> ./tmp0
464 @echo "set objdir `pwd`" >> ./tmp0
465 @echo "set tmpdir `cd $(testdir); pwd`" >> ./tmp0
467 @echo "# LD DEPENDANCIES" >> ./tmp0
468 @echo "set OFILES \"$(OFILES)\"" >> ./tmp0
469 @echo "set BFDLIB \"$(BFDLIB)\"" >> ./tmp0
470 @echo "set LIBIBERTY \"$(LIBIBERTY)\"" >> ./tmp0
471 @echo "set HOSTING_EMU \"$(HOSTING_EMU)\"" >> ./tmp0
472 @echo "set HOSTING_CRT0 \"$(HOSTING_CRT0)\"" >> ./tmp0
473 @echo "set HOSTING_LIBS \"$(HOSTING_LIBS)\"" >> ./tmp0
475 @echo "## Variables generated by configure. Do Not Edit ##" >> ./tmp0
476 @cat ./tmp0 > site.exp
477 @cat site.bak | sed \
478 -e '1,/^## Variables generated by.*##/ d' >> site.exp
481 check: ld.new site.exp
482 $(RUNTEST) --tool ld \
483 --srcdir $(srcdir)/testsuite $(RUNTEST_FLAGS) \
484 CC="$(RUNTEST_CC)" CFLAGS="$(RUNTEST_CFLAGS)" \
485 CXX="$(RUNTEST_CXX)" CXXFLAGS="$(RUNTEST_CXXFLAGS)"
489 # Rules for testing by relinking ld itself.
492 ./ld.new $(HOSTING_EMU) -o ld-partial.o -r $(OFILES)
494 ./ld.new $(HOSTING_EMU) -o ld1 $(HOSTING_CRT0) ld-partial.o $(BFDLIB) $(LIBIBERTY) $(HOSTING_LIBS)
497 ./ld.new $(HOSTING_EMU) -o ld1-full $(HOSTING_CRT0) $(OFILES) $(BFDLIB) $(LIBIBERTY) $(HOSTING_LIBS)
500 ./ld1 $(HOSTING_EMU) -o ld2 $(HOSTING_CRT0) $(OFILES) $(BFDLIB) $(LIBIBERTY) $(HOSTING_LIBS)
503 ./ld2 $(HOSTING_EMU) -o ld3 $(HOSTING_CRT0) $(OFILES) $(BFDLIB) $(LIBIBERTY) $(HOSTING_LIBS)
508 # A test program for C++ constructors and destructors.
510 cdtest: cdtest-main.o cdtest-func.o cdtest-foo.o ld.new
511 ./ld.new $(HOSTING_EMU) -o cdtest $(HOSTING_CRT0) \
512 cdtest-main.o cdtest-func.o cdtest-foo.o $(HOSTING_LIBS)
514 check-cdtest: cdtest $(srcdir)/cdtest.exp
516 diff $(srcdir)/cdtest.exp cdtest.out
517 # END OF CHECK TARGETS
519 # DOCUMENTATION TARGETS
520 # Manual configuration file; not usually attached to normal configuration,
521 # because almost all configs use "gen" version of manual.
522 # Set DOCVER above to change.
523 configdoc.texi: ${DOCVER}-doc.texi
524 ln -s ${srcdir}/${DOCVER}-doc.texi ./configdoc.texi || \
525 ln ${srcdir}/${DOCVER}-doc.texi ./configdoc.texi || \
526 cp ${srcdir}/${DOCVER}-doc.texi ./configdoc.texi
530 ld.dvi: $(srcdir)/ld.texinfo $(srcdir)/configdoc.texi
531 $(TEXI2DVI) $(srcdir)/ld.texinfo
533 ldint.dvi: $(srcdir)/ldint.texinfo
534 $(TEXI2DVI) $(srcdir)/ldint.texinfo
536 # info file for online browsing
537 ld.info: $(srcdir)/ld.texinfo configdoc.texi
538 $(MAKEINFO) -I$(BFDDIR)/doc -o ld.info $(srcdir)/ld.texinfo
540 ldint.info: $(srcdir)/ldint.texinfo
541 $(MAKEINFO) -o ldint.info $(srcdir)/ldint.texinfo
543 #separate targets for "ms", "me", and "mm" forms of roff doc
544 # Try to use a recent texi2roff. v2 was put on prep in jan91.
545 # If you want an index, see texi2roff doc for postprocessing
546 # and add -i to texi2roff invocations below.
547 # Workarounds for texi2roff-2 (probably fixed in later texi2roff's, delete
548 # correspondint -e lines when later texi2roff's are current)
549 # + @ifinfo's deleted explicitly due to texi2roff-2 bug w nested constructs.
550 # + @c's deleted explicitly because texi2roff sees texinfo commands in them
551 # + @ (that's at-BLANK) not recognized by texi2roff, turned into blank
552 # + @alphaenumerate is ridiculously new, turned into @enumerate
554 ld.ms: $(srcdir)/ld.texinfo
555 sed -e '/\\input texinfo/d' \
556 -e '/@c TEXI2ROFF-KILL/,/@c END TEXI2ROFF-KILL/d' \
557 -e '/^@ifinfo/,/^@end ifinfo/d' \
561 -e 's/^@alphaenumerate/@enumerate/g' \
562 -e 's/^@end alphaenumerate/@end enumerate/g' \
563 $(srcdir)/ld.texinfo | \
564 $(TEXI2ROFF) $(TEXI2OPT) -ms | \
565 sed -e 's/---/\\(em/g' \
568 # index for roff output
570 $(ROFF) -ms ld.ms 2>&1 1>/dev/null | \
571 sed -e '/: warning:/d' | \
572 texi2index >ld-index.ms
575 ld.mm: $(srcdir)/ld.texinfo
576 sed -e '/\\input texinfo/d' \
577 -e '/@c TEXI2ROFF-KILL/,/@c END TEXI2ROFF-KILL/d' \
578 -e '/^@ifinfo/,/^@end ifinfo/d' \
583 -e 's/^@alphaenumerate/@enumerate/g' \
584 -e 's/^@end alphaenumerate/@end enumerate/g' \
585 $(srcdir)/ld.texinfo | \
586 $(TEXI2ROFF) $(TEXI2OPT) -mm | \
587 sed -e 's/---/\\(em/g' \
590 # index for roff output
592 $(ROFF) -mm ld.mm 2>&1 1>/dev/null | \
593 sed -e '/: warning:/d' | \
594 texi2index >ld-index.mm
597 ld.me: $(srcdir)/ld.texinfo
598 sed -e '/\\input texinfo/d' \
599 -e '/@c TEXI2ROFF-KILL/,/@c END TEXI2ROFF-KILL/d' \
600 -e '/^@ifinfo/,/^@end ifinfo/d' \
604 -e 's/^@alphaenumerate/@enumerate/g' \
605 -e 's/^@end alphaenumerate/@end enumerate/g' \
606 $(srcdir)/ld.texinfo | \
607 $(TEXI2ROFF) $(TEXI2OPT) -me | \
608 sed -e 's/---/\\(em/g' \
611 # index for roff output
613 $(ROFF) -me ld.me 2>&1 1>/dev/null | \
614 sed -e '/: warning:/d' | \
615 texi2index >ld-index.me
619 -mv -f $(STAGESTUFF) $(LD_PROG) stage1
620 -(cd stage1 ; ln -s $(LD_PROG) ld)
624 -mv -f $(STAGESTUFF) $(LD_PROG) stage2
625 -(cd stage2 ; ln -s $(LD_PROG) ld)
629 -mv -f $(STAGESTUFF) $(LD_PROG) stage3
630 -(cd stage3 ; ln -s $(LD_PROG) ld)
635 for i in $(STAGESTUFF) $(LD_PROG) ; do cmp $$i $(against)/$$i ; done
638 -(cd stage1 ; mv -f * ..)
643 -(cd stage2 ; mv -f * ..)
648 -(cd stage3 ; mv -f * ..)
652 # Stuff that should be included in a distribution:
653 LDDISTSTUFF=ldgram.c ldgram.h ldlex.c
654 diststuff: $(LDDISTSTUFF)
657 -rm -f $(STAGESTUFF) ld.?? ld.??? ldlex.[qp]
658 -rm -f ld ld1 ld2 ld3 *.o y.output cdtest cdtest.out
662 -rm -fr Makefile config.status TAGS sysdep.h ldscripts site.exp
664 -rm -f $(LDDISTSTUFF)
666 lintlog:$(SOURCES) Makefile
667 $(LINT) -abhxzn $(LINTFLAGS) $(LINTSOURCES) \
668 | grep -v "pointer casts may be troublesome" \
669 | grep -v "possible pointer alignment problem" \
671 | grep -v "conversion from long may lose accuracy" \
672 | grep -v "warning: constant argument to NOT" \
673 | grep -v "enumeration type clash, operator CAST" \
674 | grep -v "warning: constant in conditional context"\
675 | grep -v "archive\.c"
679 etags -t $(srcdir)/*.[chly] *.[chly]
684 $(INSTALL_XFORM) ld.new $(bindir)/ld
685 $(INSTALL_XFORM1) $(srcdir)/ld.1 $(man1dir)/ld.1
686 for f in ldscripts/*; do \
687 $(INSTALL_DATA) $$f $(scriptdir)/$$f ; \
689 -n=`t='$(program_transform_name)'; echo ld | sed -e "" $$t`; \
690 rm -f $(tooldir)/bin/ld; \
691 ln $(bindir)/$$n $(tooldir)/bin/ld \
692 || $(INSTALL_PROGRAM) ld.new $(tooldir)/bin/ld
695 for i in ld.info* ; do \
696 $(INSTALL_DATA) $$i $(infodir)/$$i ; \
702 #-----------------------------------------------------------------------------
703 # 'STANDARD' GNU/960 TARGETS BELOW THIS POINT
705 # 'VERSION' file must be present and contain a string of the form "x.y"
706 #-----------------------------------------------------------------------------
710 echo "char ${TARG}_ver[]= \"${TARG} `cat VERSION`, `date`\";" > ver960.c
713 # This target should be invoked before building a new release.
714 # 'VERSION' file must be present and contain a string of the form "x.y"
718 MAJ=`sed 's/\..*//' VERSION` ; \
719 MIN=`sed 's/.*\.//' VERSION` ; \
720 V=$$MAJ.`expr $$MIN + 1` ; \
722 echo $$V >VERSION ; \
729 # Dummy target to force execution of dependent targets.
733 # Target to uncomment host-specific lines in this makefile. Such lines must
734 # have the following string beginning in column 1: #__<hostname>__#
735 # Original Makefile is backed up as 'Makefile.old'.
737 # Invoke with: make make HOST=xxx
740 -@if test $(HOST)x = x ; then \
741 echo '
\aSpecify "make make HOST=???"'; \
744 grep -s "^#The next line was generated by 'make make'" Makefile; \
745 if test $$? = 0 ; then \
746 echo "
\aMakefile has already been processed with 'make make'";\
749 mv -f Makefile Makefile.old; \
750 echo "#The next line was generated by 'make make'" >Makefile ; \
751 echo "HOST=$(HOST)" >>Makefile ; \
753 sed "s/^#__$(HOST)__#//" < Makefile.old >>Makefile
757 Makefile: $(srcdir)/Makefile.in $(host_makefile_frag) $(target_makefile_frag)
758 $(SHELL) ./config.status
760 ### mode:fundamental ***
761 ### Local Variables: ***
762 ### page-delimiter: "^#
\f" ***
767 # IF YOU PUT ANYTHING HERE IT WILL GO AWAY