Support for "ld.ms", "ld-index.ms" ROFF-style doc targets.
[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 stdout
35 #TEXI2OPT =
36 # You neeed this to generate ld-index.ms
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 .sc .scu .scr $(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
67 # A sed pattern to translate .sc to .scu:
68 SED_MAKE_RELOC_WITH_CONSTRUCTORS=\
69 -e "/If relocating/,/End if relocating/d" \
70 -e "/=/s/[_a-zA-Z.]* *= .*//g" \
71 -e '/>/s/} *> *[a-zA-Z]*/}/' \
72 -e "/text/s/[.]text .*:/.text :/" \
73 -e "/data/s/[.]data .*:/.data :/"
74 # A sed pattern to translate .scu to .scr:
75 SED_REMOVE_CONSTRUCTORS= -e /CONSTRUCTORS/d
76
77 .sc.scu:
78 sed $(SED_MAKE_RELOC_WITH_CONSTRUCTORS) $< >$*.scu
79 .scu.scr:
80 sed $(SED_REMOVE_CONSTRUCTORS) < $< >$*.scr
81
82 # Each .sc .scr or .scu script is filtered by mkscript
83 # into a string literal that can be included in a .c program.
84 .sc.x:
85 if [ "x"$(LIB_PATH) = "x" ]; then ./mkscript < $< >$*.x ; \
86 else \
87 (sed <$< -e '/SEARCH_DIR(.*)/d' ; \
88 echo $(LIB_PATH) | tr ':' ' ' | sed -e 's/\([^ ][^ ]*\)/SEARCH_DIR(\1);/g';) | ./mkscript >$*.x;\
89 fi
90 # ./mkscript < $< >$*.x
91 .scu.xu:
92 ./mkscript < $< >$*.xu
93 .scr.xr:
94 ./mkscript < $< >$*.xr
95 .sc.xu:
96 sed $(SED_MAKE_RELOC_WITH_CONSTRUCTORS) < $< | ./mkscript >$*.xu
97 .sc.xr:
98 sed $(SED_MAKE_RELOC_WITH_CONSTRUCTORS) $(SED_REMOVE_CONSTRUCTORS) \
99 < $< | ./mkscript >$*.xr
100
101 # for self hosting
102 BFDLIB=$(unsubdir)/../bfd$(subdir)/libbfd.a
103 LIBIBERTY=$(unsubdir)/../libiberty$(subdir)/libiberty.a
104
105 OFILES= ldgram.o ldlex.o ldlang.o ldmain.o ldwarn.o ldwrite.o ldexp.o ldlnk960.o ldgld68k.o ldindr.o \
106 ldm88k.o ldglda29k.o news.o h8300hds.o ebmon29k.o \
107 ldgld.o ldgld960.o ldemul.o ldver.o ldmisc.o ldsym.o ldvanilla.o ldfile.o
108
109 HEADERS=config.h ldmain.h ldmain.h ldwarn.h ldmisc.h ldindr.h ldsym.h ldlang.h ldexp.h \
110 ldlex.h ldwrite.h ldver.h ldemul.h ldfile.h ldgram.h ld.h
111
112 MANSOURCES=ld.tex
113
114 LDCSOURCES=ldlang.c ldindr.c ldmain.c ldwrite.c ldwarn.c ldlnk960.c ldgld.c ldgld68k.c \
115 ldm88k.c ldgld29k.c \
116 ldgld960.c ldemul.c ldver.c ldmisc.c ldexp.c ldsym.c ldfile.c ldvanilla.c
117
118 GENERATED_SOURCES=ldgram.c ldlex.c ldgram.h
119 GENERATED_HEADERS=ldgram.h
120
121 LDSOURCES=$(LDCSOURCES) ldgram.y ldlex.l ldgram.h
122
123 BFDSOURCES=../../bfd/common/*.c
124
125 SOURCES= $(LDSOURCES) $(BFDSOURCES)
126 LINTSOURCES= $(LDCSOURCES) $(BFDSOURCES) $(GENERATED_SOURCES)
127
128 STAGESTUFF = *.x *.x[ru] *.sc[ru] $(GENERATED_SOURCES) $(GENERATED_HEADERS) $(OFILES) $(LD_PROG) mkscript
129
130 all: Makefile $(LD_PROG)
131
132 ldgram.h ldgram.c: ldgram.y
133 $(BISON) $(BISONFLAGS) -d $(VPATH)/ldgram.y -o ldgram.c
134 # These are in case BISON is really yacc (which ignores -o).
135 if [ -f y.tab.c -a ! -f ldgram.c ]; then mv y.tab.c ldgram.c; else true ; fi
136 if [ -f y.tab.h -a ! -f ldgram.h ]; then mv y.tab.h ldgram.h; else true ; fi
137
138 ldlex.c: ldlex.l
139 lex -t $(VPATH)/ldlex.l >ldlex.c
140
141
142 ldgld.c: $(srcdir)/ldtemplate
143 sed -e s/"<ldtarget>"/ldgld/g -e s/"<arch>"/m68k/g \
144 -e s/"<target>"//g -e s/"<TARGET>"//g <$< >$@
145 news.c: $(srcdir)/ldtemplate
146 sed -e s/"<ldtarget>"/news/g -e s/"<arch>"/m68k/g \
147 -e s/"<target>"/news/g -e s/"<TARGET>"/NEWS/g <$< >$@
148
149 ebmon29k.c: $(srcdir)/ldtemplate
150 sed -e s/"<ldtarget>"/ebmon29k/g -e s/"<arch>"/a29k/g \
151 -e s/"gld<target>"/ebmon29k/g -e s/"GLD<TARGET>"/EBMON29K/g \
152 -e s/"<ldtarget>.x"/ebmon.x/ <$< >$@
153
154 ldgld68k.c: $(srcdir)/ldtemplate
155 sed -e s/"<ldtarget>"/ldgld68k/g -e s/"<arch>"/m68k/g \
156 -e s/"<target>"/68k/g -e s/"<TARGET>"/68K/g <$< >$@
157 ldglda29k.c: $(srcdir)/ldtemplate
158 sed -e s/"<ldtarget>"/ldglda29k/g -e s/"<arch>"/a29k/g \
159 -e s/"<target>"/29k/g -e s/"<TARGET>"/29K/g <$< >$@
160 ldm88k.c: $(srcdir)/ldtemplate
161 sed -e s/"<ldtarget>"/ldm88k/g -e s/"<arch>"/m88k/g \
162 -e s/"<target>"/m88kbcs/g -e s/"<TARGET>"/M88KBCS/g <$< >$@
163
164 # The .c files for these are generated from ldtemplete.
165 ldgld.o: ./mkscript ldgld.x ldgld.xr ldgld.xu
166 news.o: ./mkscript news.x news.xr news.xu
167 ebmon29k.o: ./mkscript ebmon29k.x ebmon29k.xr ebmon29k.xu
168 ldgld68k.o: ./mkscript ldgld68k.x ldgld68k.xr ldgld68k.xu
169 ldglda29k.o: ./mkscript ldglda29k.x ldglda29k.xr ldglda29k.xu
170 ldm88k.o: ./mkscript ldm88k.x ldm88k.xr ldm88k.xu
171
172 # The .c files for these are (for now) specially written (not ldtemplete).
173 ldgld960.o: ./mkscript ldgld960.x
174 ldlnk960.o: ./mkscript ldlnk960.x ldlnk960.xr
175 h8300hds.o: ./mkscript h8300hds.x
176
177
178 #$(BFDLIB): $(BFDSOURCES)
179 # (cd ../bfd; make)
180
181 $(LD_PROG): $(OFILES) $(BFDLIB) $(LIBIBERTY)
182 $(CC) $(CFLAGS) $(LDFLAGS) -o $(LD_PROG) $(OFILES) $(BFDLIB) $(LIBIBERTY) $(LOADLIBES)
183
184 # (cd ../bfd; make)
185 # 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
186 # gld -o ld /lib/crt0.o $(OFILES) $(BFDLIB) $(LIBIBERTY) -lc /usr/local/lib/gcc/sparc/1.91/gnulib
187 # $(CC) -Bstatic -o ld.new $(OFILES) $(BFDLIB) $(LIBIBERTY)
188
189
190 ld1: ld.new
191 $(HOSTING_EMU); ./ld.new -o ld1 $(HOSTING_CRT0) $(OFILES) $(BFDLIB) $(LIBIBERTY) $(HOSTING_LIBS)
192
193 ld2: ld1
194 $(HOSTING_EMU); ./ld1 -o ld2 $(HOSTING_CRT0) $(OFILES) $(BFDLIB) $(LIBIBERTY) $(HOSTING_LIBS)
195
196 ld3: ld2
197 $(HOSTING_EMU); ./ld2 -o ld3 $(HOSTING_CRT0) $(OFILES) $(BFDLIB) $(LIBIBERTY) $(HOSTING_LIBS)
198
199 ######################################################################
200 # DOCUMENTATION TARGETS
201 # TeX output
202 ld.dvi: ld.texinfo
203 TEXINPUTS=${TEXIDIR}:.:$$TEXINPUTS tex ld.texinfo
204 texindex ld.??
205 TEXINPUTS=${TEXIDIR}:.:$$TEXINPUTS tex ld.texinfo
206
207 # info file for online browsing
208 ld.info: ld.texinfo
209 makeinfo ld.texinfo
210
211 #edit instances of "ms" to "me" or "mm" to suit your preferences.
212 # (we don't use a variable because we don't trust all makes to handle
213 # a var in the target name right).
214 # roff output (-ms)
215 ld.ms: ld.texinfo
216 sed -e '/\\input texinfo/d' \
217 -e '/@c TEXI2ROFF-KILL/,/@c END TEXI2ROFF-KILL/d' \
218 ld.texinfo | \
219 texi2roff $(TEXI2OPT) -ms >ld.ms
220
221 # index for roff output
222 ld-index.ms: ld.ms
223 $(ROFF) -ms ld.ms 2>&1 1>/dev/null | \
224 sed -e '/: warning:/d' | \
225 texi2index >ld-index.ms
226
227 ######################################################################
228
229 mkscript: $(srcdir)/mkscript.c
230 $(CC) $(CFLAGS) $(LDFLAGS) -o mkscript $(srcdir)/mkscript.c $(LOADLIBES)
231
232 ldlex.c: ldlex.l ldgram.h
233 ldlex.o: ldlex.c ldgram.h
234 ldgram.o: ldgram.c
235 ldgram.c:ldgram.y
236
237 ldgld68k.x :ldgld68k.sc
238 ldgld68kUr.x :ldgld68kUr.sc
239 ldgld68kr.x :ldgld68kr.sc
240 h8300hds.x:h8300hds.sc
241 ldgld.x :ldgld.sc
242 ldgldUr.x :ldgldUr.sc
243 ldgldr.x :ldgldr.sc
244 ldlnk960.x :ldlnk960.sc
245 ldlnk960r.x :ldlnk960r.sc
246 ldgld960.x :ldgld960.sc
247 ldgldm88k.x :ldgldm88k.sc
248 ldm88kUr.x :ldm88kUr.sc
249 ldm88kr.x:ldm88kr.sc
250 ldgld68k.x:ldgld68k.sc
251 ldglda29k.x :ldglda29k.sc
252 ldglda29kr.x :ldglda29kr.sc
253 ldglda29kUr.x :ldglda29kUr.sc
254
255 ebmon29k.x :ebmon29k.sc
256 ebmon29kr.x :ebmon29kr.sc
257 ebmon29kUr.x :ebmon29kUr.sc
258
259 stage1: force
260 - mkdir stage1
261 - mv -f $(STAGESTUFF) stage1
262 - (cd stage1 ; ln -s $(LD_PROG) ld)
263
264 stage2: force
265 - mkdir stage2
266 - mv -f $(STAGESTUFF) stage2
267 - (cd stage2 ; ln -s $(LD_PROG) ld)
268
269 stage3: force
270 - mkdir stage3
271 - mv -f $(STAGESTUFF) stage3
272 - (cd stage3 ; ln -s $(LD_PROG) ld)
273
274 against=stage2
275
276 comparison: force
277 for i in $(STAGESTUFF) ; do cmp $$i $(against)/$$i ; done
278
279 de-stage1: force
280 - (cd stage1 ; mv -f * ..)
281 - rm ld
282 - rmdir stage1
283
284 de-stage2: force
285 - (cd stage2 ; mv -f * ..)
286 - rm ld
287 - rmdir stage2
288
289 de-stage3: force
290 - (cd stage3 ; mv -f * ..)
291 - rm ld
292 - rmdir stage3
293
294 clean:
295 - rm -f TAGS $(OFILES) $(GENERATED_SOURCES) $(GENERATED_HEADERS)
296 - rm -f *.x *.x[ru] *.sc[ur]
297 - rm -f ld.?? ld.???
298 - rm -f ld ld1 ld2 ld3 ld.new mkscript *.o y.output
299
300 lintlog:$(SOURCES) Makefile
301 $(LINT) -abhxzn $(LINTFLAGS) $(LINTSOURCES) \
302 | grep -v "pointer casts may be troublesome" \
303 | grep -v "possible pointer alignment problem" \
304 | grep -v "ignore" \
305 | grep -v "conversion from long may lose accuracy" \
306 | grep -v "warning: constant argument to NOT" \
307 | grep -v "enumeration type clash, operator CAST" \
308 | grep -v "warning: constant in conditional context"\
309 | grep -v "archive\.c"
310
311
312 tags TAGS:$(SOURCES) $(HEADERS)
313 etags -t $?
314
315 release:
316 (cd /4/steve/ld; tar cf - $(LDSOURCES) $(HEADERS) $(MANSOURCES)) | tar xf -
317
318 objdump:objdump.c
319
320 install: $(LD_PROG)
321 # $(INSTALL_PROGRAM) ld.new $(libsubdir)/ld
322 cp $(LD_PROG) $(bindir)/ld.new
323 mv -f $(bindir)/ld.new $(bindir)/ld
324
325 #-----------------------------------------------------------------------------
326 # 'STANDARD' GNU/960 TARGETS BELOW THIS POINT
327 #
328 # 'VERSION' file must be present and contain a string of the form "x.y"
329 #-----------------------------------------------------------------------------
330
331 ver960.c: FORCE
332 rm -f ver960.c
333 echo "char ${TARG}_ver[]= \"${TARG} `cat VERSION`, `date`\";" > ver960.c
334
335
336 # This target should be invoked before building a new release.
337 # 'VERSION' file must be present and contain a string of the form "x.y"
338 #
339 roll:
340 @V=`cat VERSION` ; \
341 MAJ=`sed 's/\..*//' VERSION` ; \
342 MIN=`sed 's/.*\.//' VERSION` ; \
343 V=$$MAJ.`expr $$MIN + 1` ; \
344 rm -f VERSION ; \
345 echo $$V >VERSION ; \
346 echo Version $$V
347
348
349 dep: $(LDSOURCES)
350 mkdep $(CFLAGS) $?
351
352 # Dummy target to force execution of dependent targets.
353 #
354 force:
355
356 # Target to uncomment host-specific lines in this makefile. Such lines must
357 # have the following string beginning in column 1: #__<hostname>__#
358 # Original Makefile is backed up as 'Makefile.old'.
359 #
360 # Invoke with: make make HOST=xxx
361 #
362 make:
363 -@if test $(HOST)x = x ; then \
364 echo '\aSpecify "make make HOST=???"'; \
365 exit 1; \
366 fi ; \
367 grep -s "^#The next line was generated by 'make make'" Makefile; \
368 if test $$? = 0 ; then \
369 echo "\aMakefile has already been processed with 'make make'";\
370 exit 1; \
371 fi ; \
372 mv -f Makefile Makefile.old; \
373 echo "#The next line was generated by 'make make'" >Makefile ; \
374 echo "HOST=$(HOST)" >>Makefile ; \
375 echo >>Makefile ; \
376 sed "s/^#__$(HOST)__#//" < Makefile.old >>Makefile
377
378 #\f
379
380 Makefile: $(srcdir)/Makefile.in $(host_makefile_frag) $(target_makefile_frag)
381 $(SHELL) ./config.status
382
383 ### Local Variables: ***
384 ### mode:fundamental ***
385 ### page-delimiter: "^#\f" ***
386 ### End: ***
387 ### end of file
388
389
390 # IF YOU PUT ANYTHING HERE IT WILL GO AWAY
This page took 0.037851 seconds and 5 git commands to generate.