]>
Commit | Line | Data |
---|---|---|
99a42820 RP |
1 | ### Makefile for GNU binary-file utilities |
2 | ||
3 | #$Id$ | |
4 | ||
a10d26a1 | 5 | srcdir = . |
b5132a6b RP |
6 | destdir = /usr/local |
7 | ||
8539db10 PB |
8 | # Distribution version |
9 | VERSION=1.90 | |
10 | # Distribution name | |
11 | DIST_NAME=binutils-beta-${VERSION} | |
12 | ||
06a97fbd | 13 | version=`$(unsubdir)/../gcc$(subdir)/gcc -dumpversion` |
b5132a6b | 14 | prefix = $(destdir) |
7eff5bcf | 15 | bindir = $(prefix)/H-$(host_alias)/T-independent/bin |
b5132a6b | 16 | |
6b583720 | 17 | # Where to find texinfo.tex to format docn with TeX |
b7a11ec2 RP |
18 | TEXIDIR = $(srcdir)/../texinfo/fsf |
19 | ||
7eff5bcf JG |
20 | #INSTALL = install -c |
21 | #INSTALL_PROGRAM = $(INSTALL) | |
22 | #INSTALL_FILE = $(INSTALL) | |
a10d26a1 | 23 | |
a10d26a1 | 24 | #CC=gcc -Wall |
06a97fbd | 25 | # these two are almost the same program |
a10d26a1 RP |
26 | AR_PROG=ar |
27 | RANLIB_PROG=ranlib | |
99a42820 RP |
28 | |
29 | # copy and strip should be the same program | |
a10d26a1 RP |
30 | COPY_PROG=copy |
31 | STRIP_PROG=strip | |
99a42820 RP |
32 | |
33 | # These should all be the same program too. | |
a10d26a1 RP |
34 | SIZE_PROG=size |
35 | NM_PROG=nm | |
36 | OBJDUMP_PROG=objdump | |
99a42820 | 37 | |
a10d26a1 | 38 | PROGS = $(SIZE_PROG) $(COPY_PROG) $(OBJDUMP_PROG) $(NM_PROG) $(AR_PROG) $(STRIP_PROG) $(RANLIB_PROG) |
a01bf1fb | 39 | STAGESTUFF = $(PROGS) *.o |
99a42820 | 40 | |
06a97fbd PB |
41 | BASEDIR = $(unsubdir)/.. |
42 | LIBDIR = $(unsubdir)/../bfd$(subdir) | |
a10d26a1 | 43 | |
a10d26a1 RP |
44 | #### host and target dependant Makefile fragments come in here. |
45 | ### | |
46 | ||
9bba7784 | 47 | INCDIR = $(BASEDIR)/include |
99a42820 | 48 | |
7eff5bcf | 49 | CFLAGS = -g -I. -I$(INCDIR) $(HDEFINES) $(TDEFINES) |
99a42820 | 50 | |
a26878d1 RP |
51 | # When adding .o files, to make VPATH work in Sun Make, you have to |
52 | # also add a foo.o: foo.c line at the bottom of the file. | |
53 | DISASMS = m68k-pinsn.o i960-pinsn.o sparc-pinsn.o am29k-pinsn.o | |
6a3958b2 | 54 | |
99a42820 RP |
55 | #\f |
56 | ## Random definitions | |
57 | # Hopefully all these may be flushed once we get configuration down pat. | |
58 | ||
59 | # alloca only needed for systems which don't have it and when cc != gcc. | |
60 | # ALLOCA = alloca.o | |
61 | ||
62 | # nm tries to malloc enough space for the string table. The old GNU malloc | |
63 | # rounds this up to a power of two (e.g. 5M becomes 8M), and so it might | |
64 | # fail unnecessarily. I've also seen some Unix malloc's fail, even when | |
65 | # there is enough memory. So use the new GNU malloc. | |
66 | # MALLOC = gmalloc.o | |
67 | ||
68 | # Use the GNU getopt unless you have problems with it. | |
69 | # The IRIS version could probably benefit from being assembled with | |
70 | # libmalloc rather than the ordinary malloc. | |
06a97fbd | 71 | LIBIBERTY = $(unsubdir)/../libiberty$(subdir)/libiberty.a |
99a42820 RP |
72 | |
73 | # Code shared by all the binutils. | |
a10d26a1 | 74 | BULIBS = bucomm.o version.o filemode.o |
99a42820 | 75 | |
7a5a3c7b | 76 | ADDL_LIBS = $(MALLOC) $(BULIBS) $(BFD) $(LIBIBERTY) |
99a42820 RP |
77 | |
78 | BFD = $(LIBDIR)/libbfd.a | |
79 | #\f | |
80 | ## The rules | |
81 | ||
a10d26a1 RP |
82 | all: $(ADDL_LIBS) $(PROGS) |
83 | ||
84 | ||
85 | #$(BFD):$(LIBDIR)/../common/*.c | |
86 | # (cd $(LIBDIR); make) | |
99a42820 | 87 | |
a10d26a1 | 88 | $(SIZE_PROG): $(ADDL_LIBS) size.o $(BFD) |
6a3958b2 | 89 | $(CC) $(LDFLAGS) $(CFLAGS) -o $(SIZE_PROG) size.o $(ADDL_LIBS) $(LOADLIBES) |
99a42820 | 90 | |
a10d26a1 | 91 | $(COPY_PROG): $(ADDL_LIBS) copy.o $(BFD) |
6a3958b2 | 92 | $(CC) $(LDFLAGS) $(CFLAGS) -o $(COPY_PROG) copy.o $(ADDL_LIBS) $(LOADLIBES) |
99a42820 | 93 | |
a10d26a1 | 94 | $(NM_PROG): $(ADDL_LIBS) nm.o $(BFD) |
6a3958b2 | 95 | $(CC) $(LDFLAGS) $(CFLAGS) -o $(NM_PROG) nm.o $(ADDL_LIBS) $(LOADLIBES) |
99a42820 | 96 | |
a10d26a1 | 97 | $(OBJDUMP_PROG): $(ADDL_LIBS) size.o objdump.o $(DISASMS) $(BFD) |
6a3958b2 | 98 | $(CC) $(LDFLAGS) $(CFLAGS) -o $(OBJDUMP_PROG) objdump.o $(DISASMS) $(ADDL_LIBS) $(LOADLIBES) |
99a42820 | 99 | |
06a97fbd PB |
100 | $(AR_PROG): $(ADDL_LIBS) ar.o not-ranlib.o $(BFD) |
101 | $(CC) $(LDFLAGS) $(CFLAGS) -o $(AR_PROG) ar.o not-ranlib.o $(ADDL_LIBS) $(LOADLIBES) | |
99a42820 | 102 | |
06a97fbd | 103 | $(RANLIB_PROG): $(ADDL_LIBS) ar.o is-ranlib.o $(BFD) |
8539db10 | 104 | $(CC) $(LDFLAGS) $(CFLAGS) -o $(RANLIB_PROG) ar.o is-ranlib.o $(ADDL_LIBS) $(LOADLIBES) |
06a97fbd PB |
105 | |
106 | # This rule creates a single binary that switches between ar and ranlib | |
107 | # by looking at argv[0]. Use this kludge to save some disk space. | |
108 | # However, you have to install things by hand. | |
109 | # (That is after 'make install', replace the installed ranlib by a link to ar.) | |
110 | ||
111 | # Alternatively, you can install ranlib.sh as ranlib. | |
112 | ||
113 | ar_with_ranlib: $(ADDL_LIBS) ar.o maybe-ranlib.o $(BFD) | |
114 | $(CC) $(LDFLAGS) $(CFLAGS) -o $(AR_PROG) ar.o maybe-ranlib.o $(ADDL_LIBS) $(LOADLIBES) | |
a10d26a1 RP |
115 | -rm -f $(RANLIB_PROG) |
116 | -ln $(AR_PROG) $(RANLIB_PROG) | |
99a42820 | 117 | |
a10d26a1 RP |
118 | $(STRIP_PROG): $(COPY_PROG) |
119 | -rm -f $(STRIP_PROG) | |
120 | -ln $(COPY_PROG) $(STRIP_PROG) | |
99a42820 | 121 | |
6a3958b2 RP |
122 | stage1: force |
123 | - mkdir stage1 | |
a01bf1fb | 124 | - mv -f $(STAGESTUFF) stage1 |
6a3958b2 RP |
125 | |
126 | stage2: force | |
127 | - mkdir stage2 | |
a01bf1fb | 128 | - mv -f $(STAGESTUFF) stage2 |
6a3958b2 RP |
129 | |
130 | stage3: force | |
131 | - mkdir stage3 | |
a01bf1fb RP |
132 | - mv -f $(STAGESTUFF) stage3 |
133 | ||
134 | against=stage2 | |
135 | ||
136 | comparison: force | |
137 | for i in $(STAGESTUFF) ; do cmp $$i $(against)/$$i ; done | |
6a3958b2 RP |
138 | |
139 | de-stage1: force | |
140 | - (cd stage1 ; mv -f * ..) | |
141 | - rmdir stage1 | |
142 | ||
143 | de-stage2: force | |
144 | - (cd stage2 ; mv -f * ..) | |
145 | - rmdir stage2 | |
146 | ||
147 | de-stage3: force | |
148 | - (cd stage3 ; mv -f * ..) | |
149 | - rmdir stage3 | |
150 | ||
6b583720 RP |
151 | ###################################################################### |
152 | # DOCUMENTATION TARGETS | |
153 | # TeX output | |
b7a11ec2 RP |
154 | binutils.dvi: binutils.texinfo |
155 | TEXINPUTS=${TEXIDIR}:.:$$TEXINPUTS tex binutils.texinfo | |
156 | texindex binutils.?? | |
157 | TEXINPUTS=${TEXIDIR}:.:$$TEXINPUTS tex binutils.texinfo | |
158 | ||
6b583720 | 159 | # info file for online browsing |
b7a11ec2 RP |
160 | binutils.info: binutils.texinfo |
161 | makeinfo binutils.texinfo | |
162 | ||
6b583720 RP |
163 | # roff output (-ms) |
164 | # edit instances of "ms" to "me" or "mm" to suit your preferences. | |
165 | # (we don't use a variable because we don't trust all makes to handle | |
166 | # a var in the target name right). | |
167 | binutils.ms: binutils.texinfo | |
168 | sed -e '/\\input texinfo/d' \ | |
169 | -e '/@c TEXI2ROFF-KILL/,/@c END TEXI2ROFF-KILL/d' \ | |
170 | binutils.texinfo | \ | |
171 | texi2roff -ms >binutils.ms | |
172 | ||
173 | ###################################################################### | |
174 | ||
99a42820 | 175 | clean: |
b7a11ec2 | 176 | -rm -f *.o *~ \#* core $(STAGESTUFF) TAGS binutils.?? binutils.??? |
99a42820 RP |
177 | |
178 | etags tags: TAGS | |
179 | ||
6a3958b2 | 180 | TAGS: force |
99a42820 RP |
181 | etags $(INCDIR)/*.h $(BFDSRC)/*.[hc] *.[hc] |
182 | ||
183 | realclean: clean | |
a01bf1fb | 184 | -rm -f $(STAGESTUFF) TAGS |
99a42820 RP |
185 | |
186 | install: $(PROGS) | |
b5132a6b | 187 | for i in $(PROGS) ; do \ |
7eff5bcf JG |
188 | cp $$i $(bindir)/$$i.new ; \ |
189 | mv -f $(bindir)/$$i.new $(bindir)/$$i ; \ | |
99a42820 RP |
190 | done |
191 | ||
8539db10 PB |
192 | dist: $(DIST_NAME).tar.Z |
193 | ||
194 | $(DIST_NAME).tar.Z: proto-dir | |
195 | ln -s proto-dir $(DIST_NAME) | |
196 | tar chf - $(DIST_NAME) | compress >$(DIST_NAME).tar.Z | |
197 | rm -rf $(DIST_NAME) | |
198 | ||
99a42820 RP |
199 | bucomm.o: bucomm.c |
200 | version.o: version.c | |
201 | size.o: size.c | |
202 | copy.o: copy.c | |
203 | objdump.o: objdump.c | |
204 | m68k-pinsn.o: m68k-pinsn.c | |
99a42820 RP |
205 | i960-pinsn.o: i960-pinsn.c |
206 | sparc-pinsn.o: sparc-pinsn.c | |
a26878d1 | 207 | am29k-pinsn.o: am29k-pinsn.c |
99a42820 RP |
208 | nm.o: nm.c |
209 | ar.o: ar.c | |
a10d26a1 RP |
210 | getopt.o:getopt.c |
211 | getopt1.o:getopt1.c | |
212 | filemode.o:filemode.c | |
8539db10 | 213 | |
99a42820 RP |
214 | #----------------------------------------------------------------------------- |
215 | # 'STANDARD' GNU/960 TARGETS BELOW THIS POINT | |
216 | # | |
217 | # 'VERSION' file must be present and contain a string of the form "x.y" | |
218 | #----------------------------------------------------------------------------- | |
219 | ||
220 | ver960.c: FORCE | |
221 | rm -f ver960.c | |
222 | echo "char ${TARG}_ver[]= \"${TARG} `cat VERSION`, `date`\";" > ver960.c | |
223 | ||
224 | ||
225 | # Dummy target to force execution of dependent targets. | |
226 | # | |
6a3958b2 | 227 | force: |
99a42820 RP |
228 | |
229 | # Target to uncomment host-specific lines in this makefile. Such lines must | |
230 | # have the following string beginning in column 1: #__<hostname>__# | |
231 | # Original Makefile is backed up as 'Makefile.old'. | |
232 | # | |
233 | # Invoke with: make make HOST=xxx | |
234 | # | |
235 | make: | |
236 | -@if test $(HOST)x = x ; then \ | |
237 | echo '\aSpecify "make make HOST=???"'; \ | |
238 | exit 1; \ | |
239 | fi ; \ | |
240 | grep -s "^#The next line was generated by 'make make'" Makefile; \ | |
241 | if test $$? = 0 ; then \ | |
242 | echo "\aMakefile has already been processed with 'make make'";\ | |
243 | exit 1; \ | |
244 | fi ; \ | |
245 | mv -f Makefile Makefile.old; \ | |
246 | echo "#The next line was generated by 'make make'" >Makefile ; \ | |
247 | echo "HOST=$(HOST)" >>Makefile ; \ | |
248 | echo >>Makefile ; \ | |
249 | sed "s/^#__$(HOST)__#//" < Makefile.old >>Makefile | |
250 | ||
f1eb48b6 | 251 | Makefile: $(srcdir)/Makefile.in $(host_makefile_frag) $(target_makefile_frag) |
a26878d1 | 252 | $(SHELL) ./config.status |
99a42820 RP |
253 | |
254 | ### Local Variables: *** | |
255 | ### mode:fundamental *** | |
256 | ### page-delimiter: "^#\f" *** | |
257 | ### End: *** | |
258 | ### end of file |