2 # Makefile for ld version 2
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
)
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
23 INSTALL_PROGRAM
= $(INSTALL
)
24 INSTALL_FILE
= $(INSTALL
)
27 INCLUDE
= $(srcdir)/..
/include
28 INCLUDES
= -I.
-I
$(srcdir) -I
$(INCLUDE
)
31 # Where to find texinfo.tex to format docn with TeX
32 TEXIDIR
= $(srcdir)/..
/texinfo
/fsf
34 # Whether to get roff to put indexing entries on stdout
36 # You neeed this to generate ld-index.ms
39 # Which roff program to use to generate index for texi2roff'd doc
45 SCRIPTS
= ldgld68k.sc ldgld.sc \
46 ldlnk960.sc ldlnk960r.sc ldgld960.sc \
47 ldm88k.sc ldglda29k.sc news.sc h8300hds.sc ebmon29k.sc
49 #### target and host dependent Makefile fragments come in here.
52 CFLAGS
= $(INCLUDES
) $(DEBUG
) $(HDEFINES
) $(TDEFINES
) $(CDEFINES
)
53 LINTFLAGS
= $(INCLUDES
) $(EXTRA_DEF
)
55 .SUFFIXES
: .y .x .xr .xu .sc .scu .scr
$(SUFFIXES
)
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
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.
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
78 sed
$(SED_MAKE_RELOC_WITH_CONSTRUCTORS
) $< >$*.scu
80 sed
$(SED_REMOVE_CONSTRUCTORS
) < $< >$*.scr
82 # Each .sc .scr or .scu script is filtered by mkscript
83 # into a string literal that can be included in a .c program.
85 if
[ "x"$(LIB_PATH
) = "x" ]; then .
/mkscript
< $< >$*.x
; \
87 (sed
<$< -e
'/SEARCH_DIR(.*)/d' ; \
88 echo
$(LIB_PATH
) | tr
':' ' ' | sed
-e
's/\([^ ][^ ]*\)/SEARCH_DIR(\1);/g';) | .
/mkscript
>$*.x
;\
90 # ./mkscript < $< >$*.x
92 .
/mkscript
< $< >$*.xu
94 .
/mkscript
< $< >$*.xr
96 sed
$(SED_MAKE_RELOC_WITH_CONSTRUCTORS
) < $< | .
/mkscript
>$*.xu
98 sed
$(SED_MAKE_RELOC_WITH_CONSTRUCTORS
) $(SED_REMOVE_CONSTRUCTORS
) \
99 < $< | .
/mkscript
>$*.xr
102 BFDLIB
=$(unsubdir
)/..
/bfd
$(subdir
)/libbfd.a
103 LIBIBERTY
=$(unsubdir
)/..
/libiberty
$(subdir
)/libiberty.a
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
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
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
118 GENERATED_SOURCES
=ldgram.c ldlex.c ldgram.h
119 GENERATED_HEADERS
=ldgram.h
121 LDSOURCES
=$(LDCSOURCES
) ldgram.y ldlex.l ldgram.h
123 BFDSOURCES
=..
/..
/bfd
/common
/*.c
125 SOURCES
= $(LDSOURCES
) $(BFDSOURCES
)
126 LINTSOURCES
= $(LDCSOURCES
) $(BFDSOURCES
) $(GENERATED_SOURCES
)
128 STAGESTUFF
= *.x
*.x
[ru
] *.sc
[ru
] $(GENERATED_SOURCES
) $(GENERATED_HEADERS
) $(OFILES
) $(LD_PROG
) mkscript
130 all: Makefile
$(LD_PROG
)
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
139 lex -t
$(VPATH
)/ldlex.l
>ldlex.c
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
<$< >$@
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
/ <$< >$@
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
<$< >$@
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
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
178 #$(BFDLIB): $(BFDSOURCES)
181 $(LD_PROG
): $(OFILES
) $(BFDLIB
) $(LIBIBERTY
)
182 $(CC
) $(CFLAGS
) $(LDFLAGS
) -o
$(LD_PROG
) $(OFILES
) $(BFDLIB
) $(LIBIBERTY
) $(LOADLIBES
)
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)
191 $(HOSTING_EMU
); .
/ld.new
-o ld1
$(HOSTING_CRT0
) $(OFILES
) $(BFDLIB
) $(LIBIBERTY
) $(HOSTING_LIBS
)
194 $(HOSTING_EMU
); .
/ld1
-o ld2
$(HOSTING_CRT0
) $(OFILES
) $(BFDLIB
) $(LIBIBERTY
) $(HOSTING_LIBS
)
197 $(HOSTING_EMU
); .
/ld2
-o ld3
$(HOSTING_CRT0
) $(OFILES
) $(BFDLIB
) $(LIBIBERTY
) $(HOSTING_LIBS
)
199 ######################################################################
200 # DOCUMENTATION TARGETS
203 TEXINPUTS
=${TEXIDIR}:.
:$$TEXINPUTS tex ld.texinfo
205 TEXINPUTS
=${TEXIDIR}:.
:$$TEXINPUTS tex ld.texinfo
207 # info file for online browsing
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).
216 sed
-e
'/\\input texinfo/d' \
217 -e
'/@c TEXI2ROFF-KILL/,/@c END TEXI2ROFF-KILL/d' \
219 texi2roff
$(TEXI2OPT
) -ms
>ld.ms
221 # index for roff output
223 $(ROFF
) -ms
ld.ms
2>&1 1>/dev
/null | \
224 sed
-e
'/: warning:/d' | \
225 texi2index
>ld-index.ms
227 ######################################################################
229 mkscript
: $(srcdir)/mkscript.c
230 $(CC
) $(CFLAGS
) $(LDFLAGS
) -o mkscript
$(srcdir)/mkscript.c
$(LOADLIBES
)
232 ldlex.c
: ldlex.l ldgram.h
233 ldlex.o
: ldlex.c ldgram.h
237 ldgld68k.x
:ldgld68k.sc
238 ldgld68kUr.x
:ldgld68kUr.sc
239 ldgld68kr.x
:ldgld68kr.sc
240 h8300hds.x
:h8300hds.sc
242 ldgldUr.x
:ldgldUr.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
250 ldgld68k.x
:ldgld68k.sc
251 ldglda29k.x
:ldglda29k.sc
252 ldglda29kr.x
:ldglda29kr.sc
253 ldglda29kUr.x
:ldglda29kUr.sc
255 ebmon29k.x
:ebmon29k.sc
256 ebmon29kr.x
:ebmon29kr.sc
257 ebmon29kUr.x
:ebmon29kUr.sc
261 - mv
-f
$(STAGESTUFF
) stage1
262 - (cd stage1
; ln
-s
$(LD_PROG
) ld)
266 - mv
-f
$(STAGESTUFF
) stage2
267 - (cd stage2
; ln
-s
$(LD_PROG
) ld)
271 - mv
-f
$(STAGESTUFF
) stage3
272 - (cd stage3
; ln
-s
$(LD_PROG
) ld)
277 for i in
$(STAGESTUFF
) ; do cmp
$$i $(against
)/$$i ; done
280 - (cd stage1
; mv
-f
* ..
)
285 - (cd stage2
; mv
-f
* ..
)
290 - (cd stage3
; mv
-f
* ..
)
295 - rm -f TAGS
$(OFILES
) $(GENERATED_SOURCES
) $(GENERATED_HEADERS
)
296 - rm -f
*.x
*.x
[ru
] *.sc
[ur
]
298 - rm -f
ld ld1 ld2 ld3
ld.new mkscript
*.o y.output
300 lintlog
:$(SOURCES
) Makefile
301 $(LINT
) -abhxzn
$(LINTFLAGS
) $(LINTSOURCES
) \
302 | grep
-v
"pointer casts may be troublesome" \
303 | grep
-v
"possible pointer alignment problem" \
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"
312 tags TAGS
:$(SOURCES
) $(HEADERS
)
316 (cd
/4/steve
/ld; tar cf
- $(LDSOURCES
) $(HEADERS
) $(MANSOURCES
)) |
tar xf
-
321 # $(INSTALL_PROGRAM) ld.new $(libsubdir)/ld
322 cp
$(LD_PROG
) $(bindir)/ld.new
323 mv
-f
$(bindir)/ld.new
$(bindir)/ld
325 #-----------------------------------------------------------------------------
326 # 'STANDARD' GNU/960 TARGETS BELOW THIS POINT
328 # 'VERSION' file must be present and contain a string of the form "x.y"
329 #-----------------------------------------------------------------------------
333 echo
"char ${TARG}_ver[]= \"${TARG} `cat VERSION`, `date`\";" > ver960.c
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"
341 MAJ
=`sed 's/\..*//' VERSION` ; \
342 MIN
=`sed 's/.*\.//' VERSION` ; \
343 V
=$$MAJ.
`expr $$MIN + 1` ; \
345 echo
$$V >VERSION
; \
352 # Dummy target to force execution of dependent targets.
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'.
360 # Invoke with: make make HOST=xxx
363 -@if
test $(HOST
)x
= x
; then \
364 echo
'\aSpecify "make make HOST=???"'; \
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'";\
372 mv
-f Makefile Makefile.old
; \
373 echo
"#The next line was generated by 'make make'" >Makefile
; \
374 echo
"HOST=$(HOST)" >>Makefile
; \
376 sed
"s/^#__$(HOST)__#//" < Makefile.old
>>Makefile
380 Makefile
: $(srcdir)/Makefile.in
$(host_makefile_frag
) $(target_makefile_frag
)
381 $(SHELL
) .
/config.status
383 ### Local Variables: ***
384 ### mode:fundamental ***
385 ### page-delimiter: "^#\f" ***
390 # IF YOU PUT ANYTHING HERE IT WILL GO AWAY