1 # Makefile for GNU binary-file utilities
2 # Copyright (C) 1989-1992 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.
24 program_transform_name
=
25 exec_prefix = $(prefix)
26 bindir = $(exec_prefix)/bin
27 libdir = $(exec_prefix)/lib
28 tooldir
= $(libdir)/$(target_alias
)
30 datadir = $(prefix)/lib
31 mandir = $(prefix)/man
32 man1dir = $(mandir)/man1
33 man2dir = $(mandir)/man2
34 man3dir = $(mandir)/man3
35 man4dir = $(mandir)/man4
36 man5dir = $(mandir)/man5
37 man6dir = $(mandir)/man6
38 man7dir = $(mandir)/man7
39 man8dir = $(mandir)/man8
40 man9dir = $(mandir)/man9
41 infodir = $(prefix)/info
42 includedir = $(prefix)/include
43 docdir
= $(datadir)/doc
48 INSTALL_PROGRAM
= $(INSTALL
)
49 INSTALL_DATA
= $(INSTALL
)
62 BISON
= `if [ -f ../byacc/byacc ] ; then echo ../byacc/byacc ; else echo byacc ; fi`
63 # Comment these out if using lex.
65 LEX
= `if [ -f ../flex/flex ] ; then echo ../flex/flex ; else echo flex ; fi`
67 # Distribution version
70 DIST_NAME
=binutils-
${VERSION}
72 version
=`./../gcc/gcc -dumpversion`
74 # Where to find texinfo.tex to format docn with TeX
75 TEXIDIR
= $(srcdir)/..
/texinfo
/fsf
77 MANPAGES
= ar nm objdump ranlib size
strip
80 # these two are almost the same program
84 # copy and strip should be the same program
88 # These should all be the same program too.
93 # This is the demangler, as a standalone program.
94 DEMANGLER_PROG
=demangle
96 PROGS
= $(SIZE_PROG
) $(OBJDUMP_PROG
) $(NM_PROG
) $(AR_PROG
) $(STRIP_PROG
) $(RANLIB_PROG
) $(DEMANGLER_PROG
)
97 STAGESTUFF
= $(PROGS
) *.o
98 # Files that can be generated, but should be in the distribution.
99 DISTSTUFF
=arparse.c arlex.c binutils.mm
101 BASEDIR
= $(srcdir)/..
103 OPCODEDIR
= .
/..
/opcodes
105 #### host and target dependant Makefile fragments come in here.
108 INCLUDES
= -I.
-I
$(srcdir) -I
$(BASEDIR
)/include -I
$(BASEDIR
)/bfd
111 $(CC
) -c
$(CFLAGS
) $(INCLUDES
) $(HDEFINES
) $(TDEFINES
) $<
113 # When adding .o files, to make VPATH work in Sun Make, you have to
114 # also add a foo.o: foo.c line at the bottom of the file.
115 DISASMS
= i960-pinsn.o sparc-pinsn.o am29k-pinsn.o
118 ## Random definitions
119 # Hopefully all these may be flushed once we get configuration down pat.
121 # alloca only needed for systems which don't have it and when cc != gcc.
124 # nm tries to malloc enough space for the string table. The old GNU malloc
125 # rounds this up to a power of two (e.g. 5M becomes 8M), and so it might
126 # fail unnecessarily. I've also seen some Unix malloc's fail, even when
127 # there is enough memory. So use the new GNU malloc.
130 # Use the GNU getopt unless you have problems with it.
131 # The IRIS version could probably benefit from being assembled with
132 # libmalloc rather than the ordinary malloc.
133 LIBIBERTY_SRC_DIR
= $(srcdir)/..
/libiberty
134 LIBIBERTY_BIN_DIR
= .
/..
/libiberty
135 LIBIBERTY
= $(LIBIBERTY_BIN_DIR
)/libiberty.a
137 # Code shared by all the binutils.
138 BULIBS
= bucomm.o version.o filemode.o
140 ADDL_LIBS
= $(MALLOC
) $(BULIBS
) $(BFD
) $(LIBIBERTY
)
142 BFD
= $(LIBDIR
)/libbfd.a
143 OPCODES
= $(OPCODEDIR
)/libopcodes.a
147 all: $(ADDL_LIBS
) $(PROGS
) testsuite
150 if
[ -d testsuite
]; then \
151 (rootme
=`pwd`/ ; export rootme
; \
152 rootsrc
=`cd $(srcdir); pwd`/ ; export rootsrc
; \
153 cd testsuite
; $(MAKE
) $(FLAGS_TO_PASS
)); \
157 /bin
/sh
$(srcdir)/sanity.sh .
160 /bin
/sh
$(srcdir)/sanity.sh
$(bindir)
166 #$(BFD):$(LIBDIR)/../common/*.c
167 # (cd $(LIBDIR); make)
169 $(SIZE_PROG
): $(ADDL_LIBS
) size.o
$(BFD
)
170 $(CC
) $(LDFLAGS
) $(CFLAGS
) -o
$(SIZE_PROG
) size.o
$(ADDL_LIBS
) $(LOADLIBES
)
172 $(COPY_PROG
): $(ADDL_LIBS
) copy.o not-strip.o
$(BFD
)
173 $(CC
) $(LDFLAGS
) $(CFLAGS
) -o
$(COPY_PROG
) copy.o not-strip.o
$(ADDL_LIBS
) $(LOADLIBES
)
175 $(STRIP_PROG
): $(ADDL_LIBS
) copy.o is-strip.o
$(BFD
)
176 $(CC
) $(LDFLAGS
) $(CFLAGS
) -o
$(STRIP_PROG
) copy.o is-strip.o
$(ADDL_LIBS
) $(LOADLIBES
)
178 $(NM_PROG
): $(ADDL_LIBS
) nm.o
$(BFD
)
179 $(CC
) $(LDFLAGS
) $(CFLAGS
) -o
$(NM_PROG
) nm.o
$(ADDL_LIBS
) $(LOADLIBES
)
181 $(OBJDUMP_PROG
): $(ADDL_LIBS
) size.o objdump.o
$(DISASMS
) $(BFD
) $(OPCODES
)
182 $(CC
) $(LDFLAGS
) $(CFLAGS
) -o
$(OBJDUMP_PROG
) objdump.o
$(DISASMS
) $(OPCODES
) $(ADDL_LIBS
) $(LOADLIBES
)
184 $(DEMANGLER_PROG
): $(LIBIBERTY_SRC_DIR
)/cplus-dem.c
185 $(CC
) $(LDFLAGS
) $(CFLAGS
) $(INCLUDES
) $(HDEFINES
) $(TDEFINES
) -DMAIN
-o
$(DEMANGLER_PROG
) $(LIBIBERTY_SRC_DIR
)/cplus-dem.c
$(LIBIBERTY
) $(LOADLIBES
)
188 $(BISON
) $(BISONFLAGS
) $(srcdir)/arparse.y
189 -mv y.tab.c arparse.c
190 -mv y.tab.h arparse.h
194 $(LEX
) $(LEX_OPTIONS
) $(srcdir)/arlex.l
197 $(AR_PROG
): $(ADDL_LIBS
) ar.o arparse.o arlex.o not-ranlib.o
$(BFD
) arsup.o
198 $(CC
) $(LDFLAGS
) $(CFLAGS
) -o
$(AR_PROG
) ar.o arparse.o arlex.o arsup.o not-ranlib.o
$(ADDL_LIBS
) $(LOADLIBES
)
200 $(RANLIB_PROG
): $(ADDL_LIBS
) ar.o is-ranlib.o arparse.o arlex.o arsup.o
$(BFD
)
201 $(CC
) $(LDFLAGS
) $(CFLAGS
) -o
$(RANLIB_PROG
) ar.o arparse.o arlex.o arsup.o is-ranlib.o
$(ADDL_LIBS
) $(LOADLIBES
)
203 # This rule creates a single binary that switches between ar and ranlib
204 # by looking at argv[0]. Use this kludge to save some disk space.
205 # However, you have to install things by hand.
206 # (That is after 'make install', replace the installed ranlib by a link to ar.)
208 # Alternatively, you can install ranlib.sh as ranlib.
210 ar_with_ranlib
: $(ADDL_LIBS
) ar.o maybe-ranlib.o
$(BFD
)
211 $(CC
) $(LDFLAGS
) $(CFLAGS
) -o
$(AR_PROG
) ar.o maybe-ranlib.o
$(ADDL_LIBS
) $(LOADLIBES
)
212 -rm -f
$(RANLIB_PROG
)
213 -ln
$(AR_PROG
) $(RANLIB_PROG
)
215 # copy and strip in one binary that uses argv[0] to decide its action.
217 copy_with_strip
: $(ADDL_LIBS
) copy.o maybe-strip.o
$(BFD
)
218 $(CC
) $(LDFLAGS
) $(CFLAGS
) -o
$(COPY_PROG
) copy.o maybe-strip.o
$(ADDL_LIBS
) $(LOADLIBES
)
220 -ln
$(COPY_PROG
) $(STRIP_PROG
)
224 - mv
-f
$(STAGESTUFF
) stage1
228 - mv
-f
$(STAGESTUFF
) stage2
232 - mv
-f
$(STAGESTUFF
) stage3
237 for i in
$(STAGESTUFF
) ; do cmp
$$i $(against
)/$$i ; done
240 - (cd stage1
; mv
-f
* ..
)
244 - (cd stage2
; mv
-f
* ..
)
248 - (cd stage3
; mv
-f
* ..
)
251 ######################################################################
252 # DOCUMENTATION TARGETS
254 binutils.
dvi: $(srcdir)/binutils.texi
255 $(TEXI2DVI
) $(srcdir)/binutils.texi
257 # info file for online browsing
258 binutils.
info: $(srcdir)/binutils.texi
259 $(MAKEINFO
) -o binutils.
info $(srcdir)/binutils.texi
261 # different targets for -ms, -mm, -me
262 # Try to use a recent texi2roff. v2 was put on prep in jan91.
263 # If you want an index, see texi2roff doc for postprocessing
264 # and add -i to texi2roff invocations below.
265 # Workarounds for texi2roff-2 (probably fixed in later texi2roff's, delete
266 # correspondint -e lines when later texi2roff's are current)
267 # + @ifinfo's deleted explicitly due to texi2roff-2 bug w nested constructs.
268 # + @c's deleted explicitly because texi2roff sees texinfo commands in them
269 # + @ (that's at-BLANK) not recognized by texi2roff, turned into blank
270 # + @alphaenumerate is ridiculously new, turned into @enumerate
273 binutils.ms
: $(srcdir)/binutils.texi
274 sed
-e
'/\\input texinfo/d' \
275 -e
'/@c TEXI2ROFF-KILL/,/@c END TEXI2ROFF-KILL/d' \
276 -e
'/^@ifinfo/,/^@end ifinfo/d' \
280 -e
's/^@alphaenumerate/@enumerate/g' \
281 -e
's/^@end alphaenumerate/@end enumerate/g' \
282 $(srcdir)/binutils.texi | \
284 sed
-e
's/---/\\(em/g' \
288 # '@noindent's removed due to texi2roff-2 mm bug; if yours is newer,
289 # try leaving them in
290 binutils.mm
: $(srcdir)/binutils.texi
291 sed
-e
'/\\input texinfo/d' \
292 -e
'/@c TEXI2ROFF-KILL/,/@c END TEXI2ROFF-KILL/d' \
293 -e
'/^@ifinfo/,/^@end ifinfo/d' \
298 -e
's/^@alphaenumerate/@enumerate/g' \
299 -e
's/^@end alphaenumerate/@end enumerate/g' \
300 $(srcdir)/binutils.texi | \
302 sed
-e
's/---/\\(em/g' \
306 binutils.me
: $(srcdir)/binutils.texi
307 sed
-e
'/\\input texinfo/d' \
308 -e
'/@c TEXI2ROFF-KILL/,/@c END TEXI2ROFF-KILL/d' \
309 -e
'/^@ifinfo/,/^@end ifinfo/d' \
313 -e
's/^@alphaenumerate/@enumerate/g' \
314 -e
's/^@end alphaenumerate/@end enumerate/g' \
315 $(srcdir)/binutils.texi | \
317 sed
-e
's/---/\\(em/g' \
321 ######################################################################
324 -rm -f
*.o
*~ \
#* core binutils.?? binutils.???
328 -rm -f Makefile config.status sysdep.h
330 -rm -f
$(DISTSTUFF
) TAGS
335 etags
$(INCDIR
)/*.h
$(BFDSRC
)/*.
[hc
] *.
[hc
]
338 -parent
=`echo $(bindir)|sed -e 's@/[^/]*$$@@'`; \
339 if
[ -d
$$parent ] ; then true
; else mkdir
$$parent ; fi
340 -if
[ -d
$(bindir) ] ; then true
; else mkdir
$(bindir) ; fi
341 -for i in
$(PROGS
) ; do \
342 $(INSTALL_PROGRAM
) $$i $(bindir)/`t='$(program_transform_name)'; echo $$i | sed -e "" $$t` ; \
344 -parent
=`echo $(man1dir)|sed -e 's@/[^/]*$$@@'`; \
345 if
[ -d
$$parent ] ; then true
; else mkdir
$$parent ; fi
346 -if
[ -d
$(man1dir) ] ; then true
; else mkdir
$(man1dir) ; fi
347 -for i in
$(MANPAGES
) ; do \
348 $(INSTALL_DATA
) $(srcdir)/$$i.1 $(man1dir)/`t='$(program_transform_name)'; echo $$i | sed -e "" $$t`.1 ; \
350 -if
[ -d
$(tooldir
) ]; then \
351 if
[ -d
$(tooldir
)/bin
] ; then true
; else mkdir
$(tooldir
)/bin
; fi
; \
352 for i in nm
strip ; do \
353 rm -f
$(tooldir
)/bin
/$$i; \
354 ln
$(bindir)/`t='$(program_transform_name)'; echo $$i | sed -e "" $$t` $(tooldir
)/bin
/$$i \
355 ||
$(INSTALL_PROGRAM
) $$i $(tooldir
)/bin
/$$i; \
360 -parent
=`echo $(infodir)|sed -e 's@/[^/]*$$@@'`; \
361 if
[ -d
$$parent ] ; then true
; else mkdir
$$parent ; fi
362 -if
[ -d
$(infodir) ] ; then true
; else mkdir
$(infodir) ; fi
363 for i in
*.
info* ; do \
364 $(INSTALL_DATA
) $$i $(infodir)/$$i ; \
371 # cvs rtag binutils-x-yy ld+utils
372 # cvs co -r binutils-x-yy ld+utils
374 # cd {HERE}; make dist [-f Makefile.in]
376 dist: $(DIST_NAME
).
tar.Z
378 diststuff
: $(DISTSTUFF
)
381 cd ..
/..
; rm -f
$(DIST_NAME
); ln
-s devo
$(DIST_NAME
)
382 make diststuff
-f Makefile.in
383 cd ..
/ld; make diststuff
-f Makefile.in
384 cd ..
/gprof
; make diststuff
-f Makefile.in
385 cd ..
/texinfo
; mv texinfo.
tex ..
; rm -rf
*; mv ..
/texinfo.
tex .
386 # Take out texinfo from configurable dirs
387 mv ..
/configure.in tmp
; \
388 sed
-e
'/^host_tools=/s/texinfo //' <tmp
>..
/configure.in
; rm tmp
389 cd ..
; chmod og
=u
`find . -print`
390 cd ..
/..
; tar chf
- $(DIST_NAME
) | compress
>$(DIST_NAME
).
tar.Z
391 rm -rf ..
/..
/$(DIST_NAME
)
393 # These get around a bug in Sun Make in SunOS 4.1.1
395 am29k-pinsn.o
: am29k-pinsn.c
400 filemode.o
:filemode.c
404 i960-pinsn.o
: i960-pinsn.c
405 is-ranlib.o
:is-ranlib.c
406 is-strip.o
:is-strip.c
407 maybe-ranlib.o
:maybe-ranlib.c
408 maybe-strip.o
:maybe-strip.c
410 not-ranlib.o
:not-ranlib.c
411 not-strip.o
:not-strip.c
414 sparc-pinsn.o
: sparc-pinsn.c
416 version.o
: $(srcdir)/version.c
417 $(CC
) $(CFLAGS
) $(INCLUDES
) $(HDEFINES
) $(TDEFINES
) -DVERSION
='"$(VERSION)"' -c
$(srcdir)/version.c
419 #-----------------------------------------------------------------------------
420 # 'STANDARD' GNU/960 TARGETS BELOW THIS POINT
422 # 'VERSION' file must be present and contain a string of the form "x.y"
423 #-----------------------------------------------------------------------------
427 echo
"char ${TARG}_ver[]= \"${TARG} `cat VERSION`, `date`\";" > ver960.c
430 # Dummy target to force execution of dependent targets.
434 # Target to uncomment host-specific lines in this makefile. Such lines must
435 # have the following string beginning in column 1: #__<hostname>__#
436 # Original Makefile is backed up as 'Makefile.old'.
438 # Invoke with: make make HOST=xxx
441 -@if
test $(HOST
)x
= x
; then \
442 echo
'\aSpecify "make make HOST=???"'; \
445 grep
-s
"^#The next line was generated by 'make make'" Makefile
; \
446 if
test $$?
= 0 ; then \
447 echo
"\aMakefile has already been processed with 'make make'";\
450 mv
-f Makefile Makefile.old
; \
451 echo
"#The next line was generated by 'make make'" >Makefile
; \
452 echo
"HOST=$(HOST)" >>Makefile
; \
454 sed
"s/^#__$(HOST)__#//" < Makefile.old
>>Makefile
456 Makefile
: $(srcdir)/Makefile.in
$(host_makefile_frag
) $(target_makefile_frag
)
457 $(SHELL
) .
/config.status
459 ### Local Variables: ***
460 ### mode:fundamental ***
461 ### page-delimiter: "^#\f" ***