More build fixes in opcodes
[external/binutils.git] / opcodes / Makefile.am
1 ## Process this file with automake to generate Makefile.in
2
3 AUTOMAKE_OPTIONS = 1.11 foreign no-dist
4 ACLOCAL_AMFLAGS = -I .. -I ../config -I ../bfd
5
6 SUBDIRS = po
7
8 INCDIR = $(srcdir)/../include
9 BFDDIR = $(srcdir)/../bfd
10
11 WARN_CFLAGS = @WARN_CFLAGS@
12 NO_WERROR = @NO_WERROR@
13 AM_CFLAGS = $(WARN_CFLAGS)
14
15 bfdlibdir = @bfdlibdir@
16 bfdincludedir = @bfdincludedir@
17
18 libopcodes_la_LDFLAGS =
19 if INSTALL_LIBBFD
20 bfdlib_LTLIBRARIES = libopcodes.la
21 bfdinclude_DATA = $(INCDIR)/dis-asm.h
22 else
23 noinst_LTLIBRARIES = libopcodes.la
24 libopcodes_la_LDFLAGS += -rpath $(bfdlibdir)
25 endif
26
27 # This is where bfd.h lives.
28 BFD_H = ../bfd/bfd.h
29
30 # This is where libiberty lives.
31 LIBIBERTY = ../libiberty/libiberty.a
32
33 # Header files.
34 HFILES = \
35         cgen-ops.h cgen-types.h \
36         fr30-desc.h fr30-opc.h \
37         frv-desc.h frv-opc.h \
38         h8500-opc.h \
39         i386-init.h \
40         i386-opc.h \
41         i386-tbl.h \
42         ia64-asmtab.h \
43         ia64-opc.h \
44         ip2k-desc.h ip2k-opc.h \
45         iq2000-desc.h iq2000-opc.h \
46         lm32-desc.h \
47         lm32-opc.h \
48         m32c-desc.h m32c-opc.h \
49         m32r-desc.h m32r-opc.h \
50         mcore-opc.h \
51         mep-desc.h mep-opc.h \
52         microblaze-opc.h \
53         mt-desc.h mt-opc.h \
54         openrisc-desc.h openrisc-opc.h \
55         score-opc.h \
56         sh-opc.h \
57         sh64-opc.h \
58         sysdep.h \
59         w65-opc.h \
60         xc16x-desc.h xc16x-opc.h \
61         xstormy16-desc.h xstormy16-opc.h \
62         z8k-opc.h
63
64 # C source files that correspond to .o's ending up in libopcodes
65 # for all machines.
66 TARGET_LIBOPCODES_CFILES = \
67         alpha-dis.c \
68         alpha-opc.c \
69         arc-dis.c \
70         arc-ext.c \
71         arc-opc.c \
72         arm-dis.c \
73         avr-dis.c \
74         bfin-dis.c \
75         cgen-asm.c \
76         cgen-bitset.c \
77         cgen-dis.c \
78         cgen-opc.c \
79         cr16-dis.c \
80         cr16-opc.c \
81         cris-dis.c \
82         cris-opc.c \
83         crx-dis.c \
84         crx-opc.c \
85         d10v-dis.c \
86         d10v-opc.c \
87         d30v-dis.c \
88         d30v-opc.c \
89         dlx-dis.c \
90         fr30-asm.c \
91         fr30-desc.c \
92         fr30-dis.c \
93         fr30-ibld.c \
94         fr30-opc.c \
95         frv-asm.c \
96         frv-desc.c \
97         frv-dis.c \
98         frv-ibld.c \
99         frv-opc.c \
100         h8300-dis.c \
101         h8500-dis.c \
102         hppa-dis.c \
103         i370-dis.c \
104         i370-opc.c \
105         i386-dis.c \
106         i386-opc.c \
107         i860-dis.c \
108         i960-dis.c \
109         ia64-dis.c \
110         ia64-opc.c \
111         ip2k-asm.c \
112         ip2k-desc.c \
113         ip2k-dis.c \
114         ip2k-ibld.c \
115         ip2k-opc.c \
116         iq2000-asm.c \
117         iq2000-desc.c \
118         iq2000-dis.c \
119         iq2000-ibld.c \
120         iq2000-opc.c \
121         lm32-asm.c \
122         lm32-desc.c \
123         lm32-dis.c \
124         lm32-ibld.c \
125         lm32-opc.c \
126         lm32-opinst.c \
127         m10200-dis.c \
128         m10200-opc.c \
129         m10300-dis.c \
130         m10300-opc.c \
131         m32c-asm.c \
132         m32c-desc.c \
133         m32c-dis.c \
134         m32c-ibld.c \
135         m32c-opc.c \
136         m32r-asm.c \
137         m32r-desc.c \
138         m32r-dis.c \
139         m32r-ibld.c \
140         m32r-opc.c \
141         m32r-opinst.c \
142         m68hc11-dis.c \
143         m68hc11-opc.c \
144         m68k-dis.c \
145         m68k-opc.c \
146         m88k-dis.c \
147         maxq-dis.c \
148         mcore-dis.c \
149         mep-asm.c \
150         mep-desc.c \
151         mep-dis.c \
152         mep-ibld.c \
153         mep-opc.c \
154         microblaze-dis.c \
155         mips-dis.c \
156         mips-opc.c \
157         mips16-opc.c \
158         mmix-dis.c \
159         mmix-opc.c \
160         moxie-dis.c \
161         moxie-opc.c \
162         msp430-dis.c \
163         mt-asm.c \
164         mt-desc.c \
165         mt-dis.c \
166         mt-ibld.c \
167         mt-opc.c \
168         ns32k-dis.c \
169         openrisc-asm.c \
170         openrisc-desc.c \
171         openrisc-dis.c \
172         openrisc-ibld.c \
173         openrisc-opc.c \
174         or32-dis.c \
175         or32-opc.c \
176         pdp11-dis.c \
177         pdp11-opc.c \
178         pj-dis.c \
179         pj-opc.c \
180         ppc-dis.c \
181         ppc-opc.c \
182         s390-dis.c \
183         s390-opc.c \
184         score-dis.c \
185         score7-dis.c \
186         sh-dis.c \
187         sh64-dis.c \
188         sh64-opc.c \
189         sparc-dis.c \
190         sparc-opc.c \
191         spu-dis.c \
192         spu-opc.c \
193         tic30-dis.c \
194         tic4x-dis.c \
195         tic54x-dis.c \
196         tic54x-opc.c \
197         tic80-dis.c \
198         tic80-opc.c \
199         v850-dis.c \
200         v850-opc.c \
201         vax-dis.c \
202         w65-dis.c \
203         xc16x-asm.c \
204         xc16x-desc.c \
205         xc16x-dis.c \
206         xc16x-ibld.c \
207         xc16x-opc.c \
208         xstormy16-asm.c \
209         xstormy16-desc.c \
210         xstormy16-dis.c \
211         xstormy16-ibld.c \
212         xstormy16-opc.c \
213         xtensa-dis.c \
214         z80-dis.c \
215         z8k-dis.c
216
217 # C source files that correspond to .o's ending up in libopcodes.
218 LIBOPCODES_CFILES = \
219         $(TARGET_LIBOPCODES_CFILES) \
220         dis-buf.c \
221         dis-init.c \
222         disassemble.c
223
224 # C source files that correspond to .o's.
225 CFILES = \
226         $(LIBOPCODES_CFILES) \
227         i386-gen.c \
228         ia64-asmtab.c \
229         ia64-gen.c \
230         ia64-opc-a.c \
231         ia64-opc-b.c \
232         ia64-opc-f.c \
233         ia64-opc-i.c \
234         ia64-opc-m.c \
235         ia64-opc-d.c \
236         s390-mkopc.c \
237         z8kgen.c
238
239 ALL_MACHINES = $(TARGET_LIBOPCODES_CFILES:.c=.lo)
240
241 OFILES = @BFD_MACHINES@
242
243 # We should reconfigure whenever bfd/configure.in changes, because
244 # that's where the version number in Makefile comes from.
245 CONFIG_STATUS_DEPENDENCIES = $(BFDDIR)/configure.in
246
247 AM_CPPFLAGS = -I. -I$(srcdir) -I../bfd -I$(INCDIR) -I$(BFDDIR) @HDEFINES@ @INCINTL@
248
249 disassemble.lo: disassemble.c
250 if am__fastdepCC
251         $(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ @archdefs@ $(srcdir)/disassemble.c
252         mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
253 else
254 if AMDEP
255         source='disassemble.c' object='$@' libtool=yes @AMDEPBACKSLASH@
256         DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
257 endif
258         $(LTCOMPILE) -c -o $@ @archdefs@ $(srcdir)/disassemble.c
259 endif
260
261 libopcodes_la_SOURCES =  dis-buf.c disassemble.c dis-init.c
262 # It's desirable to list ../bfd/libbfd.la in DEPENDENCIES and LIBADD.
263 # Unfortunately this causes libtool to add -L$(libdir), referring to the
264 # planned install directory of libbfd.  This can cause us to pick up an
265 # old version of libbfd, or to pick up libbfd for the wrong architecture
266 # if host != build. So for building with shared libraries we use a
267 # hardcoded path to libbfd.so instead of relying on the entries in libbfd.la.
268 libopcodes_la_DEPENDENCIES = $(OFILES) @SHARED_DEPENDENCIES@
269 libopcodes_la_LIBADD = $(OFILES) @SHARED_LIBADD@
270 libopcodes_la_LDFLAGS += -release `cat ../bfd/libtool-soversion` @SHARED_LDFLAGS@
271 # Allow dependency tracking to work on all the source files.
272 EXTRA_libopcodes_la_SOURCES = $(LIBOPCODES_CFILES)
273
274 # libtool will build .libs/libopcodes.a.  We create libopcodes.a in
275 # the build directory so that we don't have to convert all the
276 # programs that use libopcodes.a simultaneously.  This is a hack which
277 # should be removed if everything else starts using libtool.  FIXME.
278
279 noinst_LIBRARIES = libopcodes.a
280
281 stamp-lib: libopcodes.la
282         libtooldir=`$(LIBTOOL) --config | sed -n -e 's/^objdir=//p'`; \
283         if [ -f $$libtooldir/libopcodes.a ]; then \
284           cp $$libtooldir/libopcodes.a libopcodes.tmp; \
285           $(RANLIB) libopcodes.tmp; \
286           $(SHELL) $(srcdir)/../move-if-change libopcodes.tmp libopcodes.a; \
287         else true; fi
288         touch stamp-lib
289
290 libopcodes.a: stamp-lib ; @true
291
292 POTFILES = $(HFILES) $(CFILES)
293 po/POTFILES.in: @MAINT@ Makefile
294         for f in $(POTFILES); do echo $$f; done | LC_ALL=C sort > tmp \
295           && mv tmp $(srcdir)/po/POTFILES.in
296
297 CLEANFILES = \
298         stamp-ip2k stamp-m32c stamp-m32r stamp-fr30 stamp-frv \
299         stamp-openrisc stamp-iq2000 stamp-mep stamp-mt stamp-xstormy16 stamp-xc16x\
300         libopcodes.a stamp-lib dep.sed DEP DEPA DEP1 DEP2
301
302
303 CGENDIR = @cgendir@
304 CPUDIR = $(CGENDIR)/cpu
305 CGEN = "`if test -f ../guile/libguile/guile ; then echo ../guile/libguile/guile; else echo guile ; fi` -l ${cgendir}/guile.scm -s"
306 CGENFLAGS = -v
307
308 CGENDEPS = \
309         $(CGENDIR)/desc.scm $(CGENDIR)/desc-cpu.scm \
310         $(CGENDIR)/opcodes.scm $(CGENDIR)/opc-asmdis.scm \
311         $(CGENDIR)/opc-ibld.scm $(CGENDIR)/opc-itab.scm \
312         $(CGENDIR)/opc-opinst.scm \
313         cgen-asm.in cgen-dis.in cgen-ibld.in
314
315 CGEN_CPUS = fr30 frv ip2k m32c m32r mep mt openrisc xc16x xstormy16
316
317 if CGEN_MAINT
318 IP2K_DEPS = stamp-ip2k
319 LM32_DEPS = stamp-lm32
320 M32C_DEPS = stamp-m32c
321 M32R_DEPS = stamp-m32r
322 FR30_DEPS = stamp-fr30
323 FRV_DEPS = stamp-frv
324 MEP_DEPS = stamp-mep
325 MT_DEPS = stamp-mt
326 OPENRISC_DEPS = stamp-openrisc
327 IQ2000_DEPS = stamp-iq2000
328 XC16X_DEPS = stamp-xc16x
329 XSTORMY16_DEPS = stamp-xstormy16
330 else
331 IP2K_DEPS =
332 LM32_DEPS = 
333 M32C_DEPS =
334 M32R_DEPS =
335 FR30_DEPS =
336 FRV_DEPS =
337 MEP_DEPS =
338 MT_DEPS =
339 OPENRISC_DEPS = 
340 IQ2000_DEPS = 
341 XC16X_DEPS = 
342 XSTORMY16_DEPS = 
343 endif
344
345 run-cgen:
346         $(SHELL) $(srcdir)/cgen.sh opcodes $(srcdir) $(CGEN) \
347           $(CGENDIR) "$(CGENFLAGS)" $(arch) $(prefix) $(archfile) $(opcfile) \
348           "$(options)" "$(extrafiles)"
349         touch stamp-${prefix}
350 .PHONY: run-cgen
351
352 # Maintainer utility rule to regenerate all cgen files.
353 run-cgen-all:
354         for c in $(CGEN_CPUS) ; \
355         do \
356                 $(MAKE) stamp-$$c || exit 1 ; \
357         done
358 .PHONY: run-cgen-all
359
360 # For now, require developers to configure with --enable-cgen-maint.
361 $(srcdir)/ip2k-desc.h $(srcdir)/ip2k-desc.c $(srcdir)/ip2k-opc.h $(srcdir)/ip2k-opc.c $(srcdir)/ip2k-ibld.c $(srcdir)/ip2k-asm.c $(srcdir)/ip2k-dis.c: $(IP2K_DEPS)
362         @true
363 stamp-ip2k: $(CGENDEPS) $(CPUDIR)/ip2k.cpu $(CPUDIR)/ip2k.opc
364         $(MAKE) run-cgen arch=ip2k prefix=ip2k options= \
365                 archfile=$(CPUDIR)/ip2k.cpu opcfile=$(CPUDIR)/ip2k.opc extrafiles=
366
367 $(srcdir)lm32-desc.h $(srcdir)/lm32-desc.c $(srcdir)/lm32-opc.h $(srcdir)/lm32-opc.c $(srcdir)/lm32-ibld.c $(srcdir)/lm32-opinst.c $(srcdir)/lm32-asm.c $(srcdir)/lm32-dis.c: $(LM32_DEPS)
368         @true
369 stamp-lm32: $(CGENDEPS) $(srcdir)/../cpu/lm32.cpu $(srcdir)/../cpu/lm32.opc
370         $(MAKE) run-cgen arch=lm32 prefix=lm32 options=opinst \
371                 archfile=$(srcdir)/../cpu/lm32.cpu \
372                 opcfile=$(srcdir)/../cpu/lm32.opc \
373                 extrafiles=opinst
374
375 $(srcdir)/m32c-desc.h $(srcdir)/m32c-desc.c $(srcdir)/m32c-opc.h $(srcdir)/m32c-opc.c $(srcdir)/m32c-ibld.c $(srcdir)/m32c-asm.c $(srcdir)/m32c-dis.c: $(M32C_DEPS)
376 #       @true
377 stamp-m32c: $(CGENDEPS) $(srcdir)/../cpu/m32c.cpu $(srcdir)/../cpu/m32c.opc
378         $(MAKE) run-cgen arch=m32c prefix=m32c options= \
379                 archfile=$(srcdir)/../cpu/m32c.cpu \
380                 opcfile=$(srcdir)/../cpu/m32c.opc extrafiles=
381
382 $(srcdir)/m32r-desc.h $(srcdir)/m32r-desc.c $(srcdir)/m32r-opc.h $(srcdir)/m32r-opc.c $(srcdir)/m32r-ibld.c $(srcdir)/m32r-opinst.c $(srcdir)/m32r-asm.c $(srcdir)/m32r-dis.c: $(M32R_DEPS)
383         @true
384 stamp-m32r: $(CGENDEPS) $(srcdir)/../cpu/m32r.cpu $(srcdir)/../cpu/m32r.opc
385         $(MAKE) run-cgen arch=m32r prefix=m32r options=opinst \
386                 archfile=$(srcdir)/../cpu/m32r.cpu \
387                 opcfile=$(srcdir)/../cpu/m32r.opc extrafiles=opinst
388
389 $(srcdir)/fr30-desc.h $(srcdir)/fr30-desc.c $(srcdir)/fr30-opc.h $(srcdir)/fr30-opc.c $(srcdir)/fr30-ibld.c $(srcdir)/fr30-asm.c $(srcdir)/fr30-dis.c: $(FR30_DEPS)
390         @true
391 stamp-fr30: $(CGENDEPS) $(CPUDIR)/fr30.cpu $(CPUDIR)/fr30.opc
392         $(MAKE) run-cgen arch=fr30 prefix=fr30 options= \
393                 archfile=$(CPUDIR)/fr30.cpu opcfile=$(CPUDIR)/fr30.opc extrafiles=
394
395 $(srcdir)/frv-desc.h $(srcdir)/frv-desc.c $(srcdir)/frv-opc.h $(srcdir)/frv-opc.c $(srcdir)/frv-ibld.c $(srcdir)/frv-asm.c $(srcdir)/frv-dis.c: $(FRV_DEPS)
396         @true
397 stamp-frv: $(CGENDEPS) $(srcdir)/../cpu/frv.cpu $(srcdir)/../cpu/frv.opc
398         $(MAKE) run-cgen arch=frv prefix=frv options= \
399                 archfile=$(srcdir)/../cpu/frv.cpu opcfile=$(srcdir)/../cpu/frv.opc extrafiles=
400
401 $(srcdir)/mep-desc.h $(srcdir)/mep-desc.c $(srcdir)/mep-opc.h $(srcdir)/mep-opc.c $(srcdir)/mep-ibld.c $(srcdir)/mep-asm.c $(srcdir)/mep-dis.c: $(MEP_DEPS)
402         @true
403 stamp-mep: $(CGENDEPS) $(CPUDIR)/mep.cpu $(CPUDIR)/mep-default.cpu $(CPUDIR)/mep-core.cpu $(CPUDIR)/mep-h1.cpu $(CPUDIR)/mep-ext-cop.cpu $(CPUDIR)/mep-sample-ucidsp.cpu $(CPUDIR)/mep-rhcop.cpu $(CPUDIR)/mep-fmax.cpu $(CPUDIR)/mep.opc
404         $(MAKE) run-cgen arch=mep prefix=mep options= \
405                 archfile=$(CPUDIR)/mep.cpu opcfile=$(CPUDIR)/mep.opc extrafiles=
406
407 $(srcdir)/mt-desc.h $(srcdir)/mt-desc.c $(srcdir)/mt-opc.h $(srcdir)/mt-opc.c $(srcdir)/mt-ibld.c $(srcdir)/mt-asm.c $(srcdir)/mt-dis.c: $(MT_DEPS)
408         @true
409 stamp-mt: $(CGENDEPS) $(srcdir)/../cpu/mt.cpu $(srcdir)/../cpu/mt.opc
410         $(MAKE) run-cgen arch=mt prefix=mt options= \
411                 archfile=$(srcdir)/../cpu/mt.cpu \
412                 opcfile=$(srcdir)/../cpu/mt.opc extrafiles=
413
414 $(srcdir)/openrisc-desc.h $(srcdir)/openrisc-desc.c $(srcdir)/openrisc-opc.h $(srcdir)/openrisc-opc.c $(srcdir)/openrisc-ibld.c $(srcdir)/openrisc-asm.c $(srcdir)/openrisc-dis.c: $(OPENRISC_DEPS)
415         @true
416 stamp-openrisc: $(CGENDEPS) $(CPUDIR)/openrisc.cpu $(CPUDIR)/openrisc.opc
417         $(MAKE) run-cgen arch=openrisc prefix=openrisc options= \
418                 archfile=$(CPUDIR)/openrisc.cpu opcfile=$(CPUDIR)/openrisc.opc extrafiles=
419
420 $(srcdir)/iq2000-desc.h $(srcdir)/iq2000-desc.c $(srcdir)/iq2000-opc.h $(srcdir)/iq2000-opc.c $(srcdir)/iq2000-ibld.c $(srcdir)/iq2000-asm.c $(srcdir)/iq2000-dis.c: $(IQ2000_DEPS)
421         @true
422 stamp-iq2000: $(CGENDEPS) $(srcdir)/../cpu/iq2000.cpu \
423                 $(srcdir)/../cpu/iq2000.opc $(srcdir)/../cpu/iq2000m.cpu \
424                 $(srcdir)/../cpu/iq10.cpu
425         $(MAKE) run-cgen arch=iq2000 prefix=iq2000 options= \
426                 archfile=$(srcdir)/../cpu/iq2000.cpu \
427                 opcfile=$(srcdir)/../cpu/iq2000.opc extrafiles=
428
429 $(srcdir)/xstormy16-desc.h $(srcdir)/xstormy16-desc.c $(srcdir)/xstormy16-opc.h $(srcdir)/xstormy16-opc.c $(srcdir)/xstormy16-ibld.c $(srcdir)/xstormy16-asm.c $(srcdir)/xstormy16-dis.c: $(XSTORMY16_DEPS)
430         @true
431 stamp-xstormy16: $(CGENDEPS) $(CPUDIR)/xstormy16.cpu $(CPUDIR)/xstormy16.opc
432         $(MAKE) run-cgen arch=xstormy16 prefix=xstormy16 options= \
433                 archfile=$(CPUDIR)/xstormy16.cpu opcfile=$(CPUDIR)/xstormy16.opc extrafiles=
434
435 $(srcdir)/xc16x-desc.h $(srcdir)/xc16x-desc.c $(srcdir)/xc16x-opc.h $(srcdir)/xc16x-opc.c $(srcdir)/xc16x-ibld.c $(srcdir)/xc16x-asm.c $(srcdir)/xc16x-dis.c: $(XC16X_DEPS)
436         @true
437 stamp-xc16x: $(CGENDEPS) $(CPUDIR)/xc16x.cpu $(CPUDIR)/xc16x.opc
438         $(MAKE) run-cgen arch=xc16x prefix=xc16x options= \
439                 archfile=$(CPUDIR)/xc16x.cpu opcfile=$(CPUDIR)/xc16x.opc extrafiles=
440
441 i386-gen: i386-gen.o
442         $(LINK) i386-gen.o $(LIBIBERTY)
443
444 $(srcdir)/i386-tbl.h: $(srcdir)/i386-init.h 
445         @echo $@
446
447 $(srcdir)/i386-init.h: @MAINT@ i386-gen i386-opc.tbl i386-reg.tbl
448         ./i386-gen --srcdir $(srcdir)
449
450 ia64-gen: ia64-gen.o
451         $(LINK) ia64-gen.o $(LIBIBERTY)
452
453 # Don't wrap the line below, as @MAINT@ can be expanded to '#'.
454 # Some make versions don't handle line continuations in comments.
455 $(srcdir)/ia64-asmtab.c: @MAINT@ ia64-gen ia64-ic.tbl ia64-raw.tbl ia64-waw.tbl ia64-war.tbl
456         ./ia64-gen --srcdir $(srcdir) > $@
457
458 s390-mkopc: s390-mkopc.c
459         $(CC_FOR_BUILD) -o s390-mkopc $(srcdir)/s390-mkopc.c
460
461 s390-opc.tab: s390-mkopc s390-opc.txt
462         ./s390-mkopc < $(srcdir)/s390-opc.txt > s390-opc.tab
463
464 s390-opc.lo: s390-opc.tab
465
466 sh-dis.lo: sh-dis.c
467 if am__fastdepCC
468         $(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ @archdefs@ $(srcdir)/sh-dis.c
469         mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
470 else
471 if AMDEP
472         source='sh-dis.c' object='$@' libtool=yes @AMDEPBACKSLASH@
473         DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
474 endif
475         $(LTCOMPILE) -c -o $@ @archdefs@ $(srcdir)/sh-dis.c
476 endif