Commit | Line | Data |
---|---|---|
db40ba14 SC |
1 | # Makefile for GNU binary-file utilities |
2 | # Copyright (C) 1989-1991 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 | #$Id$ | |
21 | ||
22 | srcdir = . | |
23 | ||
24 | ddestdir = /usr/local | |
25 | idestdir = $(ddestdir) | |
26 | ||
27 | SHELL = /bin/sh | |
28 | MAKEINFO=makeinfo | |
29 | TEXI2ROFF=texi2roff | |
30 | ||
31 | # Distribution version | |
32 | VERSION=1.92 | |
33 | # Distribution name | |
34 | DIST_NAME=binutils-beta-${VERSION} | |
35 | ||
36 | #version=`$(unsubdir)/../gcc$(subdir)/gcc -dumpversion` | |
37 | prefix = $(ddestdir) | |
38 | bindir = $(prefix)/bin | |
39 | mandir = $(idestdir)/man | |
40 | ||
41 | # Where to find texinfo.tex to format docn with TeX | |
42 | TEXIDIR = $(srcdir)/../texinfo/fsf | |
43 | ||
44 | MANPAGES= ar.1 nm.1 objdump.1 ranlib.1 size.1 strip.1 | |
45 | ||
46 | #INSTALL = install -c | |
47 | #INSTALL_PROGRAM = $(INSTALL) | |
48 | #INSTALL_FILE = $(INSTALL) | |
49 | ||
50 | #CC=gcc -Wall | |
51 | # these two are almost the same program | |
52 | AR_PROG=ar | |
53 | RANLIB_PROG=ranlib | |
54 | ||
55 | # copy and strip should be the same program | |
56 | COPY_PROG=copy | |
57 | STRIP_PROG=strip | |
58 | ||
59 | # These should all be the same program too. | |
60 | SIZE_PROG=size | |
61 | NM_PROG=nm | |
62 | OBJDUMP_PROG=objdump | |
63 | ||
64 | PROGS = $(SIZE_PROG) $(COPY_PROG) $(OBJDUMP_PROG) $(NM_PROG) $(AR_PROG) $(STRIP_PROG) $(RANLIB_PROG) | |
65 | STAGESTUFF = $(PROGS) *.o | |
66 | ||
67 | BASEDIR = $(srcdir)/.. | |
68 | LIBDIR = ../bfd | |
69 | ||
70 | MINUS_G = | |
71 | #### host and target dependant Makefile fragments come in here. | |
72 | HDEFINES=-O -D__MSDOS__ -D__GO32__ | |
73 | TDEFINES= | |
74 | MALLOC= | |
75 | ### | |
76 | ||
77 | INCDIR = $(BASEDIR)/include | |
78 | ||
79 | CFLAGS = $(MINUS_G) -I. -I$(srcdir) -I$(INCDIR) $(HDEFINES) $(TDEFINES) | |
80 | ||
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 | |
84 | ||
85 | #\f | |
86 | ## Random definitions | |
87 | # Hopefully all these may be flushed once we get configuration down pat. | |
88 | ||
89 | # alloca only needed for systems which don't have it and when cc != gcc. | |
90 | # ALLOCA = alloca.o | |
91 | ||
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. | |
96 | # MALLOC = gmalloc.o | |
97 | ||
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 | |
102 | ||
103 | # Code shared by all the binutils. | |
104 | BULIBS = bucomm.o version.o filemode.o | |
105 | ||
106 | ADDL_LIBS = $(MALLOC) $(BULIBS) $(BFD) $(LIBIBERTY) | |
107 | ||
108 | BFD = $(LIBDIR)/libbfd.a | |
109 | #\f | |
110 | ## The rules | |
111 | \0 | |
112 | all: $(ADDL_LIBS) $(PROGS) | |
113 | ||
114 | all-info: binutils.info | |
115 | ||
116 | #$(BFD):$(LIBDIR)/../common/*.c | |
117 | # (cd $(LIBDIR); make) | |
118 | ||
119 | $(SIZE_PROG): $(ADDL_LIBS) size.o $(BFD) | |
120 | >gcc.rf $(LDFLAGS) $(CFLAGS) -o $(SIZE_PROG) size.o $(ADDL_LIBS) $(LOADLIBES) | |
121 | $(CC) @gcc.rf | |
122 | ||
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) | |
125 | $(CC) @gcc.rf | |
126 | ||
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) | |
129 | $(CC) @gcc.rf | |
130 | ||
131 | $(NM_PROG): $(ADDL_LIBS) nm.o $(BFD) | |
132 | >gcc.rf $(LDFLAGS) $(CFLAGS) -o $(NM_PROG) nm.o $(ADDL_LIBS) $(LOADLIBES) | |
133 | $(CC) @gcc.rf | |
134 | ||
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) | |
137 | $(CC) @gcc.rf | |
138 | ||
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) | |
141 | $(CC) @gcc.rf | |
142 | ||
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) | |
145 | $(CC) @gcc.rf | |
146 | ||
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.) | |
151 | ||
152 | # Alternatively, you can install ranlib.sh as ranlib. | |
153 | ||
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) | |
158 | ||
159 | # copy and strip in one binary that uses argv[0] to decide its action. | |
160 | ||
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) | |
163 | -rm -f $(STRIP_PROG) | |
164 | -ln $(COPY_PROG) $(STRIP_PROG) | |
165 | ||
166 | stage1: force | |
167 | - mkdir stage1 | |
168 | - mv -f $(STAGESTUFF) stage1 | |
169 | ||
170 | stage2: force | |
171 | - mkdir stage2 | |
172 | - mv -f $(STAGESTUFF) stage2 | |
173 | ||
174 | stage3: force | |
175 | - mkdir stage3 | |
176 | - mv -f $(STAGESTUFF) stage3 | |
177 | ||
178 | against=stage2 | |
179 | ||
180 | comparison: force | |
181 | for i in $(STAGESTUFF) ; do cmp $$i $(against)/$$i ; done | |
182 | ||
183 | de-stage1: force | |
184 | - (cd stage1 ; mv -f * ..) | |
185 | - rmdir stage1 | |
186 | ||
187 | de-stage2: force | |
188 | - (cd stage2 ; mv -f * ..) | |
189 | - rmdir stage2 | |
190 | ||
191 | de-stage3: force | |
192 | - (cd stage3 ; mv -f * ..) | |
193 | - rmdir stage3 | |
194 | ||
195 | ###################################################################### | |
196 | # DOCUMENTATION TARGETS | |
197 | # TeX output | |
198 | binutils.dvi: $(srcdir)/binutils.texi | |
199 | TEXINPUTS=${TEXIDIR}:.:$$TEXINPUTS tex $(srcdir)/binutils.texi | |
200 | texindex binutils.?? | |
201 | TEXINPUTS=${TEXIDIR}:.:$$TEXINPUTS tex $(srcdir)/binutils.texi | |
202 | ||
203 | # info file for online browsing | |
204 | binutils.info: $(srcdir)/binutils.texi | |
205 | $(MAKEINFO) -o binutils.info $(srcdir)/binutils.texi | |
206 | ||
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 | |
217 | ||
218 | # roff output (-ms) | |
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' \ | |
223 | -e '/^@c/d' \ | |
224 | -e 's/{.*,,/{/' \ | |
225 | -e 's/@ / /g' \ | |
226 | -e 's/^@alphaenumerate/@enumerate/g' \ | |
227 | -e 's/^@end alphaenumerate/@end enumerate/g' \ | |
228 | $(srcdir)/binutils.texi | \ | |
229 | $(TEXI2ROFF) -ms | \ | |
230 | sed -e 's/---/\\(em/g' \ | |
231 | >binutils.ms | |
232 | ||
233 | # roff output (-mm) | |
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' \ | |
240 | -e '/^@c/d' \ | |
241 | -e 's/{.*,,/{/' \ | |
242 | -e '/@noindent/d' \ | |
243 | -e 's/@ / /g' \ | |
244 | -e 's/^@alphaenumerate/@enumerate/g' \ | |
245 | -e 's/^@end alphaenumerate/@end enumerate/g' \ | |
246 | $(srcdir)/binutils.texi | \ | |
247 | $(TEXI2ROFF) -mm | \ | |
248 | sed -e 's/---/\\(em/g' \ | |
249 | >binutils.mm | |
250 | ||
251 | # roff output (-me) | |
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' \ | |
256 | -e '/^@c/d' \ | |
257 | -e 's/{.*,,/{/' \ | |
258 | -e 's/@ / /g' \ | |
259 | -e 's/^@alphaenumerate/@enumerate/g' \ | |
260 | -e 's/^@end alphaenumerate/@end enumerate/g' \ | |
261 | $(srcdir)/binutils.texi | \ | |
262 | $(TEXI2ROFF) -me | \ | |
263 | sed -e 's/---/\\(em/g' \ | |
264 | >binutils.me | |
265 | ||
266 | ||
267 | ###################################################################### | |
268 | ||
269 | clean: | |
270 | -rm -f *.o *~ \#* core $(STAGESTUFF) TAGS binutils.?? binutils.??? | |
271 | ||
272 | etags tags: TAGS | |
273 | ||
274 | TAGS: force | |
275 | etags $(INCDIR)/*.h $(BFDSRC)/*.[hc] *.[hc] | |
276 | ||
277 | realclean: clean | |
278 | -rm -f $(STAGESTUFF) TAGS | |
279 | ||
280 | install: all | |
281 | for i in $(PROGS) ; do \ | |
282 | (cp $$i $(bindir)/$$i.new \ | |
283 | && mv -f $(bindir)/$$i.new $(bindir)/$$i) \ | |
284 | || exit 1 ; \ | |
285 | done | |
286 | for i in $(MANPAGES) ; do \ | |
287 | (cp $(srcdir)/$$i $(mandir)/man1/$$i.new \ | |
288 | && mv -f $(mandir)/man1/$$i.new $(mandir)/man1/$$i) \ | |
289 | || exit 1 ; \ | |
290 | done | |
291 | ||
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) \ | |
296 | || exit 1 ; \ | |
297 | done | |
298 | ||
299 | dist: $(DIST_NAME).tar.Z | |
300 | ||
301 | $(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) | |
307 | ||
308 | # These get around a bug in Sun Make in SunOS 4.1.1 | |
309 | alloca.o: alloca.c | |
310 | am29k-pinsn.o: am29k-pinsn.c | |
311 | ar.o: ar.c | |
312 | bucomm.o: bucomm.c | |
313 | copy.o: copy.c | |
314 | cplus-dem.o: cplus-dem.c | |
315 | filemode.o: filemode.c | |
316 | getopt.o: getopt.c | |
317 | getopt1.o: getopt1.c | |
318 | gmalloc.o: gmalloc.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 | |
324 | nm.o: nm.c | |
325 | not-ranlib.o: not-ranlib.c | |
326 | not-strip.o: not-strip.c | |
327 | objdump.o: objdump.c | |
328 | size.o: size.c | |
329 | sparc-pinsn.o: sparc-pinsn.c | |
330 | strip.o: strip.c | |
331 | version.o: $(srcdir)/version.c | |
332 | $(CC) -c $(CFLAGS) -DVERSION=\"$(VERSION)\" $(srcdir)/version.c | |
333 | ||
334 | #----------------------------------------------------------------------------- | |
335 | # 'STANDARD' GNU/960 TARGETS BELOW THIS POINT | |
336 | # | |
337 | # 'VERSION' file must be present and contain a string of the form "x.y" | |
338 | #----------------------------------------------------------------------------- | |
339 | ||
340 | ver960.c: FORCE | |
341 | rm -f ver960.c | |
342 | echo "char ${TARG}_ver[]= \"${TARG} `cat VERSION`, `date`\";" > ver960.c | |
343 | ||
344 | ||
345 | # Dummy target to force execution of dependent targets. | |
346 | # | |
347 | force: | |
348 | ||
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'. | |
352 | # | |
353 | # Invoke with: make make HOST=xxx | |
354 | # | |
355 | make: | |
356 | -@if test $(HOST)x = x ; then \ | |
357 | echo '\aSpecify "make make HOST=???"'; \ | |
358 | exit 1; \ | |
359 | fi ; \ | |
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'";\ | |
363 | exit 1; \ | |
364 | fi ; \ | |
365 | mv -f Makefile Makefile.old; \ | |
366 | echo "#The next line was generated by 'make make'" >Makefile ; \ | |
367 | echo "HOST=$(HOST)" >>Makefile ; \ | |
368 | echo >>Makefile ; \ | |
369 | sed "s/^#__$(HOST)__#//" < Makefile.old >>Makefile | |
370 | ||
371 | Makefile: $(srcdir)/Makefile.in $(host_makefile_frag) $(target_makefile_frag) | |
372 | $(SHELL) ./config.status | |
373 | ||
374 | ### Local Variables: *** | |
375 | ### mode:fundamental *** | |
376 | ### page-delimiter: "^#\f" *** | |
377 | ### End: *** | |
378 | ### end of file |