
SUBDIRS = . tests docs

include $(top_srcdir)/Makefile.all.am
include $(top_srcdir)/Makefile.flags.am
include $(top_srcdir)/Makefile.core-tool.am


LIBREPLACEMALLOC_X86_LINUX = \
	$(top_builddir)/coregrind/libreplacemalloc_toolpreload-x86-linux.a

LIBREPLACEMALLOC_AMD64_LINUX = \
	$(top_builddir)/coregrind/libreplacemalloc_toolpreload-amd64-linux.a

LIBREPLACEMALLOC_PPC32_LINUX = \
	$(top_builddir)/coregrind/libreplacemalloc_toolpreload-ppc32-linux.a

LIBREPLACEMALLOC_PPC64_LINUX = \
	$(top_builddir)/coregrind/libreplacemalloc_toolpreload-ppc64-linux.a

LIBREPLACEMALLOC_PPC32_AIX5 = \
	$(top_builddir)/coregrind/libreplacemalloc_toolpreload-ppc32-aix5.a

LIBREPLACEMALLOC_PPC64_AIX5 = \
	$(top_builddir)/coregrind/libreplacemalloc_toolpreload-ppc64-aix5.a


COREGRIND_LIBS_X86_LINUX = \
	$(top_builddir)/coregrind/libcoregrind-x86-linux.a \
	@VEX_DIR@/libvex-x86-linux.a

COREGRIND_LIBS_AMD64_LINUX = \
	$(top_builddir)/coregrind/libcoregrind-amd64-linux.a \
	@VEX_DIR@/libvex-amd64-linux.a

COREGRIND_LIBS_PPC32_LINUX = \
	$(top_builddir)/coregrind/libcoregrind-ppc32-linux.a \
	@VEX_DIR@/libvex-ppc32-linux.a

COREGRIND_LIBS_PPC64_LINUX = \
	$(top_builddir)/coregrind/libcoregrind-ppc64-linux.a \
	@VEX_DIR@/libvex-ppc64-linux.a

COREGRIND_LIBS_PPC32_AIX5 = \
	$(top_builddir)/coregrind/libcoregrind-ppc32-aix5.a \
	@VEX_DIR@/libvex-ppc32-aix5.a

COREGRIND_LIBS_PPC64_AIX5 = \
	$(top_builddir)/coregrind/libcoregrind-ppc64-aix5.a \
	@VEX_DIR@/libvex-ppc64-aix5.a


##.PHONY:  @VEX_DIR@/libvex.a

@VEX_DIR@/libvex-x86-linux.a: @VEX_DIR@/priv/main/vex_svnversion.h
	$(MAKE) -C @VEX_DIR@ CC="$(CC)" AR="$(AR)" \
	libvex-x86-linux.a \
	EXTRA_CFLAGS="$(AM_CFLAGS_X86_LINUX) @FLAG_WDECL_AFTER_STMT@ \
			@FLAG_FNO_STACK_PROTECTOR@"

@VEX_DIR@/libvex-amd64-linux.a: @VEX_DIR@/priv/main/vex_svnversion.h
	$(MAKE) -C @VEX_DIR@ CC="$(CC)" AR="$(AR)" \
	libvex-amd64-linux.a \
	EXTRA_CFLAGS="$(AM_CFLAGS_AMD64_LINUX) @FLAG_WDECL_AFTER_STMT@ \
			@FLAG_FNO_STACK_PROTECTOR@"

@VEX_DIR@/libvex-ppc32-linux.a: @VEX_DIR@/priv/main/vex_svnversion.h
	$(MAKE) -C @VEX_DIR@ CC="$(CC)" AR="$(AR)" \
	libvex-ppc32-linux.a \
	EXTRA_CFLAGS="$(AM_CFLAGS_PPC32_LINUX) @FLAG_WDECL_AFTER_STMT@ \
			@FLAG_FNO_STACK_PROTECTOR@"

@VEX_DIR@/libvex-ppc64-linux.a: @VEX_DIR@/priv/main/vex_svnversion.h
	$(MAKE) -C @VEX_DIR@ CC="$(CC)" AR="$(AR)" \
	libvex-ppc64-linux.a \
	EXTRA_CFLAGS="$(AM_CFLAGS_PPC64_LINUX) @FLAG_WDECL_AFTER_STMT@ \
			@FLAG_FNO_STACK_PROTECTOR@"

@VEX_DIR@/libvex-ppc32-aix5.a: @VEX_DIR@/priv/main/vex_svnversion.h
	$(MAKE) -C @VEX_DIR@ CC="$(CC)" AR="$(AR) -X32" \
	libvex-ppc32-aix5.a \
	EXTRA_CFLAGS="$(AM_CFLAGS_PPC32_AIX5) @FLAG_WDECL_AFTER_STMT@ \
			@FLAG_FNO_STACK_PROTECTOR@"

@VEX_DIR@/libvex-ppc64-aix5.a: @VEX_DIR@/priv/main/vex_svnversion.h
	$(MAKE) -C @VEX_DIR@ CC="$(CC)" AR="$(AR) -X64" \
	libvex-ppc64-aix5.a \
	EXTRA_CFLAGS="$(AM_CFLAGS_PPC64_AIX5) @FLAG_WDECL_AFTER_STMT@ \
			@FLAG_FNO_STACK_PROTECTOR@"

@VEX_DIR@/priv/main/vex_svnversion.h:
	$(MAKE) -C @VEX_DIR@ CC="$(CC)" version


TOOL_LDADD_COMMON = -lgcc
TOOL_LDFLAGS_COMMON_LINUX = -static \
	-Wl,-defsym,valt_load_address=@VALT_LOAD_ADDRESS@ \
	-nodefaultlibs -nostartfiles -u _start
TOOL_LDFLAGS_COMMON_AIX5 = -static -Wl,-e_start_valgrind


TOOL_LDADD_X86_LINUX = $(COREGRIND_LIBS_X86_LINUX) $(TOOL_LDADD_COMMON)
TOOL_LDFLAGS_X86_LINUX = \
	$(TOOL_LDFLAGS_COMMON_LINUX) @FLAG_M32@ \
	-Wl,-T,$(top_builddir)/valt_load_address_x86_linux.lds

TOOL_LDADD_AMD64_LINUX = $(COREGRIND_LIBS_AMD64_LINUX) $(TOOL_LDADD_COMMON)
TOOL_LDFLAGS_AMD64_LINUX = \
	$(TOOL_LDFLAGS_COMMON_LINUX) @FLAG_M64@ \
	-Wl,-T,$(top_builddir)/valt_load_address_amd64_linux.lds

TOOL_LDADD_PPC32_LINUX = $(COREGRIND_LIBS_PPC32_LINUX) $(TOOL_LDADD_COMMON)
TOOL_LDFLAGS_PPC32_LINUX = \
	$(TOOL_LDFLAGS_COMMON_LINUX) @FLAG_M32@ \
	-Wl,-T,$(top_builddir)/valt_load_address_ppc32_linux.lds

TOOL_LDADD_PPC64_LINUX = $(COREGRIND_LIBS_PPC64_LINUX) $(TOOL_LDADD_COMMON)
TOOL_LDFLAGS_PPC64_LINUX = \
	$(TOOL_LDFLAGS_COMMON_LINUX) @FLAG_M64@ \
	-Wl,-T,$(top_builddir)/valt_load_address_ppc64_linux.lds

TOOL_LDADD_PPC32_AIX5 = $(COREGRIND_LIBS_PPC32_AIX5) $(TOOL_LDADD_COMMON)
TOOL_LDFLAGS_PPC32_AIX5 = \
	$(TOOL_LDFLAGS_COMMON_AIX5) @FLAG_MAIX32@

TOOL_LDADD_PPC64_AIX5 = $(COREGRIND_LIBS_PPC64_AIX5) $(TOOL_LDADD_COMMON)
TOOL_LDFLAGS_PPC64_AIX5 = \
	$(TOOL_LDFLAGS_COMMON_AIX5) @FLAG_MAIX64@ -Wl,-bbigtoc

LIBREPLACEMALLOC_LDFLAGS_X86_LINUX = \
	-Wl,--whole-archive \
	$(LIBREPLACEMALLOC_X86_LINUX) \
	-Wl,--no-whole-archive

LIBREPLACEMALLOC_LDFLAGS_AMD64_LINUX = \
	-Wl,--whole-archive \
	$(LIBREPLACEMALLOC_AMD64_LINUX) \
	-Wl,--no-whole-archive

LIBREPLACEMALLOC_LDFLAGS_PPC32_LINUX = \
	-Wl,--whole-archive \
	$(LIBREPLACEMALLOC_PPC32_LINUX) \
	-Wl,--no-whole-archive

LIBREPLACEMALLOC_LDFLAGS_PPC64_LINUX = \
	-Wl,--whole-archive \
	$(LIBREPLACEMALLOC_PPC64_LINUX) \
	-Wl,--no-whole-archive

LIBREPLACEMALLOC_LDFLAGS_PPC32_AIX5 = \
	$(LIBREPLACEMALLOC_PPC32_AIX5)

LIBREPLACEMALLOC_LDFLAGS_PPC64_AIX5 = \
	$(LIBREPLACEMALLOC_PPC64_AIX5)


all-local: inplace-noinst_PROGRAMS

install-exec-local: install-noinst_PROGRAMS

