fix installation problem which forced a relink of ld on 2nd and subsequent installation
[deliverable/binutils-gdb.git] / ld / Makefile.in
1 # Makefile for the GNU linker ld (version 2)
2 # Copyright (C) 1989-1992 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
23 prefix = /usr/local
24
25 program_prefix =
26 program_suffix =
27 exec_prefix = $(prefix)
28 bindir = $(exec_prefix)/bin
29 libdir = $(exec_prefix)/lib
30 tooldir = $(bindir)
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
46 gcclibdir = $(libdir)/gcc/$(target_alias)
47
48 SHELL = /bin/sh
49
50 INSTALL = install -c
51 INSTALL_PROGRAM = $(INSTALL)
52 INSTALL_DATA = $(INSTALL)
53 AR = ar
54 AR_FLAGS = qv
55 CFLAGS = -g
56 MAKEINFO = makeinfo
57 RANLIB = ranlib
58 HOST_CC=$(CC)
59 BISON = `if [ -f ../bison/bison ] ; then echo ../bison/bison -y -L../bison/bison ; else echo bison -y ; fi`
60 LEX = `if [ -f ../flex/flex ] ; then echo ../flex/flex -S../flex/flex.skel ; else echo flex ; fi`
61
62 #version=/`./../gcc/gcc -dumpversion`
63 version=
64
65 # Seach path to override the default search path for -lfoo libraries.
66 # If LIB_PATH is empty, the ones in the script (if any) are left alone.
67 # Otherwise, they are replaced with the ones given in LIB_PATH,
68 # which may have the form: LIB_PATH=/lib:/usr/local/lib
69 LIB_PATH =
70
71 BASEDIR = ../..
72 INCLUDE = $(srcdir)/../include
73 INCLUDES = -I. -I$(srcdir) -I$(INCLUDE)
74
75 # Where to find texinfo.tex to format docn with TeX
76 TEXIDIR = $(srcdir)/../texinfo/fsf
77
78 # Whether to get roff to put indexing entries on stderr
79 TEXI2OPT =
80 # You neeed this to generate ld-index.ms (or .mm or .me)
81 # TEXI2OPT = -i
82
83 TEXI2ROFF=texi2roff
84
85 # Which roff program to use to generate index for texi2roff'd doc
86 ROFF = groff
87
88 #stuff for self hosting (can be overridden in config file).
89 HOSTING_CRT0=/lib/crt0.o
90 HOSTING_LIBS=`if [ -f ../gcc/libgcc.a ] ; then echo ../gcc/libgcc.a ; else echo $(libdir)/libgcc.a; fi` -lc
91 HOSTING_EMU=LDEMULATION=$(EMUL); export LDEMULATION
92
93 ### Host, target, and site specific Makefile fragments come in here.
94 ###
95
96 LINTFLAGS = $(INCLUDES) $(EXTRA_DEF)
97
98 .SUFFIXES: .y .x .xr .xu .xn .xbn .sc .scu .scr .scn $(SUFFIXES)
99
100 .c.o:
101 $(CC) -c $(CFLAGS) $(INCLUDES) $(HDEFINES) $(TDEFINES) $(CDEFINES) $<
102
103 # go directly to ld.new in case this ld isn't capable of
104 # linking native object on this host. It can be renamed on
105 # install.
106 LD_PROG = ld.new
107
108 # for self hosting
109 BFDLIB=./../bfd/libbfd.a
110 LIBIBERTY=./../libiberty/libiberty.a
111
112 ALL_EMULATIONS=ld__lnk960.o ld__sun3.o ld__i386aout.o \
113 ld__go32.o ld__m88kbcs.o ld__a29k.o ld__news.o ld__hp300bsd.o ld__h8300hms.o ld__ebmon29k.o \
114 ld__sun4.o ld__gld960.o ld__vanilla.o ld__h8300xray.o ld__st2000.o ld__sa29200.o
115
116 EMULATION_OFILES=${ALL_EMULATIONS}
117 #EMULATION_OFILES=ld__${EMUL}.o ${OTHER_EMULATIONS}
118
119 OFILES= ldgram.o ldlex.o lexsup.o ldlang.o mri.o ldctor.o ldmain.o ldindr.o \
120 ldwarn.o ldwrite.o ldexp.o ldemul.o ldver.o ldmisc.o ldsym.o \
121 ldfile.o relax.o lderror.o cplus-dem.o ${EMULATION_OFILES}
122
123 HEADERS=config.h ldmain.h ldmain.h ldwarn.h ldmisc.h ldindr.h \
124 ldsym.h ldctor.h ldlang.h ldexp.h \
125 ldlex.h ldwrite.h ldver.h ldemul.h ldfile.h ldgram.h ld.h
126
127 MANSOURCES=ld.tex
128
129 LDCSOURCES=ldlang.c lexsup.c ldctor.c mri.c ldindr.c ldmain.c ldwrite.c ldwarn.c ldlnk960.c \
130 ld__gld.c ld__sun3.c ld__go32.c ld__m88k.c ld__ebmon29k.c \
131 ldgld960.c ldemul.c ldver.c ldmisc.c ldexp.c ldsym.c ldfile.c \
132 relax.c lderror.c cplus-dem.c
133
134 GENERATED_SOURCES=ldgram.c ldlex.c ld__*.c ldemul-list.h
135 GENERATED_HEADERS=ldgram.h ldemul-list.h
136
137 LDSOURCES=$(LDCSOURCES) ldgram.y ldlex.l ldgram.h
138
139 BFDSOURCES=../../bfd/common/*.c
140
141 SOURCES= $(LDSOURCES) $(BFDSOURCES)
142 LINTSOURCES= $(LDCSOURCES) $(BFDSOURCES) $(GENERATED_SOURCES)
143
144 STAGESTUFF = *.x *.x[runN] *.sc[runN] $(GENERATED_SOURCES) $(GENERATED_HEADERS) $(OFILES) $(LD_PROG) mkscript
145
146 all: Makefile $(LD_PROG)
147
148 check: bootstrap
149 info: ld.info
150
151 ldgram.h ldgram.c: ldgram.y
152 $(BISON) $(BISONFLAGS) -d $(srcdir)/ldgram.y
153 mv -f y.tab.c ldgram.c
154 mv -f y.tab.h ldgram.h
155
156 ldmain.o: ldmain.c
157 $(CC) $(CFLAGS) $(INCLUDES) $(HDEFINES) $(TDEFINES) $(CDEFINES) -DDEFAULT_EMULATION='"$(EMUL)"' -c $<
158
159 ldemul-list.h: Makefile
160 (echo "/* This file is automatically generated. DO NOT EDIT! */";\
161 for f in `echo " " ${EMULATION_OFILES} "" \
162 | sed -e 's/ld__/ld/g' -e 's/ ld/ /g' -e 's/[.]o//g'`; do \
163 echo "extern ld_emulation_xfer_type ld_$${f}_emulation;"; \
164 done;\
165 echo "";\
166 echo "#define EMULATION_LIST \\";\
167 for f in `echo " " ${EMULATION_OFILES} "" \
168 | sed -e 's/ld__/ld/g' -e 's/ ld/ /g' -e 's/[.]o//g'`; do \
169 echo " &ld_$${f}_emulation, \\"; \
170 done;\
171 echo " 0") >ldemul-list.h
172
173 ldemul.o: ldemul-list.h
174
175 ldlex.c: ldlex.l
176 $(LEX) -I -Cem $(srcdir)/ldlex.l
177 mv lex.yy.c ldlex.c
178
179 # These all start with ld__ so 'make clean' can find them.
180
181 GENSCRIPTS=sh $(srcdir)/genscripts.sh ${srcdir} ${host_alias} ${target_alias}
182 GEN_DEPENDS=./mkscript $(srcdir)/genscripts.sh
183
184 ld__sun4.c: $(srcdir)/sun4.sh \
185 $(srcdir)/generic.em $(srcdir)/aout.sc-sh ${GEN_DEPENDS}
186 ${GENSCRIPTS} sun4.sh
187 ld__sun3.c: $(srcdir)/sun3.sh \
188 $(srcdir)/generic.em $(srcdir)/aout.sc-sh ${GEN_DEPENDS}
189 ${GENSCRIPTS} sun3.sh
190 ld__go32.c: $(srcdir)/go32.sh \
191 $(srcdir)/generic.em $(srcdir)/aout.sc-sh ${GEN_DEPENDS}
192 ${GENSCRIPTS} go32.sh
193 ld__news.c: $(srcdir)/news.sh \
194 $(srcdir)/generic.em $(srcdir)/aout.sc-sh ${GEN_DEPENDS}
195 ${GENSCRIPTS} news.sh
196 ld__hp300bsd.c: $(srcdir)/hp300bsd.sh \
197 $(srcdir)/generic.em $(srcdir)/aout.sc-sh ${GEN_DEPENDS}
198 ${GENSCRIPTS} hp300bsd.sh
199 ld__i386aout.c: $(srcdir)/i386aout.sh \
200 $(srcdir)/generic.em $(srcdir)/aout.sc-sh ${GEN_DEPENDS}
201 ${GENSCRIPTS} i386aout.sh
202 ld__ebmon29k.c: $(srcdir)/ebmon29k.sh \
203 $(srcdir)/generic.em $(srcdir)/ebmon29k.sc-sh ${GEN_DEPENDS}
204 ${GENSCRIPTS} ebmon29k.sh
205 ld__sa29200.c: $(srcdir)/sa29200.sh \
206 $(srcdir)/generic.em $(srcdir)/sa29200.sc-sh ${GEN_DEPENDS}
207 ${GENSCRIPTS} sa29200.sh
208 ld__a29k.c: $(srcdir)/a29k.sh \
209 $(srcdir)/generic.em $(srcdir)/a29k.sc-sh ${GEN_DEPENDS}
210 ${GENSCRIPTS} a29k.sh
211 ld__m88kbcs.c: $(srcdir)/m88kbcs.sh \
212 $(srcdir)/generic.em $(srcdir)/h8300hms.sc-sh ${GEN_DEPENDS}
213 ${GENSCRIPTS} m88kbcs.sh
214 ld__h8300hms.c: $(srcdir)/h8300hms.sh \
215 $(srcdir)/h8300hms.em $(srcdir)/h8300hms.sc-sh ${GEN_DEPENDS}
216 ${GENSCRIPTS} h8300hms.sh
217 ld__h8300xray.c: $(srcdir)/h8300xray.sh \
218 $(srcdir)/h8300xray.em $(srcdir)/h8300xray.sc-sh ${GEN_DEPENDS}
219 ${GENSCRIPTS} h8300xray.sh
220 ld__st2000.c: $(srcdir)/st2000.sh \
221 $(srcdir)/st2000.em $(srcdir)/st2000.sc-sh ${GEN_DEPENDS}
222 ${GENSCRIPTS} st2000.sh
223 ld__vanilla.c: $(srcdir)/vanilla.sh \
224 $(srcdir)/vanilla.em $(srcdir)/vanilla.sc-sh ${GEN_DEPENDS}
225 ${GENSCRIPTS} vanilla.sh
226 ld__lnk960.c: $(srcdir)/lnk960.sh \
227 $(srcdir)/lnk960.em $(srcdir)/i960.sc-sh ${GEN_DEPENDS}
228 ${GENSCRIPTS} lnk960.sh
229 ld__gld960.c: $(srcdir)/gld960.sh \
230 $(srcdir)/gld960.em $(srcdir)/i960.sc-sh ${GEN_DEPENDS}
231 ${GENSCRIPTS} gld960.sh
232
233 $(LD_PROG): $(OFILES) $(BFDLIB) $(LIBIBERTY)
234 $(CC) $(CFLAGS) $(INCLUDES) $(HDEFINES) $(TDEFINES) $(CDEFINES) $(LDFLAGS) -o $(LD_PROG) $(OFILES) $(BFDLIB) $(LIBIBERTY) $(LOADLIBES)
235
236 # Rules for testing by relinking ld itself.
237
238 ld-partial.o: ld.new
239 $(HOSTING_EMU); ./ld.new -o ld-partial.o -r $(OFILES)
240 ld1: ld-partial.o
241 $(HOSTING_EMU); ./ld.new -o ld1 $(HOSTING_CRT0) ld-partial.o $(BFDLIB) $(LIBIBERTY) $(HOSTING_LIBS)
242
243 ld1-full: ld.new
244 $(HOSTING_EMU); ./ld.new -o ld1-full $(HOSTING_CRT0) $(OFILES) $(BFDLIB) $(LIBIBERTY) $(HOSTING_LIBS)
245
246 ld2: ld1
247 $(HOSTING_EMU); ./ld1 -o ld2 $(HOSTING_CRT0) $(OFILES) $(BFDLIB) $(LIBIBERTY) $(HOSTING_LIBS)
248
249 ld3: ld2
250 $(HOSTING_EMU); ./ld2 -o ld3 $(HOSTING_CRT0) $(OFILES) $(BFDLIB) $(LIBIBERTY) $(HOSTING_LIBS)
251
252 bootstrap: ld3
253 cmp ld2 ld3
254
255 ######################################################################
256 # DOCUMENTATION TARGETS
257 # TeX output
258 ld.dvi: $(srcdir)/ld.texinfo
259 TEXINPUTS=${TEXIDIR}:.:$$TEXINPUTS tex $(srcdir)/ld.texinfo
260 texindex ld.??
261 TEXINPUTS=${TEXIDIR}:.:$$TEXINPUTS tex $(srcdir)/ld.texinfo
262
263 # info file for online browsing
264 ld.info: $(srcdir)/ld.texinfo
265 $(MAKEINFO) -o ld.info $(srcdir)/ld.texinfo
266
267 #separate targets for "ms", "me", and "mm" forms of roff doc
268 # Try to use a recent texi2roff. v2 was put on prep in jan91.
269 # If you want an index, see texi2roff doc for postprocessing
270 # and add -i to texi2roff invocations below.
271 # Workarounds for texi2roff-2 (probably fixed in later texi2roff's, delete
272 # correspondint -e lines when later texi2roff's are current)
273 # + @ifinfo's deleted explicitly due to texi2roff-2 bug w nested constructs.
274 # + @c's deleted explicitly because texi2roff sees texinfo commands in them
275 # + @ (that's at-BLANK) not recognized by texi2roff, turned into blank
276 # + @alphaenumerate is ridiculously new, turned into @enumerate
277
278 ld.ms: $(srcdir)/ld.texinfo
279 sed -e '/\\input texinfo/d' \
280 -e '/@c TEXI2ROFF-KILL/,/@c END TEXI2ROFF-KILL/d' \
281 -e '/^@ifinfo/,/^@end ifinfo/d' \
282 -e '/^@c/d' \
283 -e 's/{.*,,/{/' \
284 -e 's/@ / /g' \
285 -e 's/^@alphaenumerate/@enumerate/g' \
286 -e 's/^@end alphaenumerate/@end enumerate/g' \
287 $(srcdir)/ld.texinfo | \
288 $(TEXI2ROFF) $(TEXI2OPT) -ms | \
289 sed -e 's/---/\\(em/g' \
290 >>ld.ms
291
292 # index for roff output
293 ld-index.ms: ld.ms
294 $(ROFF) -ms ld.ms 2>&1 1>/dev/null | \
295 sed -e '/: warning:/d' | \
296 texi2index >ld-index.ms
297
298 # roff output (-mm)
299 ld.mm: $(srcdir)/ld.texinfo
300 sed -e '/\\input texinfo/d' \
301 -e '/@c TEXI2ROFF-KILL/,/@c END TEXI2ROFF-KILL/d' \
302 -e '/^@ifinfo/,/^@end ifinfo/d' \
303 -e '/^@c/d' \
304 -e 's/{.*,,/{/' \
305 -e '/@noindent/d' \
306 -e 's/@ / /g' \
307 -e 's/^@alphaenumerate/@enumerate/g' \
308 -e 's/^@end alphaenumerate/@end enumerate/g' \
309 $(srcdir)/ld.texinfo | \
310 $(TEXI2ROFF) $(TEXI2OPT) -mm | \
311 sed -e 's/---/\\(em/g' \
312 >ld.mm
313
314 # index for roff output
315 ld-index.mm: ld.mm
316 $(ROFF) -mm ld.mm 2>&1 1>/dev/null | \
317 sed -e '/: warning:/d' | \
318 texi2index >ld-index.mm
319
320 # roff output (-me)
321 ld.me: $(srcdir)/ld.texinfo
322 sed -e '/\\input texinfo/d' \
323 -e '/@c TEXI2ROFF-KILL/,/@c END TEXI2ROFF-KILL/d' \
324 -e '/^@ifinfo/,/^@end ifinfo/d' \
325 -e '/^@c/d' \
326 -e 's/{.*,,/{/' \
327 -e 's/@ / /g' \
328 -e 's/^@alphaenumerate/@enumerate/g' \
329 -e 's/^@end alphaenumerate/@end enumerate/g' \
330 $(srcdir)/ld.texinfo | \
331 $(TEXI2ROFF) $(TEXI2OPT) -me | \
332 sed -e 's/---/\\(em/g' \
333 >>ld.me
334
335 # index for roff output
336 ld-index.me: ld.me
337 $(ROFF) -me ld.me 2>&1 1>/dev/null | \
338 sed -e '/: warning:/d' | \
339 texi2index >ld-index.me
340
341
342 ######################################################################
343
344 ./mkscript: $(srcdir)/mkscript.c
345 $(HOST_CC) -o mkscript $(srcdir)/mkscript.c
346
347 ldlex.c: ldlex.l ldgram.h
348 ldlex.o: ldlex.c ldgram.h
349 ldgram.o: ldgram.c
350 ldgram.c:ldgram.y
351
352 h8300hms.o:h8300hms.c
353 h8300xray.o:h8300xray.c
354 st2000.o:st2000.c
355
356 stage1: force
357 -mkdir stage1
358 -mv -f $(STAGESTUFF) stage1
359 -(cd stage1 ; ln -s $(LD_PROG) ld)
360
361 stage2: force
362 -mkdir stage2
363 -mv -f $(STAGESTUFF) stage2
364 -(cd stage2 ; ln -s $(LD_PROG) ld)
365
366 stage3: force
367 -mkdir stage3
368 -mv -f $(STAGESTUFF) stage3
369 -(cd stage3 ; ln -s $(LD_PROG) ld)
370
371 against=stage2
372
373 comparison: force
374 for i in $(STAGESTUFF) ; do cmp $$i $(against)/$$i ; done
375
376 de-stage1: force
377 -(cd stage1 ; mv -f * ..)
378 -rm ld
379 -rmdir stage1
380
381 de-stage2: force
382 -(cd stage2 ; mv -f * ..)
383 -rm ld
384 -rmdir stage2
385
386 de-stage3: force
387 -(cd stage3 ; mv -f * ..)
388 -rm ld
389 -rmdir stage3
390
391 clean:
392 -rm -f TAGS $(STAGESTUFF)
393 -rm -f ld.?? ld.??? ldlex.[qp]
394 -rm -f ld ld1 ld2 ld3 *.o y.output
395
396 lintlog:$(SOURCES) Makefile
397 $(LINT) -abhxzn $(LINTFLAGS) $(LINTSOURCES) \
398 | grep -v "pointer casts may be troublesome" \
399 | grep -v "possible pointer alignment problem" \
400 | grep -v "ignore" \
401 | grep -v "conversion from long may lose accuracy" \
402 | grep -v "warning: constant argument to NOT" \
403 | grep -v "enumeration type clash, operator CAST" \
404 | grep -v "warning: constant in conditional context"\
405 | grep -v "archive\.c"
406
407
408 tags TAGS:$(SOURCES) $(HEADERS)
409 etags -t $?
410
411
412 objdump:objdump.c
413
414 .PHONY: install
415 install: $(LD_PROG)
416 -rm -f $(bindir)/$(program_prefix)ld$(program_suffix)
417 $(INSTALL_PROGRAM) ld.new $(bindir)/$(program_prefix)ld$(program_suffix)
418 -rm -f $(tooldir)/ld
419 if [ -d $(tooldir) ]; then $(INSTALL_PROGRAM) ld.new $(tooldir)/ld; else true; fi
420 -rm -f $(man1dir)/$(program_prefix)ld$(program_suffix).1
421 $(INSTALL_DATA) $(srcdir)/gld.1 $(man1dir)/$(program_prefix)ld$(program_suffix).1
422
423 install-info: info
424 for i in ld.info* ; do \
425 $(INSTALL_DATA) $$i $(infodir)/$$i ; \
426 done
427
428 clean-info:
429 -rm -rf *.info*
430
431 #-----------------------------------------------------------------------------
432 # 'STANDARD' GNU/960 TARGETS BELOW THIS POINT
433 #
434 # 'VERSION' file must be present and contain a string of the form "x.y"
435 #-----------------------------------------------------------------------------
436
437 ver960.c: FORCE
438 rm -f ver960.c
439 echo "char ${TARG}_ver[]= \"${TARG} `cat VERSION`, `date`\";" > ver960.c
440
441
442 # This target should be invoked before building a new release.
443 # 'VERSION' file must be present and contain a string of the form "x.y"
444 #
445 roll:
446 @V=`cat VERSION` ; \
447 MAJ=`sed 's/\..*//' VERSION` ; \
448 MIN=`sed 's/.*\.//' VERSION` ; \
449 V=$$MAJ.`expr $$MIN + 1` ; \
450 rm -f VERSION ; \
451 echo $$V >VERSION ; \
452 echo Version $$V
453
454
455 dep: $(LDSOURCES)
456 mkdep $(CFLAGS) $?
457
458 # Dummy target to force execution of dependent targets.
459 #
460 force:
461
462 # Target to uncomment host-specific lines in this makefile. Such lines must
463 # have the following string beginning in column 1: #__<hostname>__#
464 # Original Makefile is backed up as 'Makefile.old'.
465 #
466 # Invoke with: make make HOST=xxx
467 #
468 make:
469 -@if test $(HOST)x = x ; then \
470 echo '\aSpecify "make make HOST=???"'; \
471 exit 1; \
472 fi ; \
473 grep -s "^#The next line was generated by 'make make'" Makefile; \
474 if test $$? = 0 ; then \
475 echo "\aMakefile has already been processed with 'make make'";\
476 exit 1; \
477 fi ; \
478 mv -f Makefile Makefile.old; \
479 echo "#The next line was generated by 'make make'" >Makefile ; \
480 echo "HOST=$(HOST)" >>Makefile ; \
481 echo >>Makefile ; \
482 sed "s/^#__$(HOST)__#//" < Makefile.old >>Makefile
483
484 #\f
485
486 Makefile: $(srcdir)/Makefile.in $(host_makefile_frag) $(target_makefile_frag)
487 $(SHELL) ./config.status
488
489 ### mode:fundamental ***
490 ### Local Variables: ***
491 ### page-delimiter: "^#\f" ***
492 ### End: ***
493 ### end of file
494
495
496 # IF YOU PUT ANYTHING HERE IT WILL GO AWAY
This page took 0.039388 seconds and 5 git commands to generate.