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