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