1 # Makefile for GNU binary-file utilities
2 # Copyright (C) 1989-1991 Free Software Foundation, Inc.
4 # This file is part of GNU binutils.
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.
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.
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.
25 idestdir = $(ddestdir)
31 # Distribution version
34 DIST_NAME=binutils-beta-${VERSION}
36 #version=`$(unsubdir)/../gcc$(subdir)/gcc -dumpversion`
38 bindir = $(prefix)/bin
39 mandir = $(idestdir)/man
41 # Where to find texinfo.tex to format docn with TeX
42 TEXIDIR = $(srcdir)/../texinfo/fsf
44 MANPAGES= ar.1 nm.1 objdump.1 ranlib.1 size.1 strip.1
47 #INSTALL_PROGRAM = $(INSTALL)
48 #INSTALL_FILE = $(INSTALL)
51 # these two are almost the same program
55 # copy and strip should be the same program
59 # These should all be the same program too.
64 PROGS = $(SIZE_PROG) $(COPY_PROG) $(OBJDUMP_PROG) $(NM_PROG) $(AR_PROG) $(STRIP_PROG) $(RANLIB_PROG)
65 STAGESTUFF = $(PROGS) *.o
67 BASEDIR = $(srcdir)/..
71 #### host and target dependant Makefile fragments come in here.
72 HDEFINES=-O -D__MSDOS__ -D__GO32__
77 INCDIR = $(BASEDIR)/include
79 CFLAGS = $(MINUS_G) -I. -I$(srcdir) -I$(INCDIR) $(HDEFINES) $(TDEFINES)
81 # When adding .o files, to make VPATH work in Sun Make, you have to
82 # also add a foo.o: foo.c line at the bottom of the file.
83 DISASMS = m68k-pinsn.o i960-pinsn.o sparc-pinsn.o am29k-pinsn.o
87 # Hopefully all these may be flushed once we get configuration down pat.
89 # alloca only needed for systems which don't have it and when cc != gcc.
92 # nm tries to malloc enough space for the string table. The old GNU malloc
93 # rounds this up to a power of two (e.g. 5M becomes 8M), and so it might
94 # fail unnecessarily. I've also seen some Unix malloc's fail, even when
95 # there is enough memory. So use the new GNU malloc.
98 # Use the GNU getopt unless you have problems with it.
99 # The IRIS version could probably benefit from being assembled with
100 # libmalloc rather than the ordinary malloc.
101 LIBIBERTY = ../libiberty/libiberty.a
103 # Code shared by all the binutils.
104 BULIBS = bucomm.o version.o filemode.o
106 ADDL_LIBS = $(MALLOC) $(BULIBS) $(BFD) $(LIBIBERTY)
108 BFD = $(LIBDIR)/libbfd.a
112 all: $(ADDL_LIBS) $(PROGS)
114 all-info: binutils.info
116 #$(BFD):$(LIBDIR)/../common/*.c
117 # (cd $(LIBDIR); make)
119 $(SIZE_PROG): $(ADDL_LIBS) size.o $(BFD)
120 >gcc.rf $(LDFLAGS) $(CFLAGS) -o $(SIZE_PROG) size.o $(ADDL_LIBS) $(LOADLIBES)
123 $(COPY_PROG): $(ADDL_LIBS) copy.o not-strip.o $(BFD)
124 >gcc.rf $(LDFLAGS) $(CFLAGS) -o $(COPY_PROG) copy.o not-strip.o $(ADDL_LIBS) $(LOADLIBES)
127 $(STRIP_PROG): $(ADDL_LIBS) copy.o is-strip.o $(BFD)
128 >gcc.rf $(LDFLAGS) $(CFLAGS) -o $(STRIP_PROG) copy.o is-strip.o $(ADDL_LIBS) $(LOADLIBES)
131 $(NM_PROG): $(ADDL_LIBS) nm.o $(BFD)
132 >gcc.rf $(LDFLAGS) $(CFLAGS) -o $(NM_PROG) nm.o $(ADDL_LIBS) $(LOADLIBES)
135 $(OBJDUMP_PROG): $(ADDL_LIBS) size.o objdump.o $(DISASMS) $(BFD)
136 >gcc.rf $(LDFLAGS) $(CFLAGS) -o $(OBJDUMP_PROG) objdump.o $(DISASMS) $(ADDL_LIBS) $(LOADLIBES)
139 $(AR_PROG): $(ADDL_LIBS) ar.o not-ranlib.o $(BFD)
140 >gcc.rf $(LDFLAGS) $(CFLAGS) -o $(AR_PROG) ar.o not-ranlib.o $(ADDL_LIBS) $(LOADLIBES)
143 $(RANLIB_PROG): $(ADDL_LIBS) ar.o is-ranlib.o $(BFD)
144 >gcc.rf $(LDFLAGS) $(CFLAGS) -o $(RANLIB_PROG) ar.o is-ranlib.o $(ADDL_LIBS) $(LOADLIBES)
147 # This rule creates a single binary that switches between ar and ranlib
148 # by looking at argv[0]. Use this kludge to save some disk space.
149 # However, you have to install things by hand.
150 # (That is after 'make install', replace the installed ranlib by a link to ar.)
152 # Alternatively, you can install ranlib.sh as ranlib.
154 ar_with_ranlib: $(ADDL_LIBS) ar.o maybe-ranlib.o $(BFD)
155 $(CC) $(LDFLAGS) $(CFLAGS) -o $(AR_PROG) ar.o maybe-ranlib.o $(ADDL_LIBS) $(LOADLIBES)
156 -rm -f $(RANLIB_PROG)
157 -ln $(AR_PROG) $(RANLIB_PROG)
159 # copy and strip in one binary that uses argv[0] to decide its action.
161 copy_with_strip: $(ADDL_LIBS) copy.o maybe-strip.o $(BFD)
162 $(CC) $(LDFLAGS) $(CFLAGS) -o $(COPY_PROG) copy.o maybe-strip.o $(ADDL_LIBS) $(LOADLIBES)
164 -ln $(COPY_PROG) $(STRIP_PROG)
168 - mv -f $(STAGESTUFF) stage1
172 - mv -f $(STAGESTUFF) stage2
176 - mv -f $(STAGESTUFF) stage3
181 for i in $(STAGESTUFF) ; do cmp $$i $(against)/$$i ; done
184 - (cd stage1 ; mv -f * ..)
188 - (cd stage2 ; mv -f * ..)
192 - (cd stage3 ; mv -f * ..)
195 ######################################################################
196 # DOCUMENTATION TARGETS
198 binutils.dvi: $(srcdir)/binutils.texi
199 TEXINPUTS=${TEXIDIR}:.:$$TEXINPUTS tex $(srcdir)/binutils.texi
201 TEXINPUTS=${TEXIDIR}:.:$$TEXINPUTS tex $(srcdir)/binutils.texi
203 # info file for online browsing
204 binutils.info: $(srcdir)/binutils.texi
205 $(MAKEINFO) -o binutils.info $(srcdir)/binutils.texi
207 # different targets for -ms, -mm, -me
208 # Try to use a recent texi2roff. v2 was put on prep in jan91.
209 # If you want an index, see texi2roff doc for postprocessing
210 # and add -i to texi2roff invocations below.
211 # Workarounds for texi2roff-2 (probably fixed in later texi2roff's, delete
212 # correspondint -e lines when later texi2roff's are current)
213 # + @ifinfo's deleted explicitly due to texi2roff-2 bug w nested constructs.
214 # + @c's deleted explicitly because texi2roff sees texinfo commands in them
215 # + @ (that's at-BLANK) not recognized by texi2roff, turned into blank
216 # + @alphaenumerate is ridiculously new, turned into @enumerate
219 binutils.ms: $(srcdir)/binutils.texi
220 sed -e '/\\input texinfo/d' \
221 -e '/@c TEXI2ROFF-KILL/,/@c END TEXI2ROFF-KILL/d' \
222 -e '/^@ifinfo/,/^@end ifinfo/d' \
226 -e 's/^@alphaenumerate/@enumerate/g' \
227 -e 's/^@end alphaenumerate/@end enumerate/g' \
228 $(srcdir)/binutils.texi | \
230 sed -e 's/---/\\(em/g' \
234 # '@noindent's removed due to texi2roff-2 mm bug; if yours is newer,
235 # try leaving them in
236 binutils.mm: $(srcdir)/binutils.texi
237 sed -e '/\\input texinfo/d' \
238 -e '/@c TEXI2ROFF-KILL/,/@c END TEXI2ROFF-KILL/d' \
239 -e '/^@ifinfo/,/^@end ifinfo/d' \
244 -e 's/^@alphaenumerate/@enumerate/g' \
245 -e 's/^@end alphaenumerate/@end enumerate/g' \
246 $(srcdir)/binutils.texi | \
248 sed -e 's/---/\\(em/g' \
252 binutils.me: $(srcdir)/binutils.texi
253 sed -e '/\\input texinfo/d' \
254 -e '/@c TEXI2ROFF-KILL/,/@c END TEXI2ROFF-KILL/d' \
255 -e '/^@ifinfo/,/^@end ifinfo/d' \
259 -e 's/^@alphaenumerate/@enumerate/g' \
260 -e 's/^@end alphaenumerate/@end enumerate/g' \
261 $(srcdir)/binutils.texi | \
263 sed -e 's/---/\\(em/g' \
267 ######################################################################
270 -rm -f *.o *~ \#* core $(STAGESTUFF) TAGS binutils.?? binutils.???
275 etags $(INCDIR)/*.h $(BFDSRC)/*.[hc] *.[hc]
278 -rm -f $(STAGESTUFF) TAGS
281 for i in $(PROGS) ; do \
282 (cp $$i $(bindir)/$$i.new \
283 && mv -f $(bindir)/$$i.new $(bindir)/$$i) \
286 for i in $(MANPAGES) ; do \
287 (cp $(srcdir)/$$i $(mandir)/man1/$$i.new \
288 && mv -f $(mandir)/man1/$$i.new $(mandir)/man1/$$i) \
292 install-info: all-info
293 for i in *.info* ; do \
294 (cp $$i $(idestdir)/info/$$i.new \
295 && mv -f $(idestdir)/info/$$i.new $(idestdir)/info/$$i) \
299 dist: $(DIST_NAME).tar.Z
302 cd ../..; rm -f $(DIST_NAME); ln -s devo $(DIST_NAME)
303 make binutils.mm -f Makefile.in
304 cd ../ld; make ld.mm -f Makefile.in
305 cd ../..; tar chf - $(DIST_NAME) | compress >$(DIST_NAME).tar.Z
306 rm -rf ../../$(DIST_NAME)
308 # These get around a bug in Sun Make in SunOS 4.1.1
310 am29k-pinsn.o: am29k-pinsn.c
314 cplus-dem.o: cplus-dem.c
315 filemode.o: filemode.c
319 i960-pinsn.o: i960-pinsn.c
320 is-ranlib.o: is-ranlib.c
321 is-strip.o: is-strip.c
322 m68k-pinsn.o: m68k-pinsn.c
323 maybe-ranlib.o: maybe-ranlib.c
325 not-ranlib.o: not-ranlib.c
326 not-strip.o: not-strip.c
329 sparc-pinsn.o: sparc-pinsn.c
331 version.o: $(srcdir)/version.c
332 $(CC) -c $(CFLAGS) -DVERSION=\"$(VERSION)\" $(srcdir)/version.c
334 #-----------------------------------------------------------------------------
335 # 'STANDARD' GNU/960 TARGETS BELOW THIS POINT
337 # 'VERSION' file must be present and contain a string of the form "x.y"
338 #-----------------------------------------------------------------------------
342 echo "char ${TARG}_ver[]= \"${TARG} `cat VERSION`, `date`\";" > ver960.c
345 # Dummy target to force execution of dependent targets.
349 # Target to uncomment host-specific lines in this makefile. Such lines must
350 # have the following string beginning in column 1: #__<hostname>__#
351 # Original Makefile is backed up as 'Makefile.old'.
353 # Invoke with: make make HOST=xxx
356 -@if test $(HOST)x = x ; then \
357 echo '
\aSpecify "make make HOST=???"'; \
360 grep -s "^#The next line was generated by 'make make'" Makefile; \
361 if test $$? = 0 ; then \
362 echo "
\aMakefile has already been processed with 'make make'";\
365 mv -f Makefile Makefile.old; \
366 echo "#The next line was generated by 'make make'" >Makefile ; \
367 echo "HOST=$(HOST)" >>Makefile ; \
369 sed "s/^#__$(HOST)__#//" < Makefile.old >>Makefile
371 Makefile: $(srcdir)/Makefile.in $(host_makefile_frag) $(target_makefile_frag)
372 $(SHELL) ./config.status
374 ### Local Variables: ***
375 ### mode:fundamental ***
376 ### page-delimiter: "^#
\f" ***