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