New lexer.
[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
54 AR = ar
55 AR_FLAGS = qv
56 BISON = bison -y
57 MAKEINFO = makeinfo
58 RANLIB = ranlib
59
60 #version=/`./../gcc/gcc -dumpversion`
61 version=
62
63 # Seach path to override the default search path for -lfoo libraries.
64 # If LIB_PATH is empty, the ones in the script (if any) are left alone.
65 # Otherwise, they are replaced with the ones given in LIB_PATH,
66 # which may have the form: LIB_PATH=/lib:/usr/local/lib
67 LIB_PATH =
68
69 BASEDIR = ../..
70 INCLUDE = $(srcdir)/../include
71 INCLUDES = -I. -I$(srcdir) -I$(INCLUDE)
72 MINUS_G = -g
73
74 # Where to find texinfo.tex to format docn with TeX
75 TEXIDIR = $(srcdir)/../texinfo/fsf
76
77 # Whether to get roff to put indexing entries on stderr
78 TEXI2OPT =
79 # You neeed this to generate ld-index.ms (or .mm or .me)
80 # TEXI2OPT = -i
81
82 TEXI2ROFF=texi2roff
83
84 # Which roff program to use to generate index for texi2roff'd doc
85 ROFF = groff
86
87 ### Host, target, and site specific Makefile fragments come in here.
88 ###
89
90 CFLAGS = $(INCLUDES) $(MINUS_G) $(HDEFINES) $(TDEFINES) $(CDEFINES)
91 LINTFLAGS = $(INCLUDES) $(EXTRA_DEF)
92
93 .SUFFIXES: .y .x .xr .xu .xn .xbn .sc .scu .scr .scn $(SUFFIXES)
94
95 # go directly to ld.new in case this ld isn't capable of
96 # linking native object on this host. It can be renamed on
97 # install.
98 LD_PROG = ld.new
99
100 # for self hosting
101 BFDLIB=./../bfd/libbfd.a
102 LIBIBERTY=./../libiberty/libiberty.a
103
104 ALL_EMULATIONS=ld__lnk960.o ld__sun3.o ld__i386aout.o \
105 ld__go32.o ld__m88kbcs.o ld__a29k.o ld__news.o ld__hp300bsd.o ld__h8300hms.o ld__ebmon29k.o \
106 ld__sun4.o ld__gld960.o ld__vanilla.o ld__h8300xray.o
107
108 EMULATION_OFILES=${ALL_EMULATIONS}
109 #EMULATION_OFILES=ld__${EMUL}.o ${OTHER_EMULATIONS}
110
111 OFILES= ldgram.o ldlex.o lexsup.o ldlang.o ldctor.o ldmain.o ldindr.o \
112 ldwarn.o ldwrite.o ldexp.o ldemul.o ldver.o ldmisc.o ldsym.o \
113 ldfile.o relax.o lderror.o cplus-dem.o ${EMULATION_OFILES}
114
115 HEADERS=config.h ldmain.h ldmain.h ldwarn.h ldmisc.h ldindr.h \
116 ldsym.h ldctor.h ldlang.h ldexp.h \
117 ldlex.h ldwrite.h ldver.h ldemul.h ldfile.h ldgram.h ld.h
118
119 MANSOURCES=ld.tex
120
121 LDCSOURCES=ldlang.c lexsup.c ldctor.c ldindr.c ldmain.c ldwrite.c ldwarn.c ldlnk960.c \
122 ld__gld.c ld__sun3.c ld__go32.c ld__m88k.c ld__ebmon29k.c \
123 ldgld960.c ldemul.c ldver.c ldmisc.c ldexp.c ldsym.c ldfile.c \
124 relax.c lderror.c cplus-dem.c
125
126 GENERATED_SOURCES=ldgram.c ldlex.c ld__*.c ldemul-list.h
127 GENERATED_HEADERS=ldgram.h ldemul-list.h
128
129 LDSOURCES=$(LDCSOURCES) ldgram.y ldlex.l ldgram.h
130
131 BFDSOURCES=../../bfd/common/*.c
132
133 SOURCES= $(LDSOURCES) $(BFDSOURCES)
134 LINTSOURCES= $(LDCSOURCES) $(BFDSOURCES) $(GENERATED_SOURCES)
135
136 STAGESTUFF = *.x *.x[runN] *.sc[runN] $(GENERATED_SOURCES) $(GENERATED_HEADERS) $(OFILES) $(LD_PROG) mkscript
137
138 all: Makefile $(LD_PROG)
139
140 check:
141 info: ld.info
142
143 ldgram.h ldgram.c: ldgram.y
144 $(BISON) $(BISONFLAGS) -d $(VPATH)/ldgram.y
145 mv -f y.tab.c ldgram.c
146 mv -f y.tab.h ldgram.h
147
148 ldmain.o: ldmain.c
149 $(CC) $(CFLAGS) -DDEFAULT_EMULATION='"$(EMUL)"' -c $<
150
151 ldemul-list.h: Makefile
152 (echo "/* This file is automatically generated. DO NOT EDIT! */";\
153 for f in `echo " " ${EMULATION_OFILES} "" \
154 | sed -e 's/ld__/ld/g' -e 's/ ld/ /g' -e 's/[.]o//g'`; do \
155 echo "extern ld_emulation_xfer_type ld_$${f}_emulation;"; \
156 done;\
157 echo "";\
158 echo "#define EMULATION_LIST \\";\
159 for f in `echo " " ${EMULATION_OFILES} "" \
160 | sed -e 's/ld__/ld/g' -e 's/ ld/ /g' -e 's/[.]o//g'`; do \
161 echo " &ld_$${f}_emulation, \\"; \
162 done;\
163 echo " 0") >ldemul-list.h
164
165 ldemul.o: ldemul-list.h
166
167 ldlex.c: ldlex.l
168 # /lib/cpp -E -P $(INCLUDES) $(HDEFINES) $(TDEFINES) $(CDEFINES) $(VPATH)/ldlex.l >ldlex.p
169 flex -Cem -t $(VPATH)/ldlex.l >ldlex.c
170 # cp ldlex.q ldlex.c
171
172
173 # These all start with ld__ so 'make clean' can find them.
174
175 GENSCRIPTS=sh $(srcdir)/genscripts.sh ${srcdir} ${host_alias} ${target_alias}
176 GEN_DEPENDS=./mkscript $(srcdir)/genscripts.sh
177
178 ld__sun4.c: $(srcdir)/sun4.sh \
179 $(srcdir)/generic.em $(srcdir)/aout.sc-sh ${GEN_DEPENDS}
180 ${GENSCRIPTS} sun4.sh
181 ld__sun3.c: $(srcdir)/sun3.sh \
182 $(srcdir)/generic.em $(srcdir)/aout.sc-sh ${GEN_DEPENDS}
183 ${GENSCRIPTS} sun3.sh
184 ld__go32.c: $(srcdir)/go32.sh \
185 $(srcdir)/generic.em $(srcdir)/aout.sc-sh ${GEN_DEPENDS}
186 ${GENSCRIPTS} go32.sh
187 ld__news.c: $(srcdir)/news.sh \
188 $(srcdir)/generic.em $(srcdir)/aout.sc-sh ${GEN_DEPENDS}
189 ${GENSCRIPTS} news.sh
190 ld__hp300bsd.c: $(srcdir)/hp300bsd.sh \
191 $(srcdir)/generic.em $(srcdir)/aout.sc-sh ${GEN_DEPENDS}
192 ${GENSCRIPTS} hp300bsd.sh
193 ld__i386aout.c: $(srcdir)/i386aout.sh \
194 $(srcdir)/generic.em $(srcdir)/aout.sc-sh ${GEN_DEPENDS}
195 ${GENSCRIPTS} i386aout.sh
196 ld__ebmon29k.c: $(srcdir)/ebmon29k.sh \
197 $(srcdir)/generic.em $(srcdir)/ebmon29k.sc-sh ${GEN_DEPENDS}
198 ${GENSCRIPTS} ebmon29k.sh
199 ld__a29k.c: $(srcdir)/a29k.sh \
200 $(srcdir)/generic.em $(srcdir)/a29k.sc-sh ${GEN_DEPENDS}
201 ${GENSCRIPTS} a29k.sh
202 ld__m88kbcs.c: $(srcdir)/m88kbcs.sh \
203 $(srcdir)/generic.em $(srcdir)/h8300hms.sc-sh ${GEN_DEPENDS}
204 ${GENSCRIPTS} m88kbcs.sh
205 ld__h8300hms.c: $(srcdir)/h8300hms.sh \
206 $(srcdir)/h8300hms.em $(srcdir)/h8300hms.sc-sh ${GEN_DEPENDS}
207 ${GENSCRIPTS} h8300hms.sh
208 ld__h8300xray.c: $(srcdir)/h8300xray.sh \
209 $(srcdir)/h8300xray.em $(srcdir)/h8300xray.sc-sh ${GEN_DEPENDS}
210 ${GENSCRIPTS} h8300xray.sh
211 ld__vanilla.c: $(srcdir)/vanilla.sh \
212 $(srcdir)/vanilla.em $(srcdir)/vanilla.sc-sh ${GEN_DEPENDS}
213 ${GENSCRIPTS} vanilla.sh
214 ld__lnk960.c: $(srcdir)/lnk960.sh \
215 $(srcdir)/lnk960.em $(srcdir)/i960.sc-sh ${GEN_DEPENDS}
216 ${GENSCRIPTS} lnk960.sh
217 ld__gld960.c: $(srcdir)/gld960.sh \
218 $(srcdir)/gld960.em $(srcdir)/i960.sc-sh ${GEN_DEPENDS}
219 ${GENSCRIPTS} gld960.sh
220
221 $(LD_PROG): $(OFILES) $(BFDLIB) $(LIBIBERTY)
222 $(CC) $(CFLAGS) $(LDFLAGS) -o $(LD_PROG) $(OFILES) $(BFDLIB) $(LIBIBERTY) $(LOADLIBES)
223
224 # Rules for testing by relinking ld itself.
225
226 ld-partial.o: ld.new
227 $(HOSTING_EMU); ./ld.new -o ld-partial.o -r $(OFILES)
228 ld1: ld-partial.o
229 $(HOSTING_EMU); ./ld.new -o ld1 $(HOSTING_CRT0) ld-partial.o $(BFDLIB) $(LIBIBERTY) $(HOSTING_LIBS)
230
231 ld1-full: ld.new
232 $(HOSTING_EMU); ./ld.new -o ld1-full $(HOSTING_CRT0) $(OFILES) $(BFDLIB) $(LIBIBERTY) $(HOSTING_LIBS)
233
234 ld2: ld1
235 $(HOSTING_EMU); ./ld1 -o ld2 $(HOSTING_CRT0) $(OFILES) $(BFDLIB) $(LIBIBERTY) $(HOSTING_LIBS)
236
237 ld3: ld2
238 $(HOSTING_EMU); ./ld2 -o ld3 $(HOSTING_CRT0) $(OFILES) $(BFDLIB) $(LIBIBERTY) $(HOSTING_LIBS)
239
240 bootstrap: ld3
241 cmp ld2 ld3
242
243 ######################################################################
244 # DOCUMENTATION TARGETS
245 # TeX output
246 ld.dvi: $(srcdir)/ld.texinfo
247 TEXINPUTS=${TEXIDIR}:.:$$TEXINPUTS tex $(srcdir)/ld.texinfo
248 texindex ld.??
249 TEXINPUTS=${TEXIDIR}:.:$$TEXINPUTS tex $(srcdir)/ld.texinfo
250
251 # info file for online browsing
252 ld.info: $(srcdir)/ld.texinfo
253 $(MAKEINFO) -o ld.info $(srcdir)/ld.texinfo
254
255 #separate targets for "ms", "me", and "mm" forms of roff doc
256 # Try to use a recent texi2roff. v2 was put on prep in jan91.
257 # If you want an index, see texi2roff doc for postprocessing
258 # and add -i to texi2roff invocations below.
259 # Workarounds for texi2roff-2 (probably fixed in later texi2roff's, delete
260 # correspondint -e lines when later texi2roff's are current)
261 # + @ifinfo's deleted explicitly due to texi2roff-2 bug w nested constructs.
262 # + @c's deleted explicitly because texi2roff sees texinfo commands in them
263 # + @ (that's at-BLANK) not recognized by texi2roff, turned into blank
264 # + @alphaenumerate is ridiculously new, turned into @enumerate
265
266 ld.ms: $(srcdir)/ld.texinfo
267 sed -e '/\\input texinfo/d' \
268 -e '/@c TEXI2ROFF-KILL/,/@c END TEXI2ROFF-KILL/d' \
269 -e '/^@ifinfo/,/^@end ifinfo/d' \
270 -e '/^@c/d' \
271 -e 's/{.*,,/{/' \
272 -e 's/@ / /g' \
273 -e 's/^@alphaenumerate/@enumerate/g' \
274 -e 's/^@end alphaenumerate/@end enumerate/g' \
275 $(srcdir)/ld.texinfo | \
276 $(TEXI2ROFF) $(TEXI2OPT) -ms | \
277 sed -e 's/---/\\(em/g' \
278 >>ld.ms
279
280 # index for roff output
281 ld-index.ms: ld.ms
282 $(ROFF) -ms ld.ms 2>&1 1>/dev/null | \
283 sed -e '/: warning:/d' | \
284 texi2index >ld-index.ms
285
286 # roff output (-mm)
287 ld.mm: $(srcdir)/ld.texinfo
288 sed -e '/\\input texinfo/d' \
289 -e '/@c TEXI2ROFF-KILL/,/@c END TEXI2ROFF-KILL/d' \
290 -e '/^@ifinfo/,/^@end ifinfo/d' \
291 -e '/^@c/d' \
292 -e 's/{.*,,/{/' \
293 -e '/@noindent/d' \
294 -e 's/@ / /g' \
295 -e 's/^@alphaenumerate/@enumerate/g' \
296 -e 's/^@end alphaenumerate/@end enumerate/g' \
297 $(srcdir)/ld.texinfo | \
298 $(TEXI2ROFF) $(TEXI2OPT) -mm | \
299 sed -e 's/---/\\(em/g' \
300 >ld.mm
301
302 # index for roff output
303 ld-index.mm: ld.mm
304 $(ROFF) -mm ld.mm 2>&1 1>/dev/null | \
305 sed -e '/: warning:/d' | \
306 texi2index >ld-index.mm
307
308 # roff output (-me)
309 ld.me: $(srcdir)/ld.texinfo
310 sed -e '/\\input texinfo/d' \
311 -e '/@c TEXI2ROFF-KILL/,/@c END TEXI2ROFF-KILL/d' \
312 -e '/^@ifinfo/,/^@end ifinfo/d' \
313 -e '/^@c/d' \
314 -e 's/{.*,,/{/' \
315 -e 's/@ / /g' \
316 -e 's/^@alphaenumerate/@enumerate/g' \
317 -e 's/^@end alphaenumerate/@end enumerate/g' \
318 $(srcdir)/ld.texinfo | \
319 $(TEXI2ROFF) $(TEXI2OPT) -me | \
320 sed -e 's/---/\\(em/g' \
321 >>ld.me
322
323 # index for roff output
324 ld-index.me: ld.me
325 $(ROFF) -me ld.me 2>&1 1>/dev/null | \
326 sed -e '/: warning:/d' | \
327 texi2index >ld-index.me
328
329
330 ######################################################################
331
332 ./mkscript: $(srcdir)/mkscript.c
333 $(CC) $(CFLAGS) $(LDFLAGS) -o mkscript $(srcdir)/mkscript.c $(LOADLIBES)
334
335 ldlex.c: ldlex.l ldgram.h
336 ldlex.o: ldlex.c ldgram.h
337 ldgram.o: ldgram.c
338 ldgram.c:ldgram.y
339
340 h8300hms.o:h8300hms.c
341 h8300xray.o:h8300xray.c
342
343 stage1: force
344 -mkdir stage1
345 -mv -f $(STAGESTUFF) stage1
346 -(cd stage1 ; ln -s $(LD_PROG) ld)
347
348 stage2: force
349 -mkdir stage2
350 -mv -f $(STAGESTUFF) stage2
351 -(cd stage2 ; ln -s $(LD_PROG) ld)
352
353 stage3: force
354 -mkdir stage3
355 -mv -f $(STAGESTUFF) stage3
356 -(cd stage3 ; ln -s $(LD_PROG) ld)
357
358 against=stage2
359
360 comparison: force
361 for i in $(STAGESTUFF) ; do cmp $$i $(against)/$$i ; done
362
363 de-stage1: force
364 -(cd stage1 ; mv -f * ..)
365 -rm ld
366 -rmdir stage1
367
368 de-stage2: force
369 -(cd stage2 ; mv -f * ..)
370 -rm ld
371 -rmdir stage2
372
373 de-stage3: force
374 -(cd stage3 ; mv -f * ..)
375 -rm ld
376 -rmdir stage3
377
378 clean:
379 -rm -f TAGS $(STAGESTUFF)
380 -rm -f ld.?? ld.??? ldlex.[qp]
381 -rm -f ld ld1 ld2 ld3 *.o y.output
382
383 lintlog:$(SOURCES) Makefile
384 $(LINT) -abhxzn $(LINTFLAGS) $(LINTSOURCES) \
385 | grep -v "pointer casts may be troublesome" \
386 | grep -v "possible pointer alignment problem" \
387 | grep -v "ignore" \
388 | grep -v "conversion from long may lose accuracy" \
389 | grep -v "warning: constant argument to NOT" \
390 | grep -v "enumeration type clash, operator CAST" \
391 | grep -v "warning: constant in conditional context"\
392 | grep -v "archive\.c"
393
394
395 tags TAGS:$(SOURCES) $(HEADERS)
396 etags -t $?
397
398
399 objdump:objdump.c
400
401 .PHONY: install
402 install: $(LD_PROG)
403 mv ld.new ld
404 -rm -f $(bindir)/$(program_prefix)ld
405 $(INSTALL_PROGRAM) ld $(bindir)/$(program_prefix)ld
406 -rm -f $(tooldir)/ld
407 $(INSTALL_PROGRAM) ld $(tooldir)/$(program_prefix)ld
408 -rm -f $(man1dir)/$(program_prefix)ld.1
409 $(INSTALL_DATA) $(srcdir)/gld.1 $(man1dir)/$(program_prefix)ld.1
410
411 install-info: info
412 for i in ld.info* ; do \
413 $(INSTALL_DATA) $$i $(infodir)/$$i ; \
414 done
415
416 clean-info:
417 -rm -rf *.info*
418
419 # Something like the following might make sense for install, but doesn't work
420 # - it is too fragile, depending on a gcc binary int the right place.
421 # Perhaps using gcc/version.c might work?
422 # # If $(gcclibdir) exists, install ld there, and put a link to it
423 # # from $(bindir); otherwise put ld in $(bindir).
424 # if ([ -x ./../gcc/gcc -a -d $(gcclibdir) ]); then \
425 # $(INSTALL_PROGRAM) ld.new $(gcclibdir)/ld; \
426 # cd $(bindir); rm -f ld; ln -s $(gcclibdir)/ld ld; \
427 # else \
428 # $(INSTALL_PROGRAM) ld.new $(bindir)/ld; \
429 # fi
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.040168 seconds and 5 git commands to generate.