Avoid Sun Make VPATH bugs by adding dependencies.
[binutils-gdb.git] / binutils / Makefile.in
1 ### Makefile for GNU binary-file utilities
2
3 #$Id$
4
5 srcdir = .
6 destdir = /usr/local
7
8 # Distribution version
9 VERSION=1.90
10 # Distribution name
11 DIST_NAME=binutils-beta-${VERSION}
12
13 version=`$(unsubdir)/../gcc$(subdir)/gcc -dumpversion`
14 prefix = $(destdir)
15 bindir = $(prefix)/H-$(host_alias)/T-independent/bin
16
17 # Where to find texinfo.tex to format docn with TeX
18 TEXIDIR = $(srcdir)/../texinfo/fsf
19
20 #INSTALL = install -c
21 #INSTALL_PROGRAM = $(INSTALL)
22 #INSTALL_FILE = $(INSTALL)
23
24 #CC=gcc -Wall
25 # these two are almost the same program
26 AR_PROG=ar
27 RANLIB_PROG=ranlib
28
29 # copy and strip should be the same program
30 COPY_PROG=copy
31 STRIP_PROG=strip
32
33 # These should all be the same program too.
34 SIZE_PROG=size
35 NM_PROG=nm
36 OBJDUMP_PROG=objdump
37
38 PROGS = $(SIZE_PROG) $(COPY_PROG) $(OBJDUMP_PROG) $(NM_PROG) $(AR_PROG) $(STRIP_PROG) $(RANLIB_PROG)
39 STAGESTUFF = $(PROGS) *.o
40
41 BASEDIR = $(unsubdir)/..
42 LIBDIR = $(unsubdir)/../bfd$(subdir)
43
44 #### host and target dependant Makefile fragments come in here.
45 ###
46
47 INCDIR = $(BASEDIR)/include
48
49 CFLAGS = -g -I. -I$(INCDIR) $(HDEFINES) $(TDEFINES)
50
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
54
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.
71 LIBIBERTY = $(unsubdir)/../libiberty$(subdir)/libiberty.a
72
73 # Code shared by all the binutils.
74 BULIBS = bucomm.o version.o filemode.o
75
76 ADDL_LIBS = $(MALLOC) $(BULIBS) $(BFD) $(LIBIBERTY)
77
78 BFD = $(LIBDIR)/libbfd.a
79 #\f
80 ## The rules
81
82 all: $(ADDL_LIBS) $(PROGS)
83
84
85 #$(BFD):$(LIBDIR)/../common/*.c
86 # (cd $(LIBDIR); make)
87
88 $(SIZE_PROG): $(ADDL_LIBS) size.o $(BFD)
89 $(CC) $(LDFLAGS) $(CFLAGS) -o $(SIZE_PROG) size.o $(ADDL_LIBS) $(LOADLIBES)
90
91 $(COPY_PROG): $(ADDL_LIBS) copy.o $(BFD)
92 $(CC) $(LDFLAGS) $(CFLAGS) -o $(COPY_PROG) copy.o $(ADDL_LIBS) $(LOADLIBES)
93
94 $(NM_PROG): $(ADDL_LIBS) nm.o $(BFD)
95 $(CC) $(LDFLAGS) $(CFLAGS) -o $(NM_PROG) nm.o $(ADDL_LIBS) $(LOADLIBES)
96
97 $(OBJDUMP_PROG): $(ADDL_LIBS) size.o objdump.o $(DISASMS) $(BFD)
98 $(CC) $(LDFLAGS) $(CFLAGS) -o $(OBJDUMP_PROG) objdump.o $(DISASMS) $(ADDL_LIBS) $(LOADLIBES)
99
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)
102
103 $(RANLIB_PROG): $(ADDL_LIBS) ar.o is-ranlib.o $(BFD)
104 $(CC) $(LDFLAGS) $(CFLAGS) -o $(RANLIB_PROG) ar.o is-ranlib.o $(ADDL_LIBS) $(LOADLIBES)
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)
115 -rm -f $(RANLIB_PROG)
116 -ln $(AR_PROG) $(RANLIB_PROG)
117
118 $(STRIP_PROG): $(COPY_PROG)
119 -rm -f $(STRIP_PROG)
120 -ln $(COPY_PROG) $(STRIP_PROG)
121
122 stage1: force
123 - mkdir stage1
124 - mv -f $(STAGESTUFF) stage1
125
126 stage2: force
127 - mkdir stage2
128 - mv -f $(STAGESTUFF) stage2
129
130 stage3: force
131 - mkdir stage3
132 - mv -f $(STAGESTUFF) stage3
133
134 against=stage2
135
136 comparison: force
137 for i in $(STAGESTUFF) ; do cmp $$i $(against)/$$i ; done
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
151 ######################################################################
152 # DOCUMENTATION TARGETS
153 # TeX output
154 binutils.dvi: binutils.texinfo
155 TEXINPUTS=${TEXIDIR}:.:$$TEXINPUTS tex binutils.texinfo
156 texindex binutils.??
157 TEXINPUTS=${TEXIDIR}:.:$$TEXINPUTS tex binutils.texinfo
158
159 # info file for online browsing
160 binutils.info: binutils.texinfo
161 makeinfo binutils.texinfo
162
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
175 clean:
176 -rm -f *.o *~ \#* core $(STAGESTUFF) TAGS binutils.?? binutils.???
177
178 etags tags: TAGS
179
180 TAGS: force
181 etags $(INCDIR)/*.h $(BFDSRC)/*.[hc] *.[hc]
182
183 realclean: clean
184 -rm -f $(STAGESTUFF) TAGS
185
186 install: $(PROGS)
187 for i in $(PROGS) ; do \
188 cp $$i $(bindir)/$$i.new ; \
189 mv -f $(bindir)/$$i.new $(bindir)/$$i ; \
190 done
191
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
199 # These get around a bug in Sun Make in SunOS 4.1.1
200 alloca.o:alloca.c
201 am29k-pinsn.o: am29k-pinsn.c
202 ar.o: ar.c
203 bucomm.o: bucomm.c
204 copy.o: copy.c
205 cplus-dem.o:cplus-dem.c
206 filemode.o:filemode.c
207 getopt.o:getopt.c
208 getopt1.o:getopt1.c
209 gmalloc.o:gmalloc.c
210 i960-pinsn.o: i960-pinsn.c
211 is-ranlib.o:is-ranlib.c
212 m68k-pinsn.o: m68k-pinsn.c
213 maybe-ranlib.o:maybe-ranlib.c
214 nm.o: nm.c
215 not-ranlib.o:not-ranlib.c
216 objdump.o: objdump.c
217 size.o: size.c
218 sparc-pinsn.o: sparc-pinsn.c
219 strip.o:strip.c
220 version.o: version.c
221
222 #-----------------------------------------------------------------------------
223 # 'STANDARD' GNU/960 TARGETS BELOW THIS POINT
224 #
225 # 'VERSION' file must be present and contain a string of the form "x.y"
226 #-----------------------------------------------------------------------------
227
228 ver960.c: FORCE
229 rm -f ver960.c
230 echo "char ${TARG}_ver[]= \"${TARG} `cat VERSION`, `date`\";" > ver960.c
231
232
233 # Dummy target to force execution of dependent targets.
234 #
235 force:
236
237 # Target to uncomment host-specific lines in this makefile. Such lines must
238 # have the following string beginning in column 1: #__<hostname>__#
239 # Original Makefile is backed up as 'Makefile.old'.
240 #
241 # Invoke with: make make HOST=xxx
242 #
243 make:
244 -@if test $(HOST)x = x ; then \
245 echo '\aSpecify "make make HOST=???"'; \
246 exit 1; \
247 fi ; \
248 grep -s "^#The next line was generated by 'make make'" Makefile; \
249 if test $$? = 0 ; then \
250 echo "\aMakefile has already been processed with 'make make'";\
251 exit 1; \
252 fi ; \
253 mv -f Makefile Makefile.old; \
254 echo "#The next line was generated by 'make make'" >Makefile ; \
255 echo "HOST=$(HOST)" >>Makefile ; \
256 echo >>Makefile ; \
257 sed "s/^#__$(HOST)__#//" < Makefile.old >>Makefile
258
259 Makefile: $(srcdir)/Makefile.in $(host_makefile_frag) $(target_makefile_frag)
260 $(SHELL) ./config.status
261
262 ### Local Variables: ***
263 ### mode:fundamental ***
264 ### page-delimiter: "^#\f" ***
265 ### End: ***
266 ### end of file