Added ctor.c (I remembered this time)
[deliverable/binutils-gdb.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
954ac2ea
RP
35TEXI2OPT =
36# You neeed this to generate ld-index.ms (or .mm or .me)
37# TEXI2OPT = -i
8073190b
RP
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
972e7b4b 55.SUFFIXES: .y .x .xr .xu .xn .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.
972e7b4b
PB
66# A .scn script is for linking with -N flag (mix text and data on same page).
67# A .scN script is for linking with -N flag (mix text and data on same page).
b7e24eef 68# The diference is that segments should (need) not be page aligned.
e1e5fbfc
PB
69
70# A sed pattern to translate .sc to .scu:
71SED_MAKE_RELOC_WITH_CONSTRUCTORS=\
72 -e "/If relocating/,/End if relocating/d" \
6719c75b
PB
73 -e "/=/s/[_a-zA-Z.]* *= .*//g" \
74 -e '/>/s/} *> *[a-zA-Z]*/}/' \
e1e5fbfc
PB
75 -e "/text/s/[.]text .*:/.text :/" \
76 -e "/data/s/[.]data .*:/.data :/"
77# A sed pattern to translate .scu to .scr:
78SED_REMOVE_CONSTRUCTORS= -e /CONSTRUCTORS/d
79
80.sc.scu:
81 sed $(SED_MAKE_RELOC_WITH_CONSTRUCTORS) $< >$*.scu
82.scu.scr:
83 sed $(SED_REMOVE_CONSTRUCTORS) < $< >$*.scr
84
972e7b4b
PB
85# Each builtin script file is included as a C string literal.
86# These are generated by the mkscript filter.
30104b16 87.sc.x:
ee17cac9
PB
88 if [ "x"$(LIB_PATH) = "x" ]; then ./mkscript < $< >$*.x ; \
89 else \
90 (sed <$< -e '/SEARCH_DIR(.*)/d' ; \
91 echo $(LIB_PATH) | tr ':' ' ' | sed -e 's/\([^ ][^ ]*\)/SEARCH_DIR(\1);/g';) | ./mkscript >$*.x;\
92 fi
972e7b4b
PB
93
94# The .xn script is used if the -n flag is given (write-protect text)..
95# Sunos starts the text segment for demand-paged binaries at 0x2020
96# and other binaries at 0x2000, since the exec header is paged in
97# with the text. Some other Unix variants do the same.
98# For -n and -N flags the offset of the exec header must be removed.
99# This sed script does this if the master script contains
100# a line of the form ".text 0xAAAA BLOCK(0xBBBB):" - the
101# output will contain ".text 0xBBBB:". (For Sunos AAAA=2020 and BBBB=2000.)
102.x.xn:
103 sed -e '/text/s/\.text .* BLOCK(\([^)]*\)):/.text \1:/' < $< >$*.xn
104
105# The .xN script is used if the -N flag is given (don't write-protect text).
106# This is like -n, except that the data segment need not be page-aligned.
107# So get rid of commands for page-alignment: We assume these use ALIGN
108# with a hex constant that end with 00, since any normal page size is be
109# at least divisible by 256. We use the 00 to avoid matching
110# anything that tries to align of (say) 8-byte boundaries.
111.xn.xN:
112 sed -e '/ALIGN/s/ALIGN( *0x[0-9a-fA-F]*00 *)/./' < $< >$*.xN
113
114# The xu and xr scripts don't search libraries, so LIB_PATH doesn't matter.
e1e5fbfc
PB
115.sc.xu:
116 sed $(SED_MAKE_RELOC_WITH_CONSTRUCTORS) < $< | ./mkscript >$*.xu
117.sc.xr:
118 sed $(SED_MAKE_RELOC_WITH_CONSTRUCTORS) $(SED_REMOVE_CONSTRUCTORS) \
119 < $< | ./mkscript >$*.xr
eb02fd64
RP
120
121# for self hosting
e45bef1e
RP
122BFDLIB=$(unsubdir)/../bfd$(subdir)/libbfd.a
123LIBIBERTY=$(unsubdir)/../libiberty$(subdir)/libiberty.a
eb02fd64 124
c252bac8 125OFILES= ldgram.o ldlex.o ldlang.o ldmain.o ldwarn.o ldwrite.o ldexp.o ldlnk960.o ldgld68k.o ldindr.o \
565a4c76 126 ldm88k.o ldglda29k.o news.o h8300hds.o ebmon29k.o \
239d28f3 127 ldgld.o ldgld960.o ldemul.o ldver.o ldmisc.o ldsym.o ldvanilla.o ldfile.o
eb02fd64 128
c252bac8 129HEADERS=config.h ldmain.h ldmain.h ldwarn.h ldmisc.h ldindr.h ldsym.h ldlang.h ldexp.h \
239d28f3 130 ldlex.h ldwrite.h ldver.h ldemul.h ldfile.h ldgram.h ld.h
eb02fd64
RP
131
132MANSOURCES=ld.tex
133
c252bac8 134LDCSOURCES=ldlang.c ldindr.c ldmain.c ldwrite.c ldwarn.c ldlnk960.c ldgld.c ldgld68k.c \
1baac72e 135 ldm88k.c ldgld29k.c \
239d28f3 136 ldgld960.c ldemul.c ldver.c ldmisc.c ldexp.c ldsym.c ldfile.c ldvanilla.c
eb02fd64 137
cc964c6f
SC
138GENERATED_SOURCES=ldgram.c ldlex.c ldgram.h
139GENERATED_HEADERS=ldgram.h
eb02fd64 140
cc964c6f 141LDSOURCES=$(LDCSOURCES) ldgram.y ldlex.l ldgram.h
eb02fd64 142
2ee11735 143BFDSOURCES=../../bfd/common/*.c
eb02fd64
RP
144
145SOURCES= $(LDSOURCES) $(BFDSOURCES)
146LINTSOURCES= $(LDCSOURCES) $(BFDSOURCES) $(GENERATED_SOURCES)
147
e1e5fbfc 148STAGESTUFF = *.x *.x[ru] *.sc[ru] $(GENERATED_SOURCES) $(GENERATED_HEADERS) $(OFILES) $(LD_PROG) mkscript
2ee11735 149
e1e5fbfc 150all: Makefile $(LD_PROG)
2ee11735 151
4976e6ab 152ldgram.h ldgram.c: ldgram.y
e46cdcdd 153 $(BISON) $(BISONFLAGS) -d $(VPATH)/ldgram.y -o ldgram.c
3e0f5f4f 154# These are in case BISON is really yacc (which ignores -o).
565a4c76
SC
155 if [ -f y.tab.c -a ! -f ldgram.c ]; then mv y.tab.c ldgram.c; else true ; fi
156 if [ -f y.tab.h -a ! -f ldgram.h ]; then mv y.tab.h ldgram.h; else true ; fi
cc964c6f 157
4976e6ab 158ldlex.c: ldlex.l
cc964c6f
SC
159 lex -t $(VPATH)/ldlex.l >ldlex.c
160
19b03b7a 161
ee17cac9 162ldgld.c: $(srcdir)/ldtemplate
e1e5fbfc 163 sed -e s/"<ldtarget>"/ldgld/g -e s/"<arch>"/m68k/g \
33ce0085 164 -e s/"<target>"//g -e s/"<TARGET>"//g <$(srcdir)/ldtemplate >$@
ee17cac9 165news.c: $(srcdir)/ldtemplate
e1e5fbfc 166 sed -e s/"<ldtarget>"/news/g -e s/"<arch>"/m68k/g \
33ce0085 167 -e s/"<target>"/news/g -e s/"<TARGET>"/NEWS/g <$(srcdir)/ldtemplate >$@
565a4c76
SC
168
169ebmon29k.c: $(srcdir)/ldtemplate
170 sed -e s/"<ldtarget>"/ebmon29k/g -e s/"<arch>"/a29k/g \
171 -e s/"gld<target>"/ebmon29k/g -e s/"GLD<TARGET>"/EBMON29K/g \
33ce0085 172 -e s/"<ldtarget>.x"/ebmon.x/ <$(srcdir)/ldtemplate >$@
565a4c76 173
ee17cac9 174ldgld68k.c: $(srcdir)/ldtemplate
e1e5fbfc 175 sed -e s/"<ldtarget>"/ldgld68k/g -e s/"<arch>"/m68k/g \
33ce0085 176 -e s/"<target>"/68k/g -e s/"<TARGET>"/68K/g <$(srcdir)/ldtemplate >$@
ee17cac9 177ldglda29k.c: $(srcdir)/ldtemplate
e1e5fbfc 178 sed -e s/"<ldtarget>"/ldglda29k/g -e s/"<arch>"/a29k/g \
33ce0085 179 -e s/"<target>"/29k/g -e s/"<TARGET>"/29K/g <$(srcdir)/ldtemplate >$@
ee17cac9 180ldm88k.c: $(srcdir)/ldtemplate
e1e5fbfc 181 sed -e s/"<ldtarget>"/ldm88k/g -e s/"<arch>"/m88k/g \
33ce0085 182 -e s/"<target>"/m88kbcs/g -e s/"<TARGET>"/M88KBCS/g <$(srcdir)/ldtemplate >$@
e1e5fbfc
PB
183
184# The .c files for these are generated from ldtemplete.
972e7b4b
PB
185ldgld.o: ./mkscript ldgld.x ldgld.xr ldgld.xu ldgld.xn ldgld.xN
186news.o: ./mkscript news.x news.xr news.xu news.xn news.xN
187ebmon29k.o: ./mkscript ebmon29k.x ebmon29k.xr ebmon29k.xu \
188 ebmon29k.xn ebmon29k.xN
189ldgld68k.o: ./mkscript ldgld68k.x ldgld68k.xr ldgld68k.xu \
190 ldgld68k.xn ldgld68k.xN
191ldglda29k.o: ./mkscript ldglda29k.x ldglda29k.xr ldglda29k.xu \
192 ldglda29k.xn ldglda29k.xN
193ldm88k.o: ./mkscript ldm88k.x ldm88k.xr ldm88k.xu ldm88k.xn ldm88k.xN
e1e5fbfc
PB
194
195# The .c files for these are (for now) specially written (not ldtemplete).
196ldgld960.o: ./mkscript ldgld960.x
197ldlnk960.o: ./mkscript ldlnk960.x ldlnk960.xr
bee36ac3 198h8300hds.o: ./mkscript h8300hds.x
e1e5fbfc 199
2ee11735
RP
200
201#$(BFDLIB): $(BFDSOURCES)
202# (cd ../bfd; make)
eb02fd64 203
e77463a1 204$(LD_PROG): $(OFILES) $(BFDLIB) $(LIBIBERTY)
fe9c20e2 205 $(CC) $(CFLAGS) $(LDFLAGS) -o $(LD_PROG) $(OFILES) $(BFDLIB) $(LIBIBERTY) $(LOADLIBES)
e7921bd4 206
eb02fd64 207# (cd ../bfd; make)
239d28f3 208# 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
209# gld -o ld /lib/crt0.o $(OFILES) $(BFDLIB) $(LIBIBERTY) -lc /usr/local/lib/gcc/sparc/1.91/gnulib
210# $(CC) -Bstatic -o ld.new $(OFILES) $(BFDLIB) $(LIBIBERTY)
eb02fd64
RP
211
212
f78e2569 213ld1: ld.new
e77463a1 214 $(HOSTING_EMU); ./ld.new -o ld1 $(HOSTING_CRT0) $(OFILES) $(BFDLIB) $(LIBIBERTY) $(HOSTING_LIBS)
eb02fd64
RP
215
216ld2: ld1
e77463a1 217 $(HOSTING_EMU); ./ld1 -o ld2 $(HOSTING_CRT0) $(OFILES) $(BFDLIB) $(LIBIBERTY) $(HOSTING_LIBS)
eb02fd64
RP
218
219ld3: ld2
e77463a1 220 $(HOSTING_EMU); ./ld2 -o ld3 $(HOSTING_CRT0) $(OFILES) $(BFDLIB) $(LIBIBERTY) $(HOSTING_LIBS)
eb02fd64 221
8073190b
RP
222######################################################################
223# DOCUMENTATION TARGETS
224# TeX output
8d317d2a
RP
225ld.dvi: ld.texinfo
226 TEXINPUTS=${TEXIDIR}:.:$$TEXINPUTS tex ld.texinfo
227 texindex ld.??
228 TEXINPUTS=${TEXIDIR}:.:$$TEXINPUTS tex ld.texinfo
229
8073190b 230# info file for online browsing
8d317d2a
RP
231ld.info: ld.texinfo
232 makeinfo ld.texinfo
eb02fd64 233
954ac2ea
RP
234#separate targets for "ms", "me", and "mm" forms of roff doc
235# (we don't use a variable because we don't trust all makes to handle
236# a var in the target name right).
8073190b
RP
237# roff output (-ms)
238ld.ms: ld.texinfo
239 sed -e '/\\input texinfo/d' \
240 -e '/@c TEXI2ROFF-KILL/,/@c END TEXI2ROFF-KILL/d' \
241 ld.texinfo | \
242 texi2roff $(TEXI2OPT) -ms >ld.ms
243
244# index for roff output
245ld-index.ms: ld.ms
246 $(ROFF) -ms ld.ms 2>&1 1>/dev/null | \
247 sed -e '/: warning:/d' | \
248 texi2index >ld-index.ms
249
954ac2ea
RP
250# roff output (-mm)
251ld.mm: ld.texinfo
252 sed -e '/\\input texinfo/d' \
253 -e '/@c TEXI2ROFF-KILL/,/@c END TEXI2ROFF-KILL/d' \
254 ld.texinfo | \
255 texi2roff $(TEXI2OPT) -mm >ld.mm
256
257# index for roff output
258ld-index.mm: ld.mm
259 $(ROFF) -mm ld.mm 2>&1 1>/dev/null | \
260 sed -e '/: warning:/d' | \
261 texi2index >ld-index.mm
262
263# roff output (-me)
264ld.me: ld.texinfo
265 sed -e '/\\input texinfo/d' \
266 -e '/@c TEXI2ROFF-KILL/,/@c END TEXI2ROFF-KILL/d' \
267 ld.texinfo | \
268 texi2roff $(TEXI2OPT) -me >ld.me
269
270# index for roff output
271ld-index.me: ld.me
272 $(ROFF) -me ld.me 2>&1 1>/dev/null | \
273 sed -e '/: warning:/d' | \
274 texi2index >ld-index.me
275
276
8073190b
RP
277######################################################################
278
e0220a5b 279mkscript: $(srcdir)/mkscript.c
30104b16 280 $(CC) $(CFLAGS) $(LDFLAGS) -o mkscript $(srcdir)/mkscript.c $(LOADLIBES)
f78e2569 281
cc964c6f
SC
282ldlex.c: ldlex.l ldgram.h
283ldlex.o: ldlex.c ldgram.h
284ldgram.o: ldgram.c
285ldgram.c:ldgram.y
eb02fd64 286
30104b16
SC
287ldgld68k.x :ldgld68k.sc
288ldgld68kUr.x :ldgld68kUr.sc
289ldgld68kr.x :ldgld68kr.sc
bee36ac3 290h8300hds.x:h8300hds.sc
30104b16
SC
291ldgld.x :ldgld.sc
292ldgldUr.x :ldgldUr.sc
293ldgldr.x :ldgldr.sc
294ldlnk960.x :ldlnk960.sc
295ldlnk960r.x :ldlnk960r.sc
296ldgld960.x :ldgld960.sc
1e332873
SC
297ldgldm88k.x :ldgldm88k.sc
298ldm88kUr.x :ldm88kUr.sc
299ldm88kr.x:ldm88kr.sc
33ce0085
JG
300ldm88k.x:ldm88k.sc
301news.x:news.sc
302h8300hds.x:h8300hds.sc
303h8300hds.o:h8300hds.c
30104b16
SC
304ldgld68k.x:ldgld68k.sc
305ldglda29k.x :ldglda29k.sc
306ldglda29kr.x :ldglda29kr.sc
307ldglda29kUr.x :ldglda29kUr.sc
eb02fd64 308
565a4c76
SC
309ebmon29k.x :ebmon29k.sc
310ebmon29kr.x :ebmon29kr.sc
311ebmon29kUr.x :ebmon29kUr.sc
312
e7921bd4
RP
313stage1: force
314 - mkdir stage1
315 - mv -f $(STAGESTUFF) stage1
316 - (cd stage1 ; ln -s $(LD_PROG) ld)
f78e2569 317
e7921bd4
RP
318stage2: force
319 - mkdir stage2
320 - mv -f $(STAGESTUFF) stage2
321 - (cd stage2 ; ln -s $(LD_PROG) ld)
f78e2569 322
e7921bd4
RP
323stage3: force
324 - mkdir stage3
325 - mv -f $(STAGESTUFF) stage3
326 - (cd stage3 ; ln -s $(LD_PROG) ld)
eb02fd64 327
e46cdcdd
RP
328against=stage2
329
330comparison: force
331 for i in $(STAGESTUFF) ; do cmp $$i $(against)/$$i ; done
332
e7921bd4
RP
333de-stage1: force
334 - (cd stage1 ; mv -f * ..)
335 - rm ld
336 - rmdir stage1
337
338de-stage2: force
339 - (cd stage2 ; mv -f * ..)
340 - rm ld
341 - rmdir stage2
342
343de-stage3: force
344 - (cd stage3 ; mv -f * ..)
345 - rm ld
346 - rmdir stage3
347
348clean:
349 - rm -f TAGS $(OFILES) $(GENERATED_SOURCES) $(GENERATED_HEADERS)
972e7b4b 350 - rm -f *.x *.x[runN] *.sc[runN]
8d317d2a 351 - rm -f ld.?? ld.???
e7921bd4 352 - rm -f ld ld1 ld2 ld3 ld.new mkscript *.o y.output
eb02fd64
RP
353
354lintlog:$(SOURCES) Makefile
2ee11735 355 $(LINT) -abhxzn $(LINTFLAGS) $(LINTSOURCES) \
eb02fd64
RP
356| grep -v "pointer casts may be troublesome" \
357| grep -v "possible pointer alignment problem" \
358| grep -v "ignore" \
359| grep -v "conversion from long may lose accuracy" \
360| grep -v "warning: constant argument to NOT" \
361| grep -v "enumeration type clash, operator CAST" \
362| grep -v "warning: constant in conditional context"\
363| grep -v "archive\.c"
364
365
366tags TAGS:$(SOURCES) $(HEADERS)
19b03b7a 367 etags -t $?
eb02fd64
RP
368
369release:
370 (cd /4/steve/ld; tar cf - $(LDSOURCES) $(HEADERS) $(MANSOURCES)) | tar xf -
371
372objdump:objdump.c
373
e7921bd4 374install: $(LD_PROG)
565a4c76
SC
375# $(INSTALL_PROGRAM) ld.new $(libsubdir)/ld
376 cp $(LD_PROG) $(bindir)/ld.new
377 mv -f $(bindir)/ld.new $(bindir)/ld
eb02fd64
RP
378
379#-----------------------------------------------------------------------------
380# 'STANDARD' GNU/960 TARGETS BELOW THIS POINT
381#
382# 'VERSION' file must be present and contain a string of the form "x.y"
383#-----------------------------------------------------------------------------
384
385ver960.c: FORCE
386 rm -f ver960.c
387 echo "char ${TARG}_ver[]= \"${TARG} `cat VERSION`, `date`\";" > ver960.c
388
389
390# This target should be invoked before building a new release.
391# 'VERSION' file must be present and contain a string of the form "x.y"
392#
393roll:
394 @V=`cat VERSION` ; \
395 MAJ=`sed 's/\..*//' VERSION` ; \
396 MIN=`sed 's/.*\.//' VERSION` ; \
397 V=$$MAJ.`expr $$MIN + 1` ; \
398 rm -f VERSION ; \
399 echo $$V >VERSION ; \
400 echo Version $$V
401
239d28f3 402
e1e5fbfc 403dep: $(LDSOURCES)
239d28f3
SC
404 mkdep $(CFLAGS) $?
405
eb02fd64
RP
406# Dummy target to force execution of dependent targets.
407#
e7921bd4 408force:
eb02fd64
RP
409
410# Target to uncomment host-specific lines in this makefile. Such lines must
411# have the following string beginning in column 1: #__<hostname>__#
412# Original Makefile is backed up as 'Makefile.old'.
413#
414# Invoke with: make make HOST=xxx
415#
416make:
417 -@if test $(HOST)x = x ; then \
418 echo '\aSpecify "make make HOST=???"'; \
419 exit 1; \
420 fi ; \
421 grep -s "^#The next line was generated by 'make make'" Makefile; \
422 if test $$? = 0 ; then \
423 echo "\aMakefile has already been processed with 'make make'";\
424 exit 1; \
425 fi ; \
426 mv -f Makefile Makefile.old; \
427 echo "#The next line was generated by 'make make'" >Makefile ; \
428 echo "HOST=$(HOST)" >>Makefile ; \
429 echo >>Makefile ; \
430 sed "s/^#__$(HOST)__#//" < Makefile.old >>Makefile
431
432#\f
433
f1eb48b6 434Makefile: $(srcdir)/Makefile.in $(host_makefile_frag) $(target_makefile_frag)
a26878d1 435 $(SHELL) ./config.status
eb02fd64
RP
436
437### Local Variables: ***
438### mode:fundamental ***
439### page-delimiter: "^#\f" ***
440### End: ***
441### end of file
239d28f3
SC
442
443
444# IF YOU PUT ANYTHING HERE IT WILL GO AWAY
This page took 0.077255 seconds and 4 git commands to generate.