* Makefile.in: new targets ld.mm, ld.me
[deliverable/binutils-gdb.git] / ld / Makefile.in
1 #
2 # Makefile for ld version 2
3 #
4 # $Id$
5 #
6
7 srcdir = .
8
9 destdir = /usr/local
10
11 version=`$(unsubdir)/../gcc$(subdir)/gcc -dumpversion`
12 bindir = $(destdir)/H-$(host_alias)/T-$(target_alias)/bin
13 libdir = $(destdir)/H-$(host_alias)/T-$(target_alias)/lib
14 libsubdir = $(libdir)/gcc/$(target)/$(version)
15
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
20 LIB_PATH =
21
22 INSTALL = install -c
23 INSTALL_PROGRAM = $(INSTALL)
24 INSTALL_FILE = $(INSTALL)
25
26 BASEDIR = ../..
27 INCLUDE = $(srcdir)/../include
28 INCLUDES = -I. -I$(srcdir) -I$(INCLUDE)
29 DEBUG = -g
30
31 # Where to find texinfo.tex to format docn with TeX
32 TEXIDIR = $(srcdir)/../texinfo/fsf
33
34 # Whether to get roff to put indexing entries on stderr
35 TEXI2OPT =
36 # You neeed this to generate ld-index.ms (or .mm or .me)
37 # TEXI2OPT = -i
38
39 # Which roff program to use to generate index for texi2roff'd doc
40 ROFF = groff
41
42 BISON = bison
43 BISONFLAGS = -v
44
45 SCRIPTS = ldgld68k.sc ldgld.sc \
46 ldlnk960.sc ldlnk960r.sc ldgld960.sc \
47 ldm88k.sc ldglda29k.sc news.sc h8300hds.sc ebmon29k.sc
48
49 #### target and host dependent Makefile fragments come in here.
50 ###
51
52 CFLAGS = $(INCLUDES) $(DEBUG) $(HDEFINES) $(TDEFINES) $(CDEFINES)
53 LINTFLAGS = $(INCLUDES) $(EXTRA_DEF)
54
55 .SUFFIXES: .y .x .xr .xu .xn .xN .sc .scu .scr .scn $(SUFFIXES)
56
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.
60 LD_PROG = ld.new
61
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.
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).
68 # The diference is that segments should (need) not be page aligned.
69
70 # A sed pattern to translate .sc to .scu:
71 SED_MAKE_RELOC_WITH_CONSTRUCTORS=\
72 -e "/If relocating/,/End if relocating/d" \
73 -e "/=/s/[_a-zA-Z.]* *= .*//g" \
74 -e '/>/s/} *> *[a-zA-Z]*/}/' \
75 -e "/text/s/[.]text .*:/.text :/" \
76 -e "/data/s/[.]data .*:/.data :/"
77 # A sed pattern to translate .scu to .scr:
78 SED_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
85 # Each builtin script file is included as a C string literal.
86 # These are generated by the mkscript filter.
87 .sc.x:
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
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.
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
120
121 # for self hosting
122 BFDLIB=$(unsubdir)/../bfd$(subdir)/libbfd.a
123 LIBIBERTY=$(unsubdir)/../libiberty$(subdir)/libiberty.a
124
125 OFILES= ldgram.o ldlex.o ldlang.o ldmain.o ldwarn.o ldwrite.o ldexp.o ldlnk960.o ldgld68k.o ldindr.o \
126 ldm88k.o ldglda29k.o news.o h8300hds.o ebmon29k.o \
127 ldgld.o ldgld960.o ldemul.o ldver.o ldmisc.o ldsym.o ldvanilla.o ldfile.o
128
129 HEADERS=config.h ldmain.h ldmain.h ldwarn.h ldmisc.h ldindr.h ldsym.h ldlang.h ldexp.h \
130 ldlex.h ldwrite.h ldver.h ldemul.h ldfile.h ldgram.h ld.h
131
132 MANSOURCES=ld.tex
133
134 LDCSOURCES=ldlang.c ldindr.c ldmain.c ldwrite.c ldwarn.c ldlnk960.c ldgld.c ldgld68k.c \
135 ldm88k.c ldgld29k.c \
136 ldgld960.c ldemul.c ldver.c ldmisc.c ldexp.c ldsym.c ldfile.c ldvanilla.c
137
138 GENERATED_SOURCES=ldgram.c ldlex.c ldgram.h
139 GENERATED_HEADERS=ldgram.h
140
141 LDSOURCES=$(LDCSOURCES) ldgram.y ldlex.l ldgram.h
142
143 BFDSOURCES=../../bfd/common/*.c
144
145 SOURCES= $(LDSOURCES) $(BFDSOURCES)
146 LINTSOURCES= $(LDCSOURCES) $(BFDSOURCES) $(GENERATED_SOURCES)
147
148 STAGESTUFF = *.x *.x[ru] *.sc[ru] $(GENERATED_SOURCES) $(GENERATED_HEADERS) $(OFILES) $(LD_PROG) mkscript
149
150 all: Makefile $(LD_PROG)
151
152 ldgram.h ldgram.c: ldgram.y
153 $(BISON) $(BISONFLAGS) -d $(VPATH)/ldgram.y -o ldgram.c
154 # These are in case BISON is really yacc (which ignores -o).
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
157
158 ldlex.c: ldlex.l
159 lex -t $(VPATH)/ldlex.l >ldlex.c
160
161
162 ldgld.c: $(srcdir)/ldtemplate
163 sed -e s/"<ldtarget>"/ldgld/g -e s/"<arch>"/m68k/g \
164 -e s/"<target>"//g -e s/"<TARGET>"//g <$(srcdir)/ldtemplate >$@
165 news.c: $(srcdir)/ldtemplate
166 sed -e s/"<ldtarget>"/news/g -e s/"<arch>"/m68k/g \
167 -e s/"<target>"/news/g -e s/"<TARGET>"/NEWS/g <$(srcdir)/ldtemplate >$@
168
169 ebmon29k.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 \
172 -e s/"<ldtarget>.x"/ebmon.x/ <$(srcdir)/ldtemplate >$@
173
174 ldgld68k.c: $(srcdir)/ldtemplate
175 sed -e s/"<ldtarget>"/ldgld68k/g -e s/"<arch>"/m68k/g \
176 -e s/"<target>"/68k/g -e s/"<TARGET>"/68K/g <$(srcdir)/ldtemplate >$@
177 ldglda29k.c: $(srcdir)/ldtemplate
178 sed -e s/"<ldtarget>"/ldglda29k/g -e s/"<arch>"/a29k/g \
179 -e s/"<target>"/29k/g -e s/"<TARGET>"/29K/g <$(srcdir)/ldtemplate >$@
180 ldm88k.c: $(srcdir)/ldtemplate
181 sed -e s/"<ldtarget>"/ldm88k/g -e s/"<arch>"/m88k/g \
182 -e s/"<target>"/m88kbcs/g -e s/"<TARGET>"/M88KBCS/g <$(srcdir)/ldtemplate >$@
183
184 # The .c files for these are generated from ldtemplete.
185 ldgld.o: ./mkscript ldgld.x ldgld.xr ldgld.xu ldgld.xn ldgld.xN
186 news.o: ./mkscript news.x news.xr news.xu news.xn news.xN
187 ebmon29k.o: ./mkscript ebmon29k.x ebmon29k.xr ebmon29k.xu \
188 ebmon29k.xn ebmon29k.xN
189 ldgld68k.o: ./mkscript ldgld68k.x ldgld68k.xr ldgld68k.xu \
190 ldgld68k.xn ldgld68k.xN
191 ldglda29k.o: ./mkscript ldglda29k.x ldglda29k.xr ldglda29k.xu \
192 ldglda29k.xn ldglda29k.xN
193 ldm88k.o: ./mkscript ldm88k.x ldm88k.xr ldm88k.xu ldm88k.xn ldm88k.xN
194
195 # The .c files for these are (for now) specially written (not ldtemplete).
196 ldgld960.o: ./mkscript ldgld960.x
197 ldlnk960.o: ./mkscript ldlnk960.x ldlnk960.xr
198 h8300hds.o: ./mkscript h8300hds.x
199
200
201 #$(BFDLIB): $(BFDSOURCES)
202 # (cd ../bfd; make)
203
204 $(LD_PROG): $(OFILES) $(BFDLIB) $(LIBIBERTY)
205 $(CC) $(CFLAGS) $(LDFLAGS) -o $(LD_PROG) $(OFILES) $(BFDLIB) $(LIBIBERTY) $(LOADLIBES)
206
207 # (cd ../bfd; make)
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
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)
211
212
213 ld1: ld.new
214 $(HOSTING_EMU); ./ld.new -o ld1 $(HOSTING_CRT0) $(OFILES) $(BFDLIB) $(LIBIBERTY) $(HOSTING_LIBS)
215
216 ld2: ld1
217 $(HOSTING_EMU); ./ld1 -o ld2 $(HOSTING_CRT0) $(OFILES) $(BFDLIB) $(LIBIBERTY) $(HOSTING_LIBS)
218
219 ld3: ld2
220 $(HOSTING_EMU); ./ld2 -o ld3 $(HOSTING_CRT0) $(OFILES) $(BFDLIB) $(LIBIBERTY) $(HOSTING_LIBS)
221
222 ######################################################################
223 # DOCUMENTATION TARGETS
224 # TeX output
225 ld.dvi: ld.texinfo
226 TEXINPUTS=${TEXIDIR}:.:$$TEXINPUTS tex ld.texinfo
227 texindex ld.??
228 TEXINPUTS=${TEXIDIR}:.:$$TEXINPUTS tex ld.texinfo
229
230 # info file for online browsing
231 ld.info: ld.texinfo
232 makeinfo ld.texinfo
233
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).
237 # roff output (-ms)
238 ld.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
245 ld-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
250 # roff output (-mm)
251 ld.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
258 ld-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)
264 ld.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
271 ld-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
277 ######################################################################
278
279 mkscript: $(srcdir)/mkscript.c
280 $(CC) $(CFLAGS) $(LDFLAGS) -o mkscript $(srcdir)/mkscript.c $(LOADLIBES)
281
282 ldlex.c: ldlex.l ldgram.h
283 ldlex.o: ldlex.c ldgram.h
284 ldgram.o: ldgram.c
285 ldgram.c:ldgram.y
286
287 ldgld68k.x :ldgld68k.sc
288 ldgld68kUr.x :ldgld68kUr.sc
289 ldgld68kr.x :ldgld68kr.sc
290 h8300hds.x:h8300hds.sc
291 ldgld.x :ldgld.sc
292 ldgldUr.x :ldgldUr.sc
293 ldgldr.x :ldgldr.sc
294 ldlnk960.x :ldlnk960.sc
295 ldlnk960r.x :ldlnk960r.sc
296 ldgld960.x :ldgld960.sc
297 ldgldm88k.x :ldgldm88k.sc
298 ldm88kUr.x :ldm88kUr.sc
299 ldm88kr.x:ldm88kr.sc
300 ldm88k.x:ldm88k.sc
301 news.x:news.sc
302 h8300hds.x:h8300hds.sc
303 h8300hds.o:h8300hds.c
304 ldgld68k.x:ldgld68k.sc
305 ldglda29k.x :ldglda29k.sc
306 ldglda29kr.x :ldglda29kr.sc
307 ldglda29kUr.x :ldglda29kUr.sc
308
309 ebmon29k.x :ebmon29k.sc
310 ebmon29kr.x :ebmon29kr.sc
311 ebmon29kUr.x :ebmon29kUr.sc
312
313 stage1: force
314 - mkdir stage1
315 - mv -f $(STAGESTUFF) stage1
316 - (cd stage1 ; ln -s $(LD_PROG) ld)
317
318 stage2: force
319 - mkdir stage2
320 - mv -f $(STAGESTUFF) stage2
321 - (cd stage2 ; ln -s $(LD_PROG) ld)
322
323 stage3: force
324 - mkdir stage3
325 - mv -f $(STAGESTUFF) stage3
326 - (cd stage3 ; ln -s $(LD_PROG) ld)
327
328 against=stage2
329
330 comparison: force
331 for i in $(STAGESTUFF) ; do cmp $$i $(against)/$$i ; done
332
333 de-stage1: force
334 - (cd stage1 ; mv -f * ..)
335 - rm ld
336 - rmdir stage1
337
338 de-stage2: force
339 - (cd stage2 ; mv -f * ..)
340 - rm ld
341 - rmdir stage2
342
343 de-stage3: force
344 - (cd stage3 ; mv -f * ..)
345 - rm ld
346 - rmdir stage3
347
348 clean:
349 - rm -f TAGS $(OFILES) $(GENERATED_SOURCES) $(GENERATED_HEADERS)
350 - rm -f *.x *.x[runN] *.sc[runN]
351 - rm -f ld.?? ld.???
352 - rm -f ld ld1 ld2 ld3 ld.new mkscript *.o y.output
353
354 lintlog:$(SOURCES) Makefile
355 $(LINT) -abhxzn $(LINTFLAGS) $(LINTSOURCES) \
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
366 tags TAGS:$(SOURCES) $(HEADERS)
367 etags -t $?
368
369 release:
370 (cd /4/steve/ld; tar cf - $(LDSOURCES) $(HEADERS) $(MANSOURCES)) | tar xf -
371
372 objdump:objdump.c
373
374 install: $(LD_PROG)
375 # $(INSTALL_PROGRAM) ld.new $(libsubdir)/ld
376 cp $(LD_PROG) $(bindir)/ld.new
377 mv -f $(bindir)/ld.new $(bindir)/ld
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
385 ver960.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 #
393 roll:
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
402
403 dep: $(LDSOURCES)
404 mkdep $(CFLAGS) $?
405
406 # Dummy target to force execution of dependent targets.
407 #
408 force:
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 #
416 make:
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
434 Makefile: $(srcdir)/Makefile.in $(host_makefile_frag) $(target_makefile_frag)
435 $(SHELL) ./config.status
436
437 ### Local Variables: ***
438 ### mode:fundamental ***
439 ### page-delimiter: "^#\f" ***
440 ### End: ***
441 ### end of file
442
443
444 # IF YOU PUT ANYTHING HERE IT WILL GO AWAY
This page took 0.041092 seconds and 5 git commands to generate.