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