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