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)
29 # Distribution version
32 DIST_NAME=binutils-beta-${VERSION}
34 version=`$(unsubdir)/../gcc$(subdir)/gcc -dumpversion`
36 bindir = $(prefix)/bin
37 mandir = $(idestdir)/man
39 # Where to find texinfo.tex to format docn with TeX
40 TEXIDIR = $(srcdir)/../texinfo/fsf
42 MANPAGES= ar.1 nm.1 objdump.1 ranlib.1 size.1 strip.1
45 #INSTALL_PROGRAM = $(INSTALL)
46 #INSTALL_FILE = $(INSTALL)
49 # these two are almost the same program
53 # copy and strip should be the same program
57 # These should all be the same program too.
62 PROGS = $(SIZE_PROG) $(COPY_PROG) $(OBJDUMP_PROG) $(NM_PROG) $(AR_PROG) $(STRIP_PROG) $(RANLIB_PROG)
63 STAGESTUFF = $(PROGS) *.o
65 BASEDIR = $(srcdir)/..
66 LIBDIR = $(unsubdir)/../bfd$(subdir)
68 #### host and target dependant Makefile fragments come in here.
71 INCDIR = $(BASEDIR)/include
73 CFLAGS = -g -I. -I$(srcdir) -I$(INCDIR) $(HDEFINES) $(TDEFINES)
75 # When adding .o files, to make VPATH work in Sun Make, you have to
76 # also add a foo.o: foo.c line at the bottom of the file.
77 DISASMS = m68k-pinsn.o i960-pinsn.o sparc-pinsn.o am29k-pinsn.o
81 # Hopefully all these may be flushed once we get configuration down pat.
83 # alloca only needed for systems which don't have it and when cc != gcc.
86 # nm tries to malloc enough space for the string table. The old GNU malloc
87 # rounds this up to a power of two (e.g. 5M becomes 8M), and so it might
88 # fail unnecessarily. I've also seen some Unix malloc's fail, even when
89 # there is enough memory. So use the new GNU malloc.
92 # Use the GNU getopt unless you have problems with it.
93 # The IRIS version could probably benefit from being assembled with
94 # libmalloc rather than the ordinary malloc.
95 LIBIBERTY = $(unsubdir)/../libiberty$(subdir)/libiberty.a
97 # Code shared by all the binutils.
98 BULIBS = bucomm.o version.o filemode.o
100 ADDL_LIBS = $(MALLOC) $(BULIBS) $(BFD) $(LIBIBERTY)
102 BFD = $(LIBDIR)/libbfd.a
106 all: $(ADDL_LIBS) $(PROGS)
109 #$(BFD):$(LIBDIR)/../common/*.c
110 # (cd $(LIBDIR); make)
112 $(SIZE_PROG): $(ADDL_LIBS) size.o $(BFD)
113 $(CC) $(LDFLAGS) $(CFLAGS) -o $(SIZE_PROG) size.o $(ADDL_LIBS) $(LOADLIBES)
115 $(COPY_PROG): $(ADDL_LIBS) copy.o $(BFD)
116 $(CC) $(LDFLAGS) $(CFLAGS) -o $(COPY_PROG) copy.o $(ADDL_LIBS) $(LOADLIBES)
118 $(NM_PROG): $(ADDL_LIBS) nm.o $(BFD)
119 $(CC) $(LDFLAGS) $(CFLAGS) -o $(NM_PROG) nm.o $(ADDL_LIBS) $(LOADLIBES)
121 $(OBJDUMP_PROG): $(ADDL_LIBS) size.o objdump.o $(DISASMS) $(BFD)
122 $(CC) $(LDFLAGS) $(CFLAGS) -o $(OBJDUMP_PROG) objdump.o $(DISASMS) $(ADDL_LIBS) $(LOADLIBES)
124 $(AR_PROG): $(ADDL_LIBS) ar.o not-ranlib.o $(BFD)
125 $(CC) $(LDFLAGS) $(CFLAGS) -o $(AR_PROG) ar.o not-ranlib.o $(ADDL_LIBS) $(LOADLIBES)
127 $(RANLIB_PROG): $(ADDL_LIBS) ar.o is-ranlib.o $(BFD)
128 $(CC) $(LDFLAGS) $(CFLAGS) -o $(RANLIB_PROG) ar.o is-ranlib.o $(ADDL_LIBS) $(LOADLIBES)
130 # This rule creates a single binary that switches between ar and ranlib
131 # by looking at argv[0]. Use this kludge to save some disk space.
132 # However, you have to install things by hand.
133 # (That is after 'make install', replace the installed ranlib by a link to ar.)
135 # Alternatively, you can install ranlib.sh as ranlib.
137 ar_with_ranlib: $(ADDL_LIBS) ar.o maybe-ranlib.o $(BFD)
138 $(CC) $(LDFLAGS) $(CFLAGS) -o $(AR_PROG) ar.o maybe-ranlib.o $(ADDL_LIBS) $(LOADLIBES)
139 -rm -f $(RANLIB_PROG)
140 -ln $(AR_PROG) $(RANLIB_PROG)
142 $(STRIP_PROG): $(COPY_PROG)
144 -ln $(COPY_PROG) $(STRIP_PROG)
148 - mv -f $(STAGESTUFF) stage1
152 - mv -f $(STAGESTUFF) stage2
156 - mv -f $(STAGESTUFF) stage3
161 for i in $(STAGESTUFF) ; do cmp $$i $(against)/$$i ; done
164 - (cd stage1 ; mv -f * ..)
168 - (cd stage2 ; mv -f * ..)
172 - (cd stage3 ; mv -f * ..)
175 ######################################################################
176 # DOCUMENTATION TARGETS
178 binutils.dvi: binutils.texinfo
179 TEXINPUTS=${TEXIDIR}:.:$$TEXINPUTS tex binutils.texinfo
181 TEXINPUTS=${TEXIDIR}:.:$$TEXINPUTS tex binutils.texinfo
183 # info file for online browsing
184 binutils.info: binutils.texinfo
185 makeinfo binutils.texinfo
187 # different targets for -ms, -mm, -me
188 # (we don't use a variable because we don't trust all makes to handle
189 # a var in the target name right).
191 binutils.ms: binutils.texinfo
192 sed -e '/\\input texinfo/d' \
193 -e '/@c TEXI2ROFF-KILL/,/@c END TEXI2ROFF-KILL/d' \
195 texi2roff -ms >binutils.ms
198 binutils.mm: binutils.texinfo
199 sed -e '/\\input texinfo/d' \
200 -e '/@c TEXI2ROFF-KILL/,/@c END TEXI2ROFF-KILL/d' \
202 texi2roff -mm >binutils.mm
205 binutils.me: binutils.texinfo
206 sed -e '/\\input texinfo/d' \
207 -e '/@c TEXI2ROFF-KILL/,/@c END TEXI2ROFF-KILL/d' \
209 texi2roff -me >binutils.me
212 ######################################################################
215 -rm -f *.o *~ \#* core $(STAGESTUFF) TAGS binutils.?? binutils.???
220 etags $(INCDIR)/*.h $(BFDSRC)/*.[hc] *.[hc]
223 -rm -f $(STAGESTUFF) TAGS
226 for i in $(PROGS) ; do \
227 cp $$i $(bindir)/$$i.new ; \
228 mv -f $(bindir)/$$i.new $(bindir)/$$i ; \
230 for i in $(MANPAGES) ; do \
231 cp $(srcdir)/$$i $(mandir)/man1/$$i.new ; \
232 mv -f $(mandir)/man1/$$i.new $(mandir)/man1/$$i ; \
235 dist: $(DIST_NAME).tar.Z
238 cd ../..; rm -f $(DIST_NAME); ln -s devo $(DIST_NAME)
239 make binutils.mm -f Makefile.in
240 cd ../ld; make ld.mm -f Makefile.in
241 cd ../..; tar chf - $(DIST_NAME) | compress >$(DIST_NAME).tar.Z
242 rm -rf ../../$(DIST_NAME)
244 # These get around a bug in Sun Make in SunOS 4.1.1
246 am29k-pinsn.o: am29k-pinsn.c
250 cplus-dem.o:cplus-dem.c
251 filemode.o:filemode.c
255 i960-pinsn.o: i960-pinsn.c
256 is-ranlib.o:is-ranlib.c
257 m68k-pinsn.o: m68k-pinsn.c
258 maybe-ranlib.o:maybe-ranlib.c
260 not-ranlib.o:not-ranlib.c
263 sparc-pinsn.o: sparc-pinsn.c
267 #-----------------------------------------------------------------------------
268 # 'STANDARD' GNU/960 TARGETS BELOW THIS POINT
270 # 'VERSION' file must be present and contain a string of the form "x.y"
271 #-----------------------------------------------------------------------------
275 echo "char ${TARG}_ver[]= \"${TARG} `cat VERSION`, `date`\";" > ver960.c
278 # Dummy target to force execution of dependent targets.
282 # Target to uncomment host-specific lines in this makefile. Such lines must
283 # have the following string beginning in column 1: #__<hostname>__#
284 # Original Makefile is backed up as 'Makefile.old'.
286 # Invoke with: make make HOST=xxx
289 -@if test $(HOST)x = x ; then \
290 echo '
\aSpecify "make make HOST=???"'; \
293 grep -s "^#The next line was generated by 'make make'" Makefile; \
294 if test $$? = 0 ; then \
295 echo "
\aMakefile has already been processed with 'make make'";\
298 mv -f Makefile Makefile.old; \
299 echo "#The next line was generated by 'make make'" >Makefile ; \
300 echo "HOST=$(HOST)" >>Makefile ; \
302 sed "s/^#__$(HOST)__#//" < Makefile.old >>Makefile
304 Makefile: $(srcdir)/Makefile.in $(host_makefile_frag) $(target_makefile_frag)
305 $(SHELL) ./config.status
307 ### Local Variables: ***
308 ### mode:fundamental ***
309 ### page-delimiter: "^#
\f" ***