Brought forward from p3:
[deliverable/binutils-gdb.git] / binutils / Makefile.in
CommitLineData
d8474a9b 1# Makefile for GNU binary-file utilities
d8e89b6b 2# Copyright (C) 1989-1992 Free Software Foundation, Inc.
d8474a9b
PB
3
4# This file is part of GNU binutils.
5
6# This program is free software; you can redistribute it and/or modify
7# it under the terms of the GNU General Public License as published by
8# the Free Software Foundation; either version 2 of the License, or
9# (at your option) any later version.
10#
11# This program is distributed in the hope that it will be useful,
12# but WITHOUT ANY WARRANTY; without even the implied warranty of
13# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14# GNU General Public License for more details.
15#
16# You should have received a copy of the GNU General Public License
17# along with this program; if not, write to the Free Software
18# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
99a42820 19
a10d26a1 20srcdir = .
84396dcf 21
d8e89b6b
RP
22prefix = /usr/local
23
3790af1d 24program_transform_name =
d8e89b6b
RP
25exec_prefix = $(prefix)
26bindir = $(exec_prefix)/bin
27libdir = $(exec_prefix)/lib
28tooldir = $(libdir)
29
30datadir = $(prefix)/lib
31mandir = $(prefix)/man
32man1dir = $(mandir)/man1
33man2dir = $(mandir)/man2
34man3dir = $(mandir)/man3
35man4dir = $(mandir)/man4
36man5dir = $(mandir)/man5
37man6dir = $(mandir)/man6
38man7dir = $(mandir)/man7
39man8dir = $(mandir)/man8
40man9dir = $(mandir)/man9
41infodir = $(prefix)/info
42includedir = $(prefix)/include
43docdir = $(datadir)/doc
84396dcf
RP
44
45SHELL = /bin/sh
d8e89b6b
RP
46
47INSTALL = install -c
48INSTALL_PROGRAM = $(INSTALL)
49INSTALL_DATA = $(INSTALL)
50
51AR = ar
52AR_FLAGS = qv
53CFLAGS = -g
d8e89b6b
RP
54MAKEINFO = makeinfo
55RANLIB = ranlib
9752f9fd 56BISONFLAGS = -d
c83497f5 57TEXI2ROFF=texi2roff
b5132a6b 58
9752f9fd 59BISON = `if [ -f ../byacc/byacc ] ; then echo ../byacc/byacc ; else echo byacc ; fi`
45212e5e
PB
60# Comment these out if using lex.
61LEX_OPTIONS = -I -Cem
62LEX = `if [ -f ../flex/flex ] ; then echo ../flex/flex -S../flex/flex.skel ; else echo flex ; fi`
63
8539db10 64# Distribution version
455a0d28 65VERSION=1.97.90
8539db10 66# Distribution name
d8e89b6b 67DIST_NAME=binutils-${VERSION}
8539db10 68
d8e89b6b 69version=`./../gcc/gcc -dumpversion`
b5132a6b 70
6b583720 71# Where to find texinfo.tex to format docn with TeX
b7a11ec2
RP
72TEXIDIR = $(srcdir)/../texinfo/fsf
73
3790af1d 74MANPAGES= ar nm objdump ranlib size strip
84396dcf 75
a10d26a1 76#CC=gcc -Wall
06a97fbd 77# these two are almost the same program
a10d26a1
RP
78AR_PROG=ar
79RANLIB_PROG=ranlib
99a42820
RP
80
81# copy and strip should be the same program
a10d26a1
RP
82COPY_PROG=copy
83STRIP_PROG=strip
99a42820
RP
84
85# These should all be the same program too.
a10d26a1
RP
86SIZE_PROG=size
87NM_PROG=nm
88OBJDUMP_PROG=objdump
99a42820 89
d8e89b6b 90PROGS = $(SIZE_PROG) $(OBJDUMP_PROG) $(NM_PROG) $(AR_PROG) $(STRIP_PROG) $(RANLIB_PROG)
a01bf1fb 91STAGESTUFF = $(PROGS) *.o
99a42820 92
40773f7f 93BASEDIR = $(srcdir)/..
d8e89b6b 94LIBDIR = ./../bfd
a4ef8601 95OPCODEDIR = ./../opcodes
a10d26a1 96
a10d26a1
RP
97#### host and target dependant Makefile fragments come in here.
98###
99
9bba7784 100INCDIR = $(BASEDIR)/include
99a42820 101
d8e89b6b
RP
102.c.o:
103 $(CC) -c $(CFLAGS) -I. -I$(srcdir) -I$(INCDIR) $(HDEFINES) $(TDEFINES) $<
99a42820 104
a26878d1
RP
105# When adding .o files, to make VPATH work in Sun Make, you have to
106# also add a foo.o: foo.c line at the bottom of the file.
60c80016 107DISASMS = m68k-pinsn.o i960-pinsn.o i386-pinsn.o sparc-pinsn.o am29k-pinsn.o
6a3958b2 108
99a42820
RP
109#\f
110## Random definitions
111# Hopefully all these may be flushed once we get configuration down pat.
112
113# alloca only needed for systems which don't have it and when cc != gcc.
114# ALLOCA = alloca.o
115
116# nm tries to malloc enough space for the string table. The old GNU malloc
117# rounds this up to a power of two (e.g. 5M becomes 8M), and so it might
118# fail unnecessarily. I've also seen some Unix malloc's fail, even when
119# there is enough memory. So use the new GNU malloc.
120# MALLOC = gmalloc.o
121
122# Use the GNU getopt unless you have problems with it.
123# The IRIS version could probably benefit from being assembled with
124# libmalloc rather than the ordinary malloc.
d8e89b6b 125LIBIBERTY = ./../libiberty/libiberty.a
99a42820
RP
126
127# Code shared by all the binutils.
a10d26a1 128BULIBS = bucomm.o version.o filemode.o
99a42820 129
7a5a3c7b 130ADDL_LIBS = $(MALLOC) $(BULIBS) $(BFD) $(LIBIBERTY)
99a42820
RP
131
132BFD = $(LIBDIR)/libbfd.a
a4ef8601 133OPCODES = $(OPCODEDIR)/libopcodes.a
99a42820
RP
134#\f
135## The rules
136
c83497f5
RP
137all: $(ADDL_LIBS) $(PROGS)
138
d8e89b6b 139check:
dc760829 140 /bin/sh $(srcdir)/sanity.sh .
d8e89b6b 141
7d6cc102
RP
142test-install:
143 /bin/sh $(srcdir)/sanity.sh $(bindir)
144
d8e89b6b 145info: binutils.info
a10d26a1
RP
146
147#$(BFD):$(LIBDIR)/../common/*.c
148# (cd $(LIBDIR); make)
99a42820 149
a10d26a1 150$(SIZE_PROG): $(ADDL_LIBS) size.o $(BFD)
6a3958b2 151 $(CC) $(LDFLAGS) $(CFLAGS) -o $(SIZE_PROG) size.o $(ADDL_LIBS) $(LOADLIBES)
99a42820 152
d8e89b6b
RP
153$(COPY_PROG): $(ADDL_LIBS) copy.o not-strip.o $(BFD)
154 $(CC) $(LDFLAGS) $(CFLAGS) -o $(COPY_PROG) copy.o not-strip.o $(ADDL_LIBS) $(LOADLIBES)
155
156$(STRIP_PROG): $(ADDL_LIBS) copy.o is-strip.o $(BFD)
157 $(CC) $(LDFLAGS) $(CFLAGS) -o $(STRIP_PROG) copy.o is-strip.o $(ADDL_LIBS) $(LOADLIBES)
99a42820 158
a10d26a1 159$(NM_PROG): $(ADDL_LIBS) nm.o $(BFD)
6a3958b2 160 $(CC) $(LDFLAGS) $(CFLAGS) -o $(NM_PROG) nm.o $(ADDL_LIBS) $(LOADLIBES)
99a42820 161
a4ef8601 162$(OBJDUMP_PROG): $(ADDL_LIBS) size.o objdump.o $(DISASMS) $(BFD) $(OPCODES)
fd9d7e4a 163 $(CC) $(LDFLAGS) $(CFLAGS) -o $(OBJDUMP_PROG) objdump.o $(DISASMS) $(ADDL_LIBS) $(OPCODES) $(LOADLIBES)
99a42820 164
d8e89b6b 165arparse.c:arparse.y
9752f9fd
ME
166 $(BISON) $(BISONFLAGS) $(srcdir)/arparse.y
167 -mv y.tab.c arparse.c
168 -mv y.tab.h arparse.h
d8e89b6b 169
99a42820 170
9752f9fd
ME
171arlex.c: arlex.l
172 $(LEX) $(LEX_OPTIONS) $(srcdir)/arlex.l
173 mv lex.yy.c arlex.c
d8e89b6b
RP
174
175$(AR_PROG): $(ADDL_LIBS) ar.o arparse.o arlex.o not-ranlib.o $(BFD) arsup.o
176 $(CC) $(LDFLAGS) $(CFLAGS) -o $(AR_PROG) ar.o arparse.o arlex.o arsup.o not-ranlib.o $(ADDL_LIBS) $(LOADLIBES)
177
178$(RANLIB_PROG): $(ADDL_LIBS) ar.o is-ranlib.o arparse.o arlex.o arsup.o $(BFD)
179 $(CC) $(LDFLAGS) $(CFLAGS) -o $(RANLIB_PROG) ar.o arparse.o arlex.o arsup.o is-ranlib.o $(ADDL_LIBS) $(LOADLIBES)
06a97fbd
PB
180
181# This rule creates a single binary that switches between ar and ranlib
182# by looking at argv[0]. Use this kludge to save some disk space.
183# However, you have to install things by hand.
184# (That is after 'make install', replace the installed ranlib by a link to ar.)
185
186# Alternatively, you can install ranlib.sh as ranlib.
187
188ar_with_ranlib: $(ADDL_LIBS) ar.o maybe-ranlib.o $(BFD)
189 $(CC) $(LDFLAGS) $(CFLAGS) -o $(AR_PROG) ar.o maybe-ranlib.o $(ADDL_LIBS) $(LOADLIBES)
a10d26a1
RP
190 -rm -f $(RANLIB_PROG)
191 -ln $(AR_PROG) $(RANLIB_PROG)
99a42820 192
d8e89b6b
RP
193# copy and strip in one binary that uses argv[0] to decide its action.
194
195copy_with_strip: $(ADDL_LIBS) copy.o maybe-strip.o $(BFD)
196 $(CC) $(LDFLAGS) $(CFLAGS) -o $(COPY_PROG) copy.o maybe-strip.o $(ADDL_LIBS) $(LOADLIBES)
a10d26a1
RP
197 -rm -f $(STRIP_PROG)
198 -ln $(COPY_PROG) $(STRIP_PROG)
99a42820 199
6a3958b2
RP
200stage1: force
201 - mkdir stage1
a01bf1fb 202 - mv -f $(STAGESTUFF) stage1
6a3958b2
RP
203
204stage2: force
205 - mkdir stage2
a01bf1fb 206 - mv -f $(STAGESTUFF) stage2
6a3958b2
RP
207
208stage3: force
209 - mkdir stage3
a01bf1fb
RP
210 - mv -f $(STAGESTUFF) stage3
211
212against=stage2
213
214comparison: force
215 for i in $(STAGESTUFF) ; do cmp $$i $(against)/$$i ; done
6a3958b2
RP
216
217de-stage1: force
218 - (cd stage1 ; mv -f * ..)
219 - rmdir stage1
220
221de-stage2: force
222 - (cd stage2 ; mv -f * ..)
223 - rmdir stage2
224
225de-stage3: force
226 - (cd stage3 ; mv -f * ..)
227 - rmdir stage3
228
6b583720
RP
229######################################################################
230# DOCUMENTATION TARGETS
231# TeX output
2226a090
RP
232binutils.dvi: $(srcdir)/binutils.texi
233 TEXINPUTS=${TEXIDIR}:.:$$TEXINPUTS tex $(srcdir)/binutils.texi
b7a11ec2 234 texindex binutils.??
2226a090 235 TEXINPUTS=${TEXIDIR}:.:$$TEXINPUTS tex $(srcdir)/binutils.texi
b7a11ec2 236
6b583720 237# info file for online browsing
2226a090 238binutils.info: $(srcdir)/binutils.texi
6141fd50 239 $(MAKEINFO) -o binutils.info $(srcdir)/binutils.texi
b7a11ec2 240
0c10ff03 241# different targets for -ms, -mm, -me
c83497f5
RP
242# Try to use a recent texi2roff. v2 was put on prep in jan91.
243# If you want an index, see texi2roff doc for postprocessing
244# and add -i to texi2roff invocations below.
245# Workarounds for texi2roff-2 (probably fixed in later texi2roff's, delete
246# correspondint -e lines when later texi2roff's are current)
247# + @ifinfo's deleted explicitly due to texi2roff-2 bug w nested constructs.
248# + @c's deleted explicitly because texi2roff sees texinfo commands in them
249# + @ (that's at-BLANK) not recognized by texi2roff, turned into blank
250# + @alphaenumerate is ridiculously new, turned into @enumerate
251
0c10ff03 252# roff output (-ms)
2226a090 253binutils.ms: $(srcdir)/binutils.texi
6b583720
RP
254 sed -e '/\\input texinfo/d' \
255 -e '/@c TEXI2ROFF-KILL/,/@c END TEXI2ROFF-KILL/d' \
c83497f5
RP
256 -e '/^@ifinfo/,/^@end ifinfo/d' \
257 -e '/^@c/d' \
2226a090 258 -e 's/{.*,,/{/' \
c83497f5
RP
259 -e 's/@ / /g' \
260 -e 's/^@alphaenumerate/@enumerate/g' \
261 -e 's/^@end alphaenumerate/@end enumerate/g' \
2226a090 262 $(srcdir)/binutils.texi | \
d8e89b6b 263 $(TEXI2ROFF) -ms | \
c83497f5
RP
264 sed -e 's/---/\\(em/g' \
265 >binutils.ms
6b583720 266
0c10ff03 267# roff output (-mm)
c83497f5
RP
268# '@noindent's removed due to texi2roff-2 mm bug; if yours is newer,
269# try leaving them in
2226a090 270binutils.mm: $(srcdir)/binutils.texi
0c10ff03
RP
271 sed -e '/\\input texinfo/d' \
272 -e '/@c TEXI2ROFF-KILL/,/@c END TEXI2ROFF-KILL/d' \
c83497f5
RP
273 -e '/^@ifinfo/,/^@end ifinfo/d' \
274 -e '/^@c/d' \
2226a090
RP
275 -e 's/{.*,,/{/' \
276 -e '/@noindent/d' \
c83497f5
RP
277 -e 's/@ / /g' \
278 -e 's/^@alphaenumerate/@enumerate/g' \
279 -e 's/^@end alphaenumerate/@end enumerate/g' \
2226a090 280 $(srcdir)/binutils.texi | \
d8e89b6b 281 $(TEXI2ROFF) -mm | \
2226a090
RP
282 sed -e 's/---/\\(em/g' \
283 >binutils.mm
0c10ff03
RP
284
285# roff output (-me)
2226a090 286binutils.me: $(srcdir)/binutils.texi
0c10ff03
RP
287 sed -e '/\\input texinfo/d' \
288 -e '/@c TEXI2ROFF-KILL/,/@c END TEXI2ROFF-KILL/d' \
c83497f5
RP
289 -e '/^@ifinfo/,/^@end ifinfo/d' \
290 -e '/^@c/d' \
2226a090 291 -e 's/{.*,,/{/' \
c83497f5
RP
292 -e 's/@ / /g' \
293 -e 's/^@alphaenumerate/@enumerate/g' \
294 -e 's/^@end alphaenumerate/@end enumerate/g' \
2226a090 295 $(srcdir)/binutils.texi | \
d8e89b6b 296 $(TEXI2ROFF) -me | \
c83497f5
RP
297 sed -e 's/---/\\(em/g' \
298 >binutils.me
0c10ff03
RP
299
300
6b583720
RP
301######################################################################
302
99a42820 303clean:
b7a11ec2 304 -rm -f *.o *~ \#* core $(STAGESTUFF) TAGS binutils.?? binutils.???
99a42820
RP
305
306etags tags: TAGS
307
6a3958b2 308TAGS: force
99a42820
RP
309 etags $(INCDIR)/*.h $(BFDSRC)/*.[hc] *.[hc]
310
311realclean: clean
a01bf1fb 312 -rm -f $(STAGESTUFF) TAGS
99a42820 313
c83497f5 314install: all
f478fcf6
ILT
315 -parent=`echo $(bindir)|sed -e 's@/[^/]*$$@@'`; \
316 if [ -d $$parent ] ; then true ; else mkdir $$parent ; fi
317 -if [ -d $(bindir) ] ; then true ; else mkdir $(bindir) ; fi
b5132a6b 318 for i in $(PROGS) ; do \
3790af1d 319 $(INSTALL_PROGRAM) $$i $(bindir)/`t='$(program_transform_name)'; echo $$i | sed -e "" $$t` ; \
99a42820 320 done
f478fcf6
ILT
321 -parent=`echo $(man1dir)|sed -e 's@/[^/]*$$@@'`; \
322 if [ -d $$parent ] ; then true ; else mkdir $$parent ; fi
323 -if [ -d $(man1dir) ] ; then true ; else mkdir $(man1dir) ; fi
84396dcf 324 for i in $(MANPAGES) ; do \
3790af1d 325 $(INSTALL_DATA) $(srcdir)/$$i.1 $(man1dir)/`t='$(program_transform_name)'; echo $$i | sed -e "" $$t`.1 ; \
de53632c 326 done
c83497f5 327
d8e89b6b 328install-info: info
f478fcf6
ILT
329 -parent=`echo $(infodir)|sed -e 's@/[^/]*$$@@'`; \
330 if [ -d $$parent ] ; then true ; else mkdir $$parent ; fi
331 -if [ -d $(infodir) ] ; then true ; else mkdir $(infodir) ; fi
de53632c 332 for i in *.info* ; do \
d8e89b6b 333 $(INSTALL_DATA) $$i $(infodir)/$$i ; \
84396dcf 334 done
99a42820 335
d8e89b6b
RP
336clean-info:
337 -rm -rf *.info*
338
8539db10
PB
339dist: $(DIST_NAME).tar.Z
340
d8474a9b 341$(DIST_NAME).tar.Z:
b27d2046 342 cd ../..; rm -f $(DIST_NAME); ln -s devo $(DIST_NAME)
45212e5e
PB
343 make arparse.c arlex.c binutils.mm -f Makefile.in
344 cd ../ld; make ldgram.c ldgram.h ldlex.c ld.mm -f Makefile.in
d8474a9b 345 cd ../..; tar chf - $(DIST_NAME) | compress >$(DIST_NAME).tar.Z
b27d2046 346 rm -rf ../../$(DIST_NAME)
8539db10 347
d7cce023
JG
348# These get around a bug in Sun Make in SunOS 4.1.1
349alloca.o:alloca.c
a26878d1 350am29k-pinsn.o: am29k-pinsn.c
99a42820 351ar.o: ar.c
22923083 352arsup.o: arsup.c
d7cce023
JG
353bucomm.o: bucomm.c
354copy.o: copy.c
d7cce023 355filemode.o:filemode.c
a10d26a1
RP
356getopt.o:getopt.c
357getopt1.o:getopt1.c
d7cce023
JG
358gmalloc.o:gmalloc.c
359i960-pinsn.o: i960-pinsn.c
360is-ranlib.o:is-ranlib.c
d8e89b6b 361is-strip.o:is-strip.c
d7cce023
JG
362m68k-pinsn.o: m68k-pinsn.c
363maybe-ranlib.o:maybe-ranlib.c
d8e89b6b 364maybe-strip.o:maybe-strip.c
d7cce023
JG
365nm.o: nm.c
366not-ranlib.o:not-ranlib.c
d8e89b6b 367not-strip.o:not-strip.c
d7cce023
JG
368objdump.o: objdump.c
369size.o: size.c
370sparc-pinsn.o: sparc-pinsn.c
60c80016 371i386-pinsn.o: i386-pinsn.c
d7cce023 372strip.o:strip.c
d8e89b6b
RP
373version.o: $(srcdir)/version.c
374 $(CC) $(CFLAGS) -I. -I$(srcdir) -I$(INCDIR) $(HDEFINES) $(TDEFINES) -DVERSION='"$(VERSION)"' -c $(srcdir)/version.c
8539db10 375
99a42820
RP
376#-----------------------------------------------------------------------------
377# 'STANDARD' GNU/960 TARGETS BELOW THIS POINT
378#
379# 'VERSION' file must be present and contain a string of the form "x.y"
380#-----------------------------------------------------------------------------
381
382ver960.c: FORCE
383 rm -f ver960.c
384 echo "char ${TARG}_ver[]= \"${TARG} `cat VERSION`, `date`\";" > ver960.c
385
386
387# Dummy target to force execution of dependent targets.
388#
6a3958b2 389force:
99a42820
RP
390
391# Target to uncomment host-specific lines in this makefile. Such lines must
392# have the following string beginning in column 1: #__<hostname>__#
393# Original Makefile is backed up as 'Makefile.old'.
394#
395# Invoke with: make make HOST=xxx
396#
397make:
398 -@if test $(HOST)x = x ; then \
399 echo '\aSpecify "make make HOST=???"'; \
400 exit 1; \
401 fi ; \
402 grep -s "^#The next line was generated by 'make make'" Makefile; \
403 if test $$? = 0 ; then \
404 echo "\aMakefile has already been processed with 'make make'";\
405 exit 1; \
406 fi ; \
407 mv -f Makefile Makefile.old; \
408 echo "#The next line was generated by 'make make'" >Makefile ; \
409 echo "HOST=$(HOST)" >>Makefile ; \
410 echo >>Makefile ; \
411 sed "s/^#__$(HOST)__#//" < Makefile.old >>Makefile
412
f1eb48b6 413Makefile: $(srcdir)/Makefile.in $(host_makefile_frag) $(target_makefile_frag)
a26878d1 414 $(SHELL) ./config.status
99a42820
RP
415
416### Local Variables: ***
417### mode:fundamental ***
418### page-delimiter: "^#\f" ***
419### End: ***
420### end of file
This page took 0.071546 seconds and 4 git commands to generate.