Track file renaming in vex r1904, and get rid of temporary kludges
[ambi/valgrind.git] / Makefile.vex.am
1 # VEX/Makefile is generated from this file at configure-time.
2
3 include $(top_srcdir)/Makefile.all.am
4
5 #----------------------------------------------------------------------------
6 # Headers, etc
7 #----------------------------------------------------------------------------
8
9 EXTRA_DIST = \
10         HACKING.README \
11         LICENSE.README \
12         LICENSE.GPL \
13         quote.txt \
14         newline.txt \
15         auxprogs/genoffsets.c
16
17 pkginclude_HEADERS = \
18         pub/libvex.h \
19         pub/libvex_basictypes.h \
20         pub/libvex_emwarn.h \
21         pub/libvex_guest_offsets.h \
22         pub/libvex_guest_x86.h \
23         pub/libvex_guest_amd64.h \
24         pub/libvex_guest_ppc32.h \
25         pub/libvex_guest_ppc64.h \
26         pub/libvex_guest_arm.h \
27         pub/libvex_ir.h \
28         pub/libvex_trc_values.h
29
30 noinst_HEADERS = \
31         priv/main_globals.h \
32         priv/main_util.h \
33         priv/ir_match.h \
34         priv/ir_opt.h \
35         priv/guest_generic_bb_to_IR.h \
36         priv/guest_generic_x87.h \
37         priv/guest_x86_defs.h \
38         priv/guest_amd64_defs.h \
39         priv/guest_ppc_defs.h \
40         priv/guest_arm_defs.h \
41         priv/host_generic_regs.h \
42         priv/host_generic_simd64.h \
43         priv/host_x86_defs.h \
44         priv/host_amd64_defs.h \
45         priv/host_ppc_defs.h \
46         priv/host_arm_defs.h
47
48 BUILT_SOURCES = pub/libvex_guest_offsets.h
49 CLEANFILES    = pub/libvex_guest_offsets.h
50
51 # This is very uggerly.  Need to sed out both "xyzzyN" and
52 # "xyzzy$N" since gcc on different targets emits the constants
53 # differently -- with a leading $ on x86/amd64 but none on ppc32/64.
54 pub/libvex_guest_offsets.h:
55         rm -f auxprogs/genoffsets.s
56         $(CC) $(LIBVEX_CFLAGS) -O -S -o auxprogs/genoffsets.s \
57                                         auxprogs/genoffsets.c
58         grep xyzzy auxprogs/genoffsets.s | grep define \
59            | sed "s/xyzzy\\$$//g" | sed "s/xyzzy//g" \
60            > pub/libvex_guest_offsets.h
61         rm -f auxprogs/genoffsets.s
62
63 #----------------------------------------------------------------------------
64 # vex_svnversion.h
65 #----------------------------------------------------------------------------
66
67 # The contents of vex_svnversion.h depends on the Vex revision number.  The
68 # ideal way to deal with it would be if SVN had post-update hooks: we'd
69 # generate/regenerate it every time we did "svn co"/"svn up", and otherwise
70 # never delete it or regenerate it.
71 #
72 # But SVN lacks post-update hooks.  So instead we generate it when building
73 # (it's in BUILT_SOURCES) if it's not present (we test for that in the
74 # generation rule), or if 'make version' is run.  (Thus it can get
75 # out-of-date when developing;  the 'make version' target lets that be
76 # remedied manually.)  Otherwise, we never delete it or regenerate it (in
77 # particular, it is not present in CLEANFILES).  Furthermore, at 'make dist'
78 # time, we regenerate it, and copy it into the dist tarball, thus ensuring
79 # the distributed version is up-to-date.  Note that if a user manually
80 # deletes it and rebuilds, or does 'make dist' from a distributed version,
81 # it will be regenerated incorrectly, containing the string "exported"
82 # instead of the SVN revision number.
83
84 BUILT_SOURCES += priv/main/vex_svnversion.h
85
86 # Generate it at build time if not present.  Nb: generating a file and
87 # putting it in $(srcdir) rather than $(builddir) seems like bad form.  But
88 # because this file won't be regenerated post-distribution, then it's more
89 # like a non-generated file and so is reasonable to put in $(srcdir).
90 priv/main/vex_svnversion.h: version
91         if [ ! -f priv/main/vex_svnversion.h ] ; then \
92             mv $(top_srcdir)/vex_svnversion.h $(srcdir)/priv/main/; \
93         else \
94             rm -f $(top_srcdir)/vex_svnversion.h; \
95         fi
96
97 # Regenerate it and copy it into the dist tarball at 'make dist' time.
98 dist-hook: version
99         mv $(top_srcdir)/vex_svnversion.h $(distdir)/priv/main/
100
101 # Generate it.
102 version:
103         cat quote.txt    > $(top_srcdir)/vex_svnversion.h
104         svnversion -n . >> $(top_srcdir)/vex_svnversion.h
105         cat quote.txt   >> $(top_srcdir)/vex_svnversion.h
106         cat newline.txt >> $(top_srcdir)/vex_svnversion.h
107
108 #----------------------------------------------------------------------------
109 # libvex-<platform>.a
110 #----------------------------------------------------------------------------
111
112 pkglib_LIBRARIES  = libvex-@VGCONF_ARCH_PRI@-@VGCONF_OS@.a
113 if VGCONF_HAVE_PLATFORM_SEC
114 pkglib_LIBRARIES += libvex-@VGCONF_ARCH_SEC@-@VGCONF_OS@.a
115 endif
116
117 LIBVEX_SOURCES_COMMON = \
118         priv/main_globals.c \
119         priv/main_main.c \
120         priv/main_util.c \
121         priv/ir_defs.c \
122         priv/ir_match.c \
123         priv/ir_opt.c \
124         priv/guest_generic_bb_to_IR.c \
125         priv/guest_generic_x87.c \
126         priv/guest_x86_helpers.c \
127         priv/guest_x86_toIR.c \
128         priv/guest_amd64_helpers.c \
129         priv/guest_amd64_toIR.c \
130         priv/guest_ppc_helpers.c \
131         priv/guest_ppc_toIR.c \
132         priv/guest_arm_helpers.c \
133         priv/guest_arm_toIR.c \
134         priv/host_generic_regs.c \
135         priv/host_generic_simd64.c \
136         priv/host_generic_reg_alloc2.c \
137         priv/host_x86_defs.c \
138         priv/host_x86_isel.c \
139         priv/host_amd64_defs.c \
140         priv/host_amd64_isel.c \
141         priv/host_ppc_defs.c \
142         priv/host_ppc_isel.c \
143         priv/host_arm_defs.c \
144         priv/host_arm_isel.c
145
146 LIBVEX_CFLAGS = \
147         -Wbad-function-cast \
148         -Wcast-qual \
149         -Wcast-align \
150         -fstrict-aliasing
151
152 libvex_@VGCONF_ARCH_PRI@_@VGCONF_OS@_a_SOURCES  = $(LIBVEX_SOURCES_COMMON)
153 libvex_@VGCONF_ARCH_PRI@_@VGCONF_OS@_a_CPPFLAGS = \
154         $(AM_CPPFLAGS_@VGCONF_PLATFORM_PRI_CAPS@) -Ipriv
155 libvex_@VGCONF_ARCH_PRI@_@VGCONF_OS@_a_CFLAGS   = \
156         $(AM_CFLAGS_@VGCONF_PLATFORM_PRI_CAPS@) $(LIBVEX_CFLAGS)
157 if VGCONF_HAVE_PLATFORM_SEC
158 libvex_@VGCONF_ARCH_SEC@_@VGCONF_OS@_a_SOURCES  = $(LIBVEX_SOURCES_COMMON)
159 libvex_@VGCONF_ARCH_SEC@_@VGCONF_OS@_a_CPPFLAGS = \
160         $(AM_CPPFLAGS_@VGCONF_PLATFORM_SEC_CAPS@) -Ipriv
161 libvex_@VGCONF_ARCH_SEC@_@VGCONF_OS@_a_CFLAGS   = \
162         $(AM_CFLAGS_@VGCONF_PLATFORM_SEC_CAPS@) $(LIBVEX_CFLAGS)
163 endif
164