]> Git Repo - binutils.git/blame - ld/Makefile.in
* Makefile.in: add target "binutils.ms"
[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
e1e5fbfc 55.SUFFIXES: .y .x .xr .xu .sc .scu .scr $(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.
66
67# A sed pattern to translate .sc to .scu:
68SED_MAKE_RELOC_WITH_CONSTRUCTORS=\
69 -e "/If relocating/,/End if relocating/d" \
6719c75b
PB
70 -e "/=/s/[_a-zA-Z.]* *= .*//g" \
71 -e '/>/s/} *> *[a-zA-Z]*/}/' \
e1e5fbfc
PB
72 -e "/text/s/[.]text .*:/.text :/" \
73 -e "/data/s/[.]data .*:/.data :/"
74# A sed pattern to translate .scu to .scr:
75SED_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.
30104b16 84.sc.x:
ee17cac9
PB
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
e1e5fbfc
PB
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
eb02fd64
RP
100
101# for self hosting
e45bef1e
RP
102BFDLIB=$(unsubdir)/../bfd$(subdir)/libbfd.a
103LIBIBERTY=$(unsubdir)/../libiberty$(subdir)/libiberty.a
eb02fd64 104
c252bac8 105OFILES= ldgram.o ldlex.o ldlang.o ldmain.o ldwarn.o ldwrite.o ldexp.o ldlnk960.o ldgld68k.o ldindr.o \
565a4c76 106 ldm88k.o ldglda29k.o news.o h8300hds.o ebmon29k.o \
239d28f3 107 ldgld.o ldgld960.o ldemul.o ldver.o ldmisc.o ldsym.o ldvanilla.o ldfile.o
eb02fd64 108
c252bac8 109HEADERS=config.h ldmain.h ldmain.h ldwarn.h ldmisc.h ldindr.h ldsym.h ldlang.h ldexp.h \
239d28f3 110 ldlex.h ldwrite.h ldver.h ldemul.h ldfile.h ldgram.h ld.h
eb02fd64
RP
111
112MANSOURCES=ld.tex
113
c252bac8 114LDCSOURCES=ldlang.c ldindr.c ldmain.c ldwrite.c ldwarn.c ldlnk960.c ldgld.c ldgld68k.c \
1baac72e 115 ldm88k.c ldgld29k.c \
239d28f3 116 ldgld960.c ldemul.c ldver.c ldmisc.c ldexp.c ldsym.c ldfile.c ldvanilla.c
eb02fd64 117
cc964c6f
SC
118GENERATED_SOURCES=ldgram.c ldlex.c ldgram.h
119GENERATED_HEADERS=ldgram.h
eb02fd64 120
cc964c6f 121LDSOURCES=$(LDCSOURCES) ldgram.y ldlex.l ldgram.h
eb02fd64 122
2ee11735 123BFDSOURCES=../../bfd/common/*.c
eb02fd64
RP
124
125SOURCES= $(LDSOURCES) $(BFDSOURCES)
126LINTSOURCES= $(LDCSOURCES) $(BFDSOURCES) $(GENERATED_SOURCES)
127
e1e5fbfc 128STAGESTUFF = *.x *.x[ru] *.sc[ru] $(GENERATED_SOURCES) $(GENERATED_HEADERS) $(OFILES) $(LD_PROG) mkscript
2ee11735 129
e1e5fbfc 130all: Makefile $(LD_PROG)
2ee11735 131
4976e6ab 132ldgram.h ldgram.c: ldgram.y
e46cdcdd 133 $(BISON) $(BISONFLAGS) -d $(VPATH)/ldgram.y -o ldgram.c
3e0f5f4f 134# These are in case BISON is really yacc (which ignores -o).
565a4c76
SC
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
cc964c6f 137
4976e6ab 138ldlex.c: ldlex.l
cc964c6f
SC
139 lex -t $(VPATH)/ldlex.l >ldlex.c
140
19b03b7a 141
ee17cac9 142ldgld.c: $(srcdir)/ldtemplate
e1e5fbfc 143 sed -e s/"<ldtarget>"/ldgld/g -e s/"<arch>"/m68k/g \
ee17cac9
PB
144 -e s/"<target>"//g -e s/"<TARGET>"//g <$< >$@
145news.c: $(srcdir)/ldtemplate
e1e5fbfc 146 sed -e s/"<ldtarget>"/news/g -e s/"<arch>"/m68k/g \
ee17cac9 147 -e s/"<target>"/news/g -e s/"<TARGET>"/NEWS/g <$< >$@
565a4c76
SC
148
149ebmon29k.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
ee17cac9 154ldgld68k.c: $(srcdir)/ldtemplate
e1e5fbfc 155 sed -e s/"<ldtarget>"/ldgld68k/g -e s/"<arch>"/m68k/g \
ee17cac9
PB
156 -e s/"<target>"/68k/g -e s/"<TARGET>"/68K/g <$< >$@
157ldglda29k.c: $(srcdir)/ldtemplate
e1e5fbfc 158 sed -e s/"<ldtarget>"/ldglda29k/g -e s/"<arch>"/a29k/g \
ee17cac9
PB
159 -e s/"<target>"/29k/g -e s/"<TARGET>"/29K/g <$< >$@
160ldm88k.c: $(srcdir)/ldtemplate
e1e5fbfc 161 sed -e s/"<ldtarget>"/ldm88k/g -e s/"<arch>"/m88k/g \
ee17cac9 162 -e s/"<target>"/m88kbcs/g -e s/"<TARGET>"/M88KBCS/g <$< >$@
e1e5fbfc
PB
163
164# The .c files for these are generated from ldtemplete.
165ldgld.o: ./mkscript ldgld.x ldgld.xr ldgld.xu
166news.o: ./mkscript news.x news.xr news.xu
565a4c76 167ebmon29k.o: ./mkscript ebmon29k.x ebmon29k.xr ebmon29k.xu
e1e5fbfc
PB
168ldgld68k.o: ./mkscript ldgld68k.x ldgld68k.xr ldgld68k.xu
169ldglda29k.o: ./mkscript ldglda29k.x ldglda29k.xr ldglda29k.xu
170ldm88k.o: ./mkscript ldm88k.x ldm88k.xr ldm88k.xu
171
172# The .c files for these are (for now) specially written (not ldtemplete).
173ldgld960.o: ./mkscript ldgld960.x
174ldlnk960.o: ./mkscript ldlnk960.x ldlnk960.xr
bee36ac3 175h8300hds.o: ./mkscript h8300hds.x
e1e5fbfc 176
2ee11735
RP
177
178#$(BFDLIB): $(BFDSOURCES)
179# (cd ../bfd; make)
eb02fd64 180
e77463a1 181$(LD_PROG): $(OFILES) $(BFDLIB) $(LIBIBERTY)
fe9c20e2 182 $(CC) $(CFLAGS) $(LDFLAGS) -o $(LD_PROG) $(OFILES) $(BFDLIB) $(LIBIBERTY) $(LOADLIBES)
e7921bd4 183
eb02fd64 184# (cd ../bfd; make)
239d28f3 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
e77463a1
JG
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)
eb02fd64
RP
188
189
f78e2569 190ld1: ld.new
e77463a1 191 $(HOSTING_EMU); ./ld.new -o ld1 $(HOSTING_CRT0) $(OFILES) $(BFDLIB) $(LIBIBERTY) $(HOSTING_LIBS)
eb02fd64
RP
192
193ld2: ld1
e77463a1 194 $(HOSTING_EMU); ./ld1 -o ld2 $(HOSTING_CRT0) $(OFILES) $(BFDLIB) $(LIBIBERTY) $(HOSTING_LIBS)
eb02fd64
RP
195
196ld3: ld2
e77463a1 197 $(HOSTING_EMU); ./ld2 -o ld3 $(HOSTING_CRT0) $(OFILES) $(BFDLIB) $(LIBIBERTY) $(HOSTING_LIBS)
eb02fd64 198
8073190b
RP
199######################################################################
200# DOCUMENTATION TARGETS
201# TeX output
8d317d2a
RP
202ld.dvi: ld.texinfo
203 TEXINPUTS=${TEXIDIR}:.:$$TEXINPUTS tex ld.texinfo
204 texindex ld.??
205 TEXINPUTS=${TEXIDIR}:.:$$TEXINPUTS tex ld.texinfo
206
8073190b 207# info file for online browsing
8d317d2a
RP
208ld.info: ld.texinfo
209 makeinfo ld.texinfo
eb02fd64 210
8073190b 211# roff output (-ms)
10a69a37
RP
212# edit instances of "ms" to "me" or "mm" to suit your preferences.
213# (we don't use a variable because we don't trust all makes to handle
214# a var in the target name right).
8073190b
RP
215ld.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
222ld-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
e0220a5b 229mkscript: $(srcdir)/mkscript.c
30104b16 230 $(CC) $(CFLAGS) $(LDFLAGS) -o mkscript $(srcdir)/mkscript.c $(LOADLIBES)
f78e2569 231
cc964c6f
SC
232ldlex.c: ldlex.l ldgram.h
233ldlex.o: ldlex.c ldgram.h
234ldgram.o: ldgram.c
235ldgram.c:ldgram.y
eb02fd64 236
30104b16
SC
237ldgld68k.x :ldgld68k.sc
238ldgld68kUr.x :ldgld68kUr.sc
239ldgld68kr.x :ldgld68kr.sc
bee36ac3 240h8300hds.x:h8300hds.sc
30104b16
SC
241ldgld.x :ldgld.sc
242ldgldUr.x :ldgldUr.sc
243ldgldr.x :ldgldr.sc
244ldlnk960.x :ldlnk960.sc
245ldlnk960r.x :ldlnk960r.sc
246ldgld960.x :ldgld960.sc
1e332873
SC
247ldgldm88k.x :ldgldm88k.sc
248ldm88kUr.x :ldm88kUr.sc
249ldm88kr.x:ldm88kr.sc
30104b16
SC
250ldgld68k.x:ldgld68k.sc
251ldglda29k.x :ldglda29k.sc
252ldglda29kr.x :ldglda29kr.sc
253ldglda29kUr.x :ldglda29kUr.sc
eb02fd64 254
565a4c76
SC
255ebmon29k.x :ebmon29k.sc
256ebmon29kr.x :ebmon29kr.sc
257ebmon29kUr.x :ebmon29kUr.sc
258
e7921bd4
RP
259stage1: force
260 - mkdir stage1
261 - mv -f $(STAGESTUFF) stage1
262 - (cd stage1 ; ln -s $(LD_PROG) ld)
f78e2569 263
e7921bd4
RP
264stage2: force
265 - mkdir stage2
266 - mv -f $(STAGESTUFF) stage2
267 - (cd stage2 ; ln -s $(LD_PROG) ld)
f78e2569 268
e7921bd4
RP
269stage3: force
270 - mkdir stage3
271 - mv -f $(STAGESTUFF) stage3
272 - (cd stage3 ; ln -s $(LD_PROG) ld)
eb02fd64 273
e46cdcdd
RP
274against=stage2
275
276comparison: force
277 for i in $(STAGESTUFF) ; do cmp $$i $(against)/$$i ; done
278
e7921bd4
RP
279de-stage1: force
280 - (cd stage1 ; mv -f * ..)
281 - rm ld
282 - rmdir stage1
283
284de-stage2: force
285 - (cd stage2 ; mv -f * ..)
286 - rm ld
287 - rmdir stage2
288
289de-stage3: force
290 - (cd stage3 ; mv -f * ..)
291 - rm ld
292 - rmdir stage3
293
294clean:
295 - rm -f TAGS $(OFILES) $(GENERATED_SOURCES) $(GENERATED_HEADERS)
e1e5fbfc 296 - rm -f *.x *.x[ru] *.sc[ur]
8d317d2a 297 - rm -f ld.?? ld.???
e7921bd4 298 - rm -f ld ld1 ld2 ld3 ld.new mkscript *.o y.output
eb02fd64
RP
299
300lintlog:$(SOURCES) Makefile
2ee11735 301 $(LINT) -abhxzn $(LINTFLAGS) $(LINTSOURCES) \
eb02fd64
RP
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
312tags TAGS:$(SOURCES) $(HEADERS)
19b03b7a 313 etags -t $?
eb02fd64
RP
314
315release:
316 (cd /4/steve/ld; tar cf - $(LDSOURCES) $(HEADERS) $(MANSOURCES)) | tar xf -
317
318objdump:objdump.c
319
e7921bd4 320install: $(LD_PROG)
565a4c76
SC
321# $(INSTALL_PROGRAM) ld.new $(libsubdir)/ld
322 cp $(LD_PROG) $(bindir)/ld.new
323 mv -f $(bindir)/ld.new $(bindir)/ld
eb02fd64
RP
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
331ver960.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#
339roll:
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
239d28f3 348
e1e5fbfc 349dep: $(LDSOURCES)
239d28f3
SC
350 mkdep $(CFLAGS) $?
351
eb02fd64
RP
352# Dummy target to force execution of dependent targets.
353#
e7921bd4 354force:
eb02fd64
RP
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#
362make:
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
f1eb48b6 380Makefile: $(srcdir)/Makefile.in $(host_makefile_frag) $(target_makefile_frag)
a26878d1 381 $(SHELL) ./config.status
eb02fd64
RP
382
383### Local Variables: ***
384### mode:fundamental ***
385### page-delimiter: "^#\f" ***
386### End: ***
387### end of file
239d28f3
SC
388
389
390# IF YOU PUT ANYTHING HERE IT WILL GO AWAY
This page took 0.120709 seconds and 4 git commands to generate.