]> Git Repo - binutils.git/blame - ld/Makefile.in
doc/as.texinfo: minor changes for texi2roff-2
[binutils.git] / ld / Makefile.in
CommitLineData
eb02fd64
RP
1#
2# Makefile for ld version 2
3#
4# $Id$
5#
6
7srcdir = .
8
8c32cf6e
RP
9destdir = /usr/local
10
e45bef1e 11version=`$(unsubdir)/../gcc$(subdir)/gcc -dumpversion`
565a4c76
SC
12bindir = $(destdir)/H-$(host_alias)/T-$(target_alias)/bin
13libdir = $(destdir)/H-$(host_alias)/T-$(target_alias)/lib
8c32cf6e
RP
14libsubdir = $(libdir)/gcc/$(target)/$(version)
15
ee17cac9
PB
16# Seach path to override the default search path for -lfoo libraries.
17# If LIB_PATH is empty, the ones in the script (if any) are left alone.
18# Otherwise, they are replaced with the ones given in LIB_PATH,
19# which may have the form: LIB_PATH=/lib:/usr/local/lib
20LIB_PATH =
21
8c32cf6e
RP
22INSTALL = install -c
23INSTALL_PROGRAM = $(INSTALL)
24INSTALL_FILE = $(INSTALL)
25
2ee11735 26BASEDIR = ../..
d6e467b4 27INCLUDE = $(srcdir)/../include
2ee11735 28INCLUDES = -I. -I$(srcdir) -I$(INCLUDE)
eb02fd64 29DEBUG = -g
2ee11735 30
8073190b 31# Where to find texinfo.tex to format docn with TeX
8d317d2a
RP
32TEXIDIR = $(srcdir)/../texinfo/fsf
33
10a69a37 34# Whether to get roff to put indexing entries on stderr
8073190b
RP
35#TEXI2OPT =
36# You neeed this to generate ld-index.ms
37TEXI2OPT = -i
38
39# Which roff program to use to generate index for texi2roff'd doc
40ROFF = groff
41
e46cdcdd
RP
42BISON = bison
43BISONFLAGS = -v
44
e1e5fbfc
PB
45SCRIPTS = ldgld68k.sc ldgld.sc \
46 ldlnk960.sc ldlnk960r.sc ldgld960.sc \
565a4c76 47 ldm88k.sc ldglda29k.sc news.sc h8300hds.sc ebmon29k.sc
2ee11735
RP
48
49#### target and host dependent Makefile fragments come in here.
50###
51
a37cc0c0 52CFLAGS = $(INCLUDES) $(DEBUG) $(HDEFINES) $(TDEFINES) $(CDEFINES)
2ee11735
RP
53LINTFLAGS = $(INCLUDES) $(EXTRA_DEF)
54
b7e24eef 55.SUFFIXES: .y .x .xr .xu .xn .sc .scu .scr .scn $(SUFFIXES)
2ee11735 56
eb02fd64
RP
57# go directly to ld.new in case this ld isn't capable of
58# linking native object on this host. It can be renamed on
59# install.
e7921bd4 60LD_PROG = ld.new
f78e2569 61
e1e5fbfc
PB
62# A .sc script file is needed for each emulation mode.
63# sed is used to transform this script into two variant forms:
64# A .scr script is for linking without relocation (-r flag).
65# A .scu script is like .scr, but *do* create constructors.
b7e24eef
PB
66# A .scu script is for linking to non-demand-paged output (-N or -n).
67# The diference is that segments should (need) not be page aligned.
e1e5fbfc
PB
68
69# A sed pattern to translate .sc to .scu:
70SED_MAKE_RELOC_WITH_CONSTRUCTORS=\
71 -e "/If relocating/,/End if relocating/d" \
6719c75b
PB
72 -e "/=/s/[_a-zA-Z.]* *= .*//g" \
73 -e '/>/s/} *> *[a-zA-Z]*/}/' \
e1e5fbfc
PB
74 -e "/text/s/[.]text .*:/.text :/" \
75 -e "/data/s/[.]data .*:/.data :/"
76# A sed pattern to translate .scu to .scr:
77SED_REMOVE_CONSTRUCTORS= -e /CONSTRUCTORS/d
b7e24eef
PB
78# A sed pattern to translate .sc to .scn:
79# We assume that any reasonable page size ends with 00
80# (Some things are aligned on 8-byte boundaries; ignore those.)
81SED_DONT_ALIGN= -e '/ALIGN/s/ALIGN( *0x[0-9a-fA-F]*00 *)/./'
e1e5fbfc
PB
82
83.sc.scu:
84 sed $(SED_MAKE_RELOC_WITH_CONSTRUCTORS) $< >$*.scu
b7e24eef
PB
85.sc.scn:
86 sed $(SED_DONT_ALIGN) $< >$*.scn
e1e5fbfc
PB
87.scu.scr:
88 sed $(SED_REMOVE_CONSTRUCTORS) < $< >$*.scr
89
b7e24eef 90# Each .sc .scr .scu or .scn script is filtered by mkscript
e1e5fbfc 91# into a string literal that can be included in a .c program.
30104b16 92.sc.x:
ee17cac9
PB
93 if [ "x"$(LIB_PATH) = "x" ]; then ./mkscript < $< >$*.x ; \
94 else \
95 (sed <$< -e '/SEARCH_DIR(.*)/d' ; \
96 echo $(LIB_PATH) | tr ':' ' ' | sed -e 's/\([^ ][^ ]*\)/SEARCH_DIR(\1);/g';) | ./mkscript >$*.x;\
97 fi
98# ./mkscript < $< >$*.x
e1e5fbfc
PB
99.scu.xu:
100 ./mkscript < $< >$*.xu
101.scr.xr:
102 ./mkscript < $< >$*.xr
b7e24eef
PB
103.scn.xn:
104 ./mkscript < $< >$*.xn
e1e5fbfc
PB
105.sc.xu:
106 sed $(SED_MAKE_RELOC_WITH_CONSTRUCTORS) < $< | ./mkscript >$*.xu
107.sc.xr:
108 sed $(SED_MAKE_RELOC_WITH_CONSTRUCTORS) $(SED_REMOVE_CONSTRUCTORS) \
109 < $< | ./mkscript >$*.xr
b7e24eef
PB
110.sc.xn:
111 sed $(SED_DONT_ALIGN) < $< | ./mkscript >$*.xn
eb02fd64
RP
112
113# for self hosting
e45bef1e
RP
114BFDLIB=$(unsubdir)/../bfd$(subdir)/libbfd.a
115LIBIBERTY=$(unsubdir)/../libiberty$(subdir)/libiberty.a
eb02fd64 116
c252bac8 117OFILES= ldgram.o ldlex.o ldlang.o ldmain.o ldwarn.o ldwrite.o ldexp.o ldlnk960.o ldgld68k.o ldindr.o \
565a4c76 118 ldm88k.o ldglda29k.o news.o h8300hds.o ebmon29k.o \
239d28f3 119 ldgld.o ldgld960.o ldemul.o ldver.o ldmisc.o ldsym.o ldvanilla.o ldfile.o
eb02fd64 120
c252bac8 121HEADERS=config.h ldmain.h ldmain.h ldwarn.h ldmisc.h ldindr.h ldsym.h ldlang.h ldexp.h \
239d28f3 122 ldlex.h ldwrite.h ldver.h ldemul.h ldfile.h ldgram.h ld.h
eb02fd64
RP
123
124MANSOURCES=ld.tex
125
c252bac8 126LDCSOURCES=ldlang.c ldindr.c ldmain.c ldwrite.c ldwarn.c ldlnk960.c ldgld.c ldgld68k.c \
1baac72e 127 ldm88k.c ldgld29k.c \
239d28f3 128 ldgld960.c ldemul.c ldver.c ldmisc.c ldexp.c ldsym.c ldfile.c ldvanilla.c
eb02fd64 129
cc964c6f
SC
130GENERATED_SOURCES=ldgram.c ldlex.c ldgram.h
131GENERATED_HEADERS=ldgram.h
eb02fd64 132
cc964c6f 133LDSOURCES=$(LDCSOURCES) ldgram.y ldlex.l ldgram.h
eb02fd64 134
2ee11735 135BFDSOURCES=../../bfd/common/*.c
eb02fd64
RP
136
137SOURCES= $(LDSOURCES) $(BFDSOURCES)
138LINTSOURCES= $(LDCSOURCES) $(BFDSOURCES) $(GENERATED_SOURCES)
139
e1e5fbfc 140STAGESTUFF = *.x *.x[ru] *.sc[ru] $(GENERATED_SOURCES) $(GENERATED_HEADERS) $(OFILES) $(LD_PROG) mkscript
2ee11735 141
e1e5fbfc 142all: Makefile $(LD_PROG)
2ee11735 143
4976e6ab 144ldgram.h ldgram.c: ldgram.y
e46cdcdd 145 $(BISON) $(BISONFLAGS) -d $(VPATH)/ldgram.y -o ldgram.c
3e0f5f4f 146# These are in case BISON is really yacc (which ignores -o).
565a4c76
SC
147 if [ -f y.tab.c -a ! -f ldgram.c ]; then mv y.tab.c ldgram.c; else true ; fi
148 if [ -f y.tab.h -a ! -f ldgram.h ]; then mv y.tab.h ldgram.h; else true ; fi
cc964c6f 149
4976e6ab 150ldlex.c: ldlex.l
cc964c6f
SC
151 lex -t $(VPATH)/ldlex.l >ldlex.c
152
19b03b7a 153
ee17cac9 154ldgld.c: $(srcdir)/ldtemplate
e1e5fbfc 155 sed -e s/"<ldtarget>"/ldgld/g -e s/"<arch>"/m68k/g \
ee17cac9
PB
156 -e s/"<target>"//g -e s/"<TARGET>"//g <$< >$@
157news.c: $(srcdir)/ldtemplate
e1e5fbfc 158 sed -e s/"<ldtarget>"/news/g -e s/"<arch>"/m68k/g \
ee17cac9 159 -e s/"<target>"/news/g -e s/"<TARGET>"/NEWS/g <$< >$@
565a4c76
SC
160
161ebmon29k.c: $(srcdir)/ldtemplate
162 sed -e s/"<ldtarget>"/ebmon29k/g -e s/"<arch>"/a29k/g \
163 -e s/"gld<target>"/ebmon29k/g -e s/"GLD<TARGET>"/EBMON29K/g \
164 -e s/"<ldtarget>.x"/ebmon.x/ <$< >$@
165
ee17cac9 166ldgld68k.c: $(srcdir)/ldtemplate
e1e5fbfc 167 sed -e s/"<ldtarget>"/ldgld68k/g -e s/"<arch>"/m68k/g \
ee17cac9
PB
168 -e s/"<target>"/68k/g -e s/"<TARGET>"/68K/g <$< >$@
169ldglda29k.c: $(srcdir)/ldtemplate
e1e5fbfc 170 sed -e s/"<ldtarget>"/ldglda29k/g -e s/"<arch>"/a29k/g \
ee17cac9
PB
171 -e s/"<target>"/29k/g -e s/"<TARGET>"/29K/g <$< >$@
172ldm88k.c: $(srcdir)/ldtemplate
e1e5fbfc 173 sed -e s/"<ldtarget>"/ldm88k/g -e s/"<arch>"/m88k/g \
ee17cac9 174 -e s/"<target>"/m88kbcs/g -e s/"<TARGET>"/M88KBCS/g <$< >$@
e1e5fbfc
PB
175
176# The .c files for these are generated from ldtemplete.
b7e24eef
PB
177ldgld.o: ./mkscript ldgld.x ldgld.xr ldgld.xu ldgld.xn
178news.o: ./mkscript news.x news.xr news.xu news.xn
179ebmon29k.o: ./mkscript ebmon29k.x ebmon29k.xr ebmon29k.xu ebmon29k.xn
180ldgld68k.o: ./mkscript ldgld68k.x ldgld68k.xr ldgld68k.xu ldgld68k.xn
181ldglda29k.o: ./mkscript ldglda29k.x ldglda29k.xr ldglda29k.xu ldglda29k.xn
182ldm88k.o: ./mkscript ldm88k.x ldm88k.xr ldm88k.xu ldm88k.xn
e1e5fbfc
PB
183
184# The .c files for these are (for now) specially written (not ldtemplete).
185ldgld960.o: ./mkscript ldgld960.x
186ldlnk960.o: ./mkscript ldlnk960.x ldlnk960.xr
bee36ac3 187h8300hds.o: ./mkscript h8300hds.x
e1e5fbfc 188
2ee11735
RP
189
190#$(BFDLIB): $(BFDSOURCES)
191# (cd ../bfd; make)
eb02fd64 192
e77463a1 193$(LD_PROG): $(OFILES) $(BFDLIB) $(LIBIBERTY)
fe9c20e2 194 $(CC) $(CFLAGS) $(LDFLAGS) -o $(LD_PROG) $(OFILES) $(BFDLIB) $(LIBIBERTY) $(LOADLIBES)
e7921bd4 195
eb02fd64 196# (cd ../bfd; make)
239d28f3 197# LDEMULATION=gld; export LDEMULATION; GNUTARGET=a.out-sunos-big;./ldok -format a.out-sunos-big -o ld /lib/crt0.o $(OFILES) $(BFDLIB) $(LIBIBERTY) -lc /usr/local/lib/gcc/sparc/1.91/gnulib
e77463a1
JG
198# gld -o ld /lib/crt0.o $(OFILES) $(BFDLIB) $(LIBIBERTY) -lc /usr/local/lib/gcc/sparc/1.91/gnulib
199# $(CC) -Bstatic -o ld.new $(OFILES) $(BFDLIB) $(LIBIBERTY)
eb02fd64
RP
200
201
f78e2569 202ld1: ld.new
e77463a1 203 $(HOSTING_EMU); ./ld.new -o ld1 $(HOSTING_CRT0) $(OFILES) $(BFDLIB) $(LIBIBERTY) $(HOSTING_LIBS)
eb02fd64
RP
204
205ld2: ld1
e77463a1 206 $(HOSTING_EMU); ./ld1 -o ld2 $(HOSTING_CRT0) $(OFILES) $(BFDLIB) $(LIBIBERTY) $(HOSTING_LIBS)
eb02fd64
RP
207
208ld3: ld2
e77463a1 209 $(HOSTING_EMU); ./ld2 -o ld3 $(HOSTING_CRT0) $(OFILES) $(BFDLIB) $(LIBIBERTY) $(HOSTING_LIBS)
eb02fd64 210
8073190b
RP
211######################################################################
212# DOCUMENTATION TARGETS
213# TeX output
8d317d2a
RP
214ld.dvi: ld.texinfo
215 TEXINPUTS=${TEXIDIR}:.:$$TEXINPUTS tex ld.texinfo
216 texindex ld.??
217 TEXINPUTS=${TEXIDIR}:.:$$TEXINPUTS tex ld.texinfo
218
8073190b 219# info file for online browsing
8d317d2a
RP
220ld.info: ld.texinfo
221 makeinfo ld.texinfo
eb02fd64 222
8073190b 223# roff output (-ms)
10a69a37
RP
224# edit instances of "ms" to "me" or "mm" to suit your preferences.
225# (we don't use a variable because we don't trust all makes to handle
226# a var in the target name right).
8073190b
RP
227ld.ms: ld.texinfo
228 sed -e '/\\input texinfo/d' \
229 -e '/@c TEXI2ROFF-KILL/,/@c END TEXI2ROFF-KILL/d' \
230 ld.texinfo | \
231 texi2roff $(TEXI2OPT) -ms >ld.ms
232
233# index for roff output
234ld-index.ms: ld.ms
235 $(ROFF) -ms ld.ms 2>&1 1>/dev/null | \
236 sed -e '/: warning:/d' | \
237 texi2index >ld-index.ms
238
239######################################################################
240
e0220a5b 241mkscript: $(srcdir)/mkscript.c
30104b16 242 $(CC) $(CFLAGS) $(LDFLAGS) -o mkscript $(srcdir)/mkscript.c $(LOADLIBES)
f78e2569 243
cc964c6f
SC
244ldlex.c: ldlex.l ldgram.h
245ldlex.o: ldlex.c ldgram.h
246ldgram.o: ldgram.c
247ldgram.c:ldgram.y
eb02fd64 248
30104b16
SC
249ldgld68k.x :ldgld68k.sc
250ldgld68kUr.x :ldgld68kUr.sc
251ldgld68kr.x :ldgld68kr.sc
bee36ac3 252h8300hds.x:h8300hds.sc
30104b16
SC
253ldgld.x :ldgld.sc
254ldgldUr.x :ldgldUr.sc
255ldgldr.x :ldgldr.sc
256ldlnk960.x :ldlnk960.sc
257ldlnk960r.x :ldlnk960r.sc
258ldgld960.x :ldgld960.sc
1e332873
SC
259ldgldm88k.x :ldgldm88k.sc
260ldm88kUr.x :ldm88kUr.sc
261ldm88kr.x:ldm88kr.sc
30104b16
SC
262ldgld68k.x:ldgld68k.sc
263ldglda29k.x :ldglda29k.sc
264ldglda29kr.x :ldglda29kr.sc
265ldglda29kUr.x :ldglda29kUr.sc
eb02fd64 266
565a4c76
SC
267ebmon29k.x :ebmon29k.sc
268ebmon29kr.x :ebmon29kr.sc
269ebmon29kUr.x :ebmon29kUr.sc
270
e7921bd4
RP
271stage1: force
272 - mkdir stage1
273 - mv -f $(STAGESTUFF) stage1
274 - (cd stage1 ; ln -s $(LD_PROG) ld)
f78e2569 275
e7921bd4
RP
276stage2: force
277 - mkdir stage2
278 - mv -f $(STAGESTUFF) stage2
279 - (cd stage2 ; ln -s $(LD_PROG) ld)
f78e2569 280
e7921bd4
RP
281stage3: force
282 - mkdir stage3
283 - mv -f $(STAGESTUFF) stage3
284 - (cd stage3 ; ln -s $(LD_PROG) ld)
eb02fd64 285
e46cdcdd
RP
286against=stage2
287
288comparison: force
289 for i in $(STAGESTUFF) ; do cmp $$i $(against)/$$i ; done
290
e7921bd4
RP
291de-stage1: force
292 - (cd stage1 ; mv -f * ..)
293 - rm ld
294 - rmdir stage1
295
296de-stage2: force
297 - (cd stage2 ; mv -f * ..)
298 - rm ld
299 - rmdir stage2
300
301de-stage3: force
302 - (cd stage3 ; mv -f * ..)
303 - rm ld
304 - rmdir stage3
305
306clean:
307 - rm -f TAGS $(OFILES) $(GENERATED_SOURCES) $(GENERATED_HEADERS)
e1e5fbfc 308 - rm -f *.x *.x[ru] *.sc[ur]
8d317d2a 309 - rm -f ld.?? ld.???
e7921bd4 310 - rm -f ld ld1 ld2 ld3 ld.new mkscript *.o y.output
eb02fd64
RP
311
312lintlog:$(SOURCES) Makefile
2ee11735 313 $(LINT) -abhxzn $(LINTFLAGS) $(LINTSOURCES) \
eb02fd64
RP
314| grep -v "pointer casts may be troublesome" \
315| grep -v "possible pointer alignment problem" \
316| grep -v "ignore" \
317| grep -v "conversion from long may lose accuracy" \
318| grep -v "warning: constant argument to NOT" \
319| grep -v "enumeration type clash, operator CAST" \
320| grep -v "warning: constant in conditional context"\
321| grep -v "archive\.c"
322
323
324tags TAGS:$(SOURCES) $(HEADERS)
19b03b7a 325 etags -t $?
eb02fd64
RP
326
327release:
328 (cd /4/steve/ld; tar cf - $(LDSOURCES) $(HEADERS) $(MANSOURCES)) | tar xf -
329
330objdump:objdump.c
331
e7921bd4 332install: $(LD_PROG)
565a4c76
SC
333# $(INSTALL_PROGRAM) ld.new $(libsubdir)/ld
334 cp $(LD_PROG) $(bindir)/ld.new
335 mv -f $(bindir)/ld.new $(bindir)/ld
eb02fd64
RP
336
337#-----------------------------------------------------------------------------
338# 'STANDARD' GNU/960 TARGETS BELOW THIS POINT
339#
340# 'VERSION' file must be present and contain a string of the form "x.y"
341#-----------------------------------------------------------------------------
342
343ver960.c: FORCE
344 rm -f ver960.c
345 echo "char ${TARG}_ver[]= \"${TARG} `cat VERSION`, `date`\";" > ver960.c
346
347
348# This target should be invoked before building a new release.
349# 'VERSION' file must be present and contain a string of the form "x.y"
350#
351roll:
352 @V=`cat VERSION` ; \
353 MAJ=`sed 's/\..*//' VERSION` ; \
354 MIN=`sed 's/.*\.//' VERSION` ; \
355 V=$$MAJ.`expr $$MIN + 1` ; \
356 rm -f VERSION ; \
357 echo $$V >VERSION ; \
358 echo Version $$V
359
239d28f3 360
e1e5fbfc 361dep: $(LDSOURCES)
239d28f3
SC
362 mkdep $(CFLAGS) $?
363
eb02fd64
RP
364# Dummy target to force execution of dependent targets.
365#
e7921bd4 366force:
eb02fd64
RP
367
368# Target to uncomment host-specific lines in this makefile. Such lines must
369# have the following string beginning in column 1: #__<hostname>__#
370# Original Makefile is backed up as 'Makefile.old'.
371#
372# Invoke with: make make HOST=xxx
373#
374make:
375 -@if test $(HOST)x = x ; then \
376 echo '\aSpecify "make make HOST=???"'; \
377 exit 1; \
378 fi ; \
379 grep -s "^#The next line was generated by 'make make'" Makefile; \
380 if test $$? = 0 ; then \
381 echo "\aMakefile has already been processed with 'make make'";\
382 exit 1; \
383 fi ; \
384 mv -f Makefile Makefile.old; \
385 echo "#The next line was generated by 'make make'" >Makefile ; \
386 echo "HOST=$(HOST)" >>Makefile ; \
387 echo >>Makefile ; \
388 sed "s/^#__$(HOST)__#//" < Makefile.old >>Makefile
389
390#\f
391
f1eb48b6 392Makefile: $(srcdir)/Makefile.in $(host_makefile_frag) $(target_makefile_frag)
a26878d1 393 $(SHELL) ./config.status
eb02fd64
RP
394
395### Local Variables: ***
396### mode:fundamental ***
397### page-delimiter: "^#\f" ***
398### End: ***
399### end of file
239d28f3
SC
400
401
402# IF YOU PUT ANYTHING HERE IT WILL GO AWAY
This page took 0.140624 seconds and 4 git commands to generate.