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