2 # Makefile for ld version 2
11 version
=`$(unsubdir)/../gcc$(subdir)/gcc -dumpversion`
13 bindir = $(prefix)/bin
14 libdir = $(prefix)/lib
15 libsubdir
= $(libdir)/gcc
/$(target
)/$(version
)
17 # Seach path to override the default search path for -lfoo libraries.
18 # If LIB_PATH is empty, the ones in the script (if any) are left alone.
19 # Otherwise, they are replaced with the ones given in LIB_PATH,
20 # which may have the form: LIB_PATH=/lib:/usr/local/lib
24 INSTALL_PROGRAM
= $(INSTALL
)
25 INSTALL_FILE
= $(INSTALL
)
28 INCLUDE
= $(srcdir)/..
/include
29 INCLUDES
= -I.
-I
$(srcdir) -I
$(INCLUDE
)
32 TEXIDIR
= $(srcdir)/..
/texinfo
/fsf
37 SCRIPTS
= ldgld68k.sc ldgld.sc \
38 ldlnk960.sc ldlnk960r.sc ldgld960.sc \
39 ldm88k.sc ldglda29k.sc news.sc h8300hds.sc
41 #### target and host dependent Makefile fragments come in here.
44 CFLAGS
= $(INCLUDES
) $(DEBUG
) $(HDEFINES
) $(TDEFINES
) $(CDEFINES
)
45 LINTFLAGS
= $(INCLUDES
) $(EXTRA_DEF
)
47 .SUFFIXES
: .y .x .xr .xu .sc .scu .scr
$(SUFFIXES
)
49 # go directly to ld.new in case this ld isn't capable of
50 # linking native object on this host. It can be renamed on
54 # A .sc script file is needed for each emulation mode.
55 # sed is used to transform this script into two variant forms:
56 # A .scr script is for linking without relocation (-r flag).
57 # A .scu script is like .scr, but *do* create constructors.
59 # A sed pattern to translate .sc to .scu:
60 SED_MAKE_RELOC_WITH_CONSTRUCTORS
=\
61 -e
"/If relocating/,/End if relocating/d" \
62 -e
"/=/s/[_a-z.]* *= .*//g" \
63 -e
'/>/s/} *> *[a-z]*/}/' \
64 -e
"/text/s/[.]text .*:/.text :/" \
65 -e
"/data/s/[.]data .*:/.data :/"
66 # A sed pattern to translate .scu to .scr:
67 SED_REMOVE_CONSTRUCTORS
= -e
/CONSTRUCTORS
/d
70 sed
$(SED_MAKE_RELOC_WITH_CONSTRUCTORS
) $< >$*.scu
72 sed
$(SED_REMOVE_CONSTRUCTORS
) < $< >$*.scr
74 # Each .sc .scr or .scu script is filtered by mkscript
75 # into a string literal that can be included in a .c program.
77 if
[ "x"$(LIB_PATH
) = "x" ]; then .
/mkscript
< $< >$*.x
; \
79 (sed
<$< -e
'/SEARCH_DIR(.*)/d' ; \
80 echo
$(LIB_PATH
) | tr
':' ' ' | sed
-e
's/\([^ ][^ ]*\)/SEARCH_DIR(\1);/g';) | .
/mkscript
>$*.x
;\
82 # ./mkscript < $< >$*.x
84 .
/mkscript
< $< >$*.xu
86 .
/mkscript
< $< >$*.xr
88 sed
$(SED_MAKE_RELOC_WITH_CONSTRUCTORS
) < $< | .
/mkscript
>$*.xu
90 sed
$(SED_MAKE_RELOC_WITH_CONSTRUCTORS
) $(SED_REMOVE_CONSTRUCTORS
) \
91 < $< | .
/mkscript
>$*.xr
94 BFDLIB
=$(unsubdir
)/..
/bfd
$(subdir
)/libbfd.a
95 LIBIBERTY
=$(unsubdir
)/..
/libiberty
$(subdir
)/libiberty.a
97 OFILES
= ldgram.o ldlex.o ldlang.o ldmain.o ldwarn.o ldwrite.o ldexp.o ldlnk960.o ldgld68k.o ldindr.o \
98 ldm88k.o ldglda29k.o news.o h8300hds.o \
99 ldgld.o ldgld960.o ldemul.o ldver.o ldmisc.o ldsym.o ldvanilla.o ldfile.o
101 HEADERS
=config.h ldmain.h ldmain.h ldwarn.h ldmisc.h ldindr.h ldsym.h ldlang.h ldexp.h \
102 ldlex.h ldwrite.h ldver.h ldemul.h ldfile.h ldgram.h
ld.h
106 LDCSOURCES
=ldlang.c ldindr.c ldmain.c ldwrite.c ldwarn.c ldlnk960.c ldgld.c ldgld68k.c \
107 ldm88k.c ldgld29k.c \
108 ldgld960.c ldemul.c ldver.c ldmisc.c ldexp.c ldsym.c ldfile.c ldvanilla.c
110 GENERATED_SOURCES
=ldgram.c ldlex.c ldgram.h
111 GENERATED_HEADERS
=ldgram.h
113 LDSOURCES
=$(LDCSOURCES
) ldgram.y ldlex.l ldgram.h
115 BFDSOURCES
=..
/..
/bfd
/common
/*.c
117 SOURCES
= $(LDSOURCES
) $(BFDSOURCES
)
118 LINTSOURCES
= $(LDCSOURCES
) $(BFDSOURCES
) $(GENERATED_SOURCES
)
120 STAGESTUFF
= *.x
*.x
[ru
] *.sc
[ru
] $(GENERATED_SOURCES
) $(GENERATED_HEADERS
) $(OFILES
) $(LD_PROG
) mkscript
122 all: Makefile
$(LD_PROG
)
124 ldgram.h ldgram.c
: ldgram.y
125 $(BISON
) $(BISONFLAGS
) -d
$(VPATH
)/ldgram.y
-o ldgram.c
126 # These are in case BISON is really yacc (which ignores -o).
127 if
[ -f y.tab.c
-a
! -f ldgram.c
]; then mv y.tab.c ldgram.c
; fi
128 if
[ -f y.tab.h
-a
! -f ldgram.h
]; then mv y.tab.h ldgram.h
; fi
131 lex -t
$(VPATH
)/ldlex.l
>ldlex.c
134 ldgld.c
: $(srcdir)/ldtemplate
135 sed
-e s
/"<ldtarget>"/ldgld
/g
-e s
/"<arch>"/m68k
/g \
136 -e s
/"<target>"//g
-e s
/"<TARGET>"//g
<$< >$@
137 news.c
: $(srcdir)/ldtemplate
138 sed
-e s
/"<ldtarget>"/news
/g
-e s
/"<arch>"/m68k
/g \
139 -e s
/"<target>"/news
/g
-e s
/"<TARGET>"/NEWS
/g
<$< >$@
140 ldgld68k.c
: $(srcdir)/ldtemplate
141 sed
-e s
/"<ldtarget>"/ldgld68k
/g
-e s
/"<arch>"/m68k
/g \
142 -e s
/"<target>"/68k
/g
-e s
/"<TARGET>"/68K
/g
<$< >$@
143 ldglda29k.c
: $(srcdir)/ldtemplate
144 sed
-e s
/"<ldtarget>"/ldglda29k
/g
-e s
/"<arch>"/a29k
/g \
145 -e s
/"<target>"/29k
/g
-e s
/"<TARGET>"/29K
/g
<$< >$@
146 ldm88k.c
: $(srcdir)/ldtemplate
147 sed
-e s
/"<ldtarget>"/ldm88k
/g
-e s
/"<arch>"/m88k
/g \
148 -e s
/"<target>"/m88kbcs
/g
-e s
/"<TARGET>"/M88KBCS
/g
<$< >$@
150 # The .c files for these are generated from ldtemplete.
151 ldgld.o
: .
/mkscript ldgld.x ldgld.xr ldgld.xu
152 news.o
: .
/mkscript news.x news.xr news.xu
153 ldgld68k.o
: .
/mkscript ldgld68k.x ldgld68k.xr ldgld68k.xu
154 ldglda29k.o
: .
/mkscript ldglda29k.x ldglda29k.xr ldglda29k.xu
155 ldm88k.o
: .
/mkscript ldm88k.x ldm88k.xr ldm88k.xu
157 # The .c files for these are (for now) specially written (not ldtemplete).
158 ldgld960.o
: .
/mkscript ldgld960.x
159 ldlnk960.o
: .
/mkscript ldlnk960.x ldlnk960.xr
160 h8300hds.o
: .
/mkscript h8300hds.x
163 #$(BFDLIB): $(BFDSOURCES)
166 $(LD_PROG
): $(OFILES
) $(BFDLIB
) $(LIBIBERTY
)
167 $(CC
) $(CFLAGS
) $(LDFLAGS
) -o
$(LD_PROG
) $(OFILES
) $(BFDLIB
) $(LIBIBERTY
) $(LOADLIBES
)
170 # 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
171 # gld -o ld /lib/crt0.o $(OFILES) $(BFDLIB) $(LIBIBERTY) -lc /usr/local/lib/gcc/sparc/1.91/gnulib
172 # $(CC) -Bstatic -o ld.new $(OFILES) $(BFDLIB) $(LIBIBERTY)
176 $(HOSTING_EMU
); .
/ld.new
-o ld1
$(HOSTING_CRT0
) $(OFILES
) $(BFDLIB
) $(LIBIBERTY
) $(HOSTING_LIBS
)
179 $(HOSTING_EMU
); .
/ld1
-o ld2
$(HOSTING_CRT0
) $(OFILES
) $(BFDLIB
) $(LIBIBERTY
) $(HOSTING_LIBS
)
182 $(HOSTING_EMU
); .
/ld2
-o ld3
$(HOSTING_CRT0
) $(OFILES
) $(BFDLIB
) $(LIBIBERTY
) $(HOSTING_LIBS
)
185 TEXINPUTS
=${TEXIDIR}:.
:$$TEXINPUTS tex ld.texinfo
187 TEXINPUTS
=${TEXIDIR}:.
:$$TEXINPUTS tex ld.texinfo
192 mkscript
: $(srcdir)/mkscript.c
193 $(CC
) $(CFLAGS
) $(LDFLAGS
) -o mkscript
$(srcdir)/mkscript.c
$(LOADLIBES
)
195 ldlex.c
: ldlex.l ldgram.h
196 ldlex.o
: ldlex.c ldgram.h
200 ldgld68k.x
:ldgld68k.sc
201 ldgld68kUr.x
:ldgld68kUr.sc
202 ldgld68kr.x
:ldgld68kr.sc
203 h8300hds.x
:h8300hds.sc
205 ldgldUr.x
:ldgldUr.sc
207 ldlnk960.x
:ldlnk960.sc
208 ldlnk960r.x
:ldlnk960r.sc
209 ldgld960.x
:ldgld960.sc
210 ldgldm88k.x
:ldgldm88k.sc
211 ldm88kUr.x
:ldm88kUr.sc
213 ldgld68k.x
:ldgld68k.sc
214 ldglda29k.x
:ldglda29k.sc
215 ldglda29kr.x
:ldglda29kr.sc
216 ldglda29kUr.x
:ldglda29kUr.sc
220 - mv
-f
$(STAGESTUFF
) stage1
221 - (cd stage1
; ln
-s
$(LD_PROG
) ld)
225 - mv
-f
$(STAGESTUFF
) stage2
226 - (cd stage2
; ln
-s
$(LD_PROG
) ld)
230 - mv
-f
$(STAGESTUFF
) stage3
231 - (cd stage3
; ln
-s
$(LD_PROG
) ld)
236 for i in
$(STAGESTUFF
) ; do cmp
$$i $(against
)/$$i ; done
239 - (cd stage1
; mv
-f
* ..
)
244 - (cd stage2
; mv
-f
* ..
)
249 - (cd stage3
; mv
-f
* ..
)
254 - rm -f TAGS
$(OFILES
) $(GENERATED_SOURCES
) $(GENERATED_HEADERS
)
255 - rm -f
*.x
*.x
[ru
] *.sc
[ur
]
257 - rm -f
ld ld1 ld2 ld3
ld.new mkscript
*.o y.output
259 lintlog
:$(SOURCES
) Makefile
260 $(LINT
) -abhxzn
$(LINTFLAGS
) $(LINTSOURCES
) \
261 | grep
-v
"pointer casts may be troublesome" \
262 | grep
-v
"possible pointer alignment problem" \
264 | grep
-v
"conversion from long may lose accuracy" \
265 | grep
-v
"warning: constant argument to NOT" \
266 | grep
-v
"enumeration type clash, operator CAST" \
267 | grep
-v
"warning: constant in conditional context"\
268 | grep
-v
"archive\.c"
271 tags TAGS
:$(SOURCES
) $(HEADERS
)
275 (cd
/4/steve
/ld; tar cf
- $(LDSOURCES
) $(HEADERS
) $(MANSOURCES
)) |
tar xf
-
280 $(INSTALL_PROGRAM
) ld.new
$(libsubdir
)/ld
282 #-----------------------------------------------------------------------------
283 # 'STANDARD' GNU/960 TARGETS BELOW THIS POINT
285 # 'VERSION' file must be present and contain a string of the form "x.y"
286 #-----------------------------------------------------------------------------
290 echo
"char ${TARG}_ver[]= \"${TARG} `cat VERSION`, `date`\";" > ver960.c
293 # This target should be invoked before building a new release.
294 # 'VERSION' file must be present and contain a string of the form "x.y"
298 MAJ
=`sed 's/\..*//' VERSION` ; \
299 MIN
=`sed 's/.*\.//' VERSION` ; \
300 V
=$$MAJ.
`expr $$MIN + 1` ; \
302 echo
$$V >VERSION
; \
309 # Dummy target to force execution of dependent targets.
313 # Target to uncomment host-specific lines in this makefile. Such lines must
314 # have the following string beginning in column 1: #__<hostname>__#
315 # Original Makefile is backed up as 'Makefile.old'.
317 # Invoke with: make make HOST=xxx
320 -@if
test $(HOST
)x
= x
; then \
321 echo
'\aSpecify "make make HOST=???"'; \
324 grep
-s
"^#The next line was generated by 'make make'" Makefile
; \
325 if
test $$?
= 0 ; then \
326 echo
"\aMakefile has already been processed with 'make make'";\
329 mv
-f Makefile Makefile.old
; \
330 echo
"#The next line was generated by 'make make'" >Makefile
; \
331 echo
"HOST=$(HOST)" >>Makefile
; \
333 sed
"s/^#__$(HOST)__#//" < Makefile.old
>>Makefile
337 Makefile
: $(srcdir)/Makefile.in
$(host_makefile_frag
) $(target_makefile_frag
)
338 $(SHELL
) .
/config.status
340 ### Local Variables: ***
341 ### mode:fundamental ***
342 ### page-delimiter: "^#\f" ***
347 # IF YOU PUT ANYTHING HERE IT WILL GO AWAY