Makefile stuff, partly from Tom, which uses the SVN-externall'd VEX
tree a bit better.  Also, fixes to make 'make dist' include into the
final tarball a minimal but workable subset of the stuff in the VEX
directory.

Note, you must do 'make' or 'make install' before 'make dist' since
otherwise VEX/priv/main/vex_svnversion.h will not exist.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@4266 a5019735-40e9-0310-863c-91ae7b9d1cf9
diff --git a/coregrind/Makefile.am b/coregrind/Makefile.am
index 978e8bb..a84be3d 100644
--- a/coregrind/Makefile.am
+++ b/coregrind/Makefile.am
@@ -82,7 +82,7 @@
 
 BUILT_SOURCES = stage2.lds
 CLEANFILES = stage2.lds
-	
+
 valgrind_SOURCES = \
 	stage1.c \
 	m_debuglog.c \
@@ -195,6 +195,15 @@
 		-e '/\. = 0x[0-9A-Fa-f]\+ + SIZEOF_HEADERS/s/0x[0-9A-Fa-f]\+/kickstart_base/g' > $@ \
 	|| rm -f $@
 
+@VEX_DIR@/libvex.a: @VEX_DIR@/priv/main/vex_svnversion.h
+	$(MAKE) -C @VEX_DIR@ libvex.a EXTRA_CFLAGS="@PIE_AM_CFLAGS@"
+
+@VEX_DIR@/priv/main/vex_svnversion.h:
+	$(MAKE) -C @VEX_DIR@ version
+
+clean-local:
+	$(MAKE) -C @VEX_DIR@ clean
+
 MANUAL_DEPS = $(noinst_HEADERS) $(include_HEADERS)
 
 all-local: