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