1 # Makefile for the GNU linker ld (version 2)
2 # Copyright (C) 1989-1991 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.
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
42 gcclibdir
= $(libdir)/gcc
/$(target_alias
)
47 INSTALL_PROGRAM
= $(INSTALL
)
48 INSTALL_DATA
= $(INSTALL
)
56 #version=/`$(unsubdir)/../gcc$(subdir)/gcc -dumpversion`
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
66 INCLUDE
= $(srcdir)/..
/include
67 INCLUDES
= -I.
-I
$(srcdir) -I
$(INCLUDE
)
70 # Where to find texinfo.tex to format docn with TeX
71 TEXIDIR
= $(srcdir)/..
/texinfo
/fsf
73 # Whether to get roff to put indexing entries on stderr
75 # You neeed this to generate ld-index.ms (or .mm or .me)
80 # Which roff program to use to generate index for texi2roff'd doc
83 ### Host, target, and site specific Makefile fragments come in here.
86 CFLAGS
= $(INCLUDES
) $(MINUS_G
) $(HDEFINES
) $(TDEFINES
) $(CDEFINES
)
87 LINTFLAGS
= $(INCLUDES
) $(EXTRA_DEF
)
89 .SUFFIXES
: .y .x .xr .xu .xn .xN .sc .scu .scr .scn
$(SUFFIXES
)
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
97 BFDLIB
=$(unsubdir
)/..
/bfd
$(subdir
)/libbfd.a
98 LIBIBERTY
=$(unsubdir
)/..
/libiberty
$(subdir
)/libiberty.a
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
104 EMULATION_OFILES
=${ALL_EMULATIONS}
105 #EMULATION_OFILES=ld__${EMUL}.o ${OTHER_EMULATIONS}
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}
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
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 \
122 GENERATED_SOURCES
=ldgram.c ldlex.c ld__
*.c ldemul-list.h
123 GENERATED_HEADERS
=ldgram.h ldemul-list.h
125 LDSOURCES
=$(LDCSOURCES
) ldgram.y ldlex.l ldgram.h
127 BFDSOURCES
=..
/..
/bfd
/common
/*.c
129 SOURCES
= $(LDSOURCES
) $(BFDSOURCES
)
130 LINTSOURCES
= $(LDCSOURCES
) $(BFDSOURCES
) $(GENERATED_SOURCES
)
132 STAGESTUFF
= *.x
*.x
[runN
] *.sc
[runN
] $(GENERATED_SOURCES
) $(GENERATED_HEADERS
) $(OFILES
) $(LD_PROG
) mkscript
134 all: Makefile
$(LD_PROG
)
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
144 $(CC
) $(CFLAGS
) -DDEFAULT_EMULATION
='"$(EMUL)"' -c
$<
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;"; \
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, \\"; \
158 echo
" 0") >ldemul-list.h
160 ldemul.o
: ldemul-list.h
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
171 # These all start with ld__ so 'make clean' can find them.
173 GENSCRIPTS
=sh
$(srcdir)/genscripts.sh
${srcdir} ${host_alias} ${target_alias}
174 GEN_DEPENDS
=.
/mkscript
$(srcdir)/genscripts.sh
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
210 $(LD_PROG
): $(OFILES
) $(BFDLIB
) $(LIBIBERTY
)
211 $(CC
) $(CFLAGS
) $(LDFLAGS
) -o
$(LD_PROG
) $(OFILES
) $(BFDLIB
) $(LIBIBERTY
) $(LOADLIBES
)
213 # Rules for testing by relinking ld itself.
216 $(HOSTING_EMU
); .
/ld.new
-o ld-partial.o
-r
$(OFILES
)
218 $(HOSTING_EMU
); .
/ld.new
-o ld1
$(HOSTING_CRT0
) ld-partial.o
$(BFDLIB
) $(LIBIBERTY
) $(HOSTING_LIBS
)
221 $(HOSTING_EMU
); .
/ld.new
-o ld1-full
$(HOSTING_CRT0
) $(OFILES
) $(BFDLIB
) $(LIBIBERTY
) $(HOSTING_LIBS
)
224 $(HOSTING_EMU
); .
/ld1
-o ld2
$(HOSTING_CRT0
) $(OFILES
) $(BFDLIB
) $(LIBIBERTY
) $(HOSTING_LIBS
)
227 $(HOSTING_EMU
); .
/ld2
-o ld3
$(HOSTING_CRT0
) $(OFILES
) $(BFDLIB
) $(LIBIBERTY
) $(HOSTING_LIBS
)
232 ######################################################################
233 # DOCUMENTATION TARGETS
235 ld.
dvi: $(srcdir)/ld.texinfo
236 TEXINPUTS
=${TEXIDIR}:.
:$$TEXINPUTS tex $(srcdir)/ld.texinfo
238 TEXINPUTS
=${TEXIDIR}:.
:$$TEXINPUTS tex $(srcdir)/ld.texinfo
240 # info file for online browsing
241 ld.
info: $(srcdir)/ld.texinfo
242 $(MAKEINFO
) -o
ld.
info $(srcdir)/ld.texinfo
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
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' \
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' \
269 # index for roff output
271 $(ROFF
) -ms
ld.ms
2>&1 1>/dev
/null | \
272 sed
-e
'/: warning:/d' | \
273 texi2index
>ld-index.ms
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' \
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' \
291 # index for roff output
293 $(ROFF
) -mm
ld.mm
2>&1 1>/dev
/null | \
294 sed
-e
'/: warning:/d' | \
295 texi2index
>ld-index.mm
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' \
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' \
312 # index for roff output
314 $(ROFF
) -me
ld.me
2>&1 1>/dev
/null | \
315 sed
-e
'/: warning:/d' | \
316 texi2index
>ld-index.me
319 ######################################################################
321 mkscript
: $(srcdir)/mkscript.c
322 $(CC
) $(CFLAGS
) $(LDFLAGS
) -o mkscript
$(srcdir)/mkscript.c
$(LOADLIBES
)
324 ldlex.c
: ldlex.l ldgram.h
325 ldlex.o
: ldlex.c ldgram.h
329 h8300hms.o
:h8300hms.c
333 -mv
-f
$(STAGESTUFF
) stage1
334 -(cd stage1
; ln
-s
$(LD_PROG
) ld)
338 -mv
-f
$(STAGESTUFF
) stage2
339 -(cd stage2
; ln
-s
$(LD_PROG
) ld)
343 -mv
-f
$(STAGESTUFF
) stage3
344 -(cd stage3
; ln
-s
$(LD_PROG
) ld)
349 for i in
$(STAGESTUFF
) ; do cmp
$$i $(against
)/$$i ; done
352 -(cd stage1
; mv
-f
* ..
)
357 -(cd stage2
; mv
-f
* ..
)
362 -(cd stage3
; mv
-f
* ..
)
367 -rm -f TAGS
$(STAGESTUFF
)
368 -rm -f
ld.??
ld.??? ldlex.
[qp
]
369 -rm -f
ld ld1 ld2 ld3
*.o y.output
371 lintlog
:$(SOURCES
) Makefile
372 $(LINT
) -abhxzn
$(LINTFLAGS
) $(LINTSOURCES
) \
373 | grep
-v
"pointer casts may be troublesome" \
374 | grep
-v
"possible pointer alignment problem" \
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"
383 tags TAGS
:$(SOURCES
) $(HEADERS
)
390 $(INSTALL_PROGRAM
) ld.new
$(bindir)/ld
393 for i in
ld.
info* ; do \
394 $(INSTALL_DATA
) $$i $(infodir)/$$i ; \
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; \
406 # $(INSTALL_PROGRAM) ld.new $(bindir)/ld; \
409 #-----------------------------------------------------------------------------
410 # 'STANDARD' GNU/960 TARGETS BELOW THIS POINT
412 # 'VERSION' file must be present and contain a string of the form "x.y"
413 #-----------------------------------------------------------------------------
417 echo
"char ${TARG}_ver[]= \"${TARG} `cat VERSION`, `date`\";" > ver960.c
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"
425 MAJ
=`sed 's/\..*//' VERSION` ; \
426 MIN
=`sed 's/.*\.//' VERSION` ; \
427 V
=$$MAJ.
`expr $$MIN + 1` ; \
429 echo
$$V >VERSION
; \
436 # Dummy target to force execution of dependent targets.
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'.
444 # Invoke with: make make HOST=xxx
447 -@if
test $(HOST
)x
= x
; then \
448 echo
'\aSpecify "make make HOST=???"'; \
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'";\
456 mv
-f Makefile Makefile.old
; \
457 echo
"#The next line was generated by 'make make'" >Makefile
; \
458 echo
"HOST=$(HOST)" >>Makefile
; \
460 sed
"s/^#__$(HOST)__#//" < Makefile.old
>>Makefile
464 Makefile
: $(srcdir)/Makefile.in
$(host_makefile_frag
) $(target_makefile_frag
)
465 $(SHELL
) .
/config.status
467 ### mode:fundamental ***
468 ### Local Variables: ***
469 ### page-delimiter: "^#\f" ***
474 # IF YOU PUT ANYTHING HERE IT WILL GO AWAY