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