mirror of
https://github.com/Zenithsiz/ftmemsim-valgrind.git
synced 2026-02-03 18:13:01 +00:00
following improvements: - Arch/OS/platform-specific files are now included/excluded via the preprocessor, rather than via the build system. This is more consistent (we use the pre-processor for small arch/OS/platform-specific chunks within files) and makes the build system much simpler, as the sources for all programs are the same on all platforms. - Vast amounts of cut+paste Makefile.am code has been factored out. If a new platform is implemented, you need to add 11 extra Makefile.am lines. Previously it was over 100 lines. - Vex has been autotoolised. Dependency checking now works in Vex (no more incomplete builds). Parallel builds now also work. --with-vex no longer works; it's little use and a pain to support. VEX/Makefile is still in the Vex repository and gets overwritten at configure-time; it should probably be renamed Makefile-gcc to avoid possible problems, such as accidentally committing a generated Makefile. There's a bunch of hacky copying to deal with the fact that autotools don't handle same-named files in different directories. Julian plans to rename the files to avoid this problem. - Various small Makefile.am things have been made more standard automake style, eg. the use of pkginclude/pkglib prefixes instead of rolling our own. - The existing five top-level Makefile.am include files have been consolidated into three. - Most Makefile.am files now are structured more clearly, with comment headers separating sections, declarations relating to the same things next to each other, better spacing and layout, etc. - Removed the unused exp-ptrcheck/tests/x86 directory. - Renamed some XML files. - Factored out some duplicated dSYM handling code. - Split auxprogs/ into auxprogs/ and mpi/, which allowed the resulting Makefile.am files to be much more standard. - Cleaned up m_coredump by merging a bunch of files that had been overzealously separated. The net result is 630 fewer lines of Makefile.am code, or 897 if you exclude the added Makefile.vex.am, or 997 once the hacky file copying for Vex is removed. And the build system is much simpler. git-svn-id: svn://svn.valgrind.org/valgrind/trunk@10364
223 lines
7.6 KiB
Makefile
223 lines
7.6 KiB
Makefile
|
|
SUBDIRS = . tests docs
|
|
|
|
include $(top_srcdir)/Makefile.all.am
|
|
|
|
#----------------------------------------------------------------------------
|
|
# <tool>-<platform> stuff
|
|
#----------------------------------------------------------------------------
|
|
|
|
TOOL_DEPENDENCIES_@VGCONF_PLATFORM_PRI_CAPS@ = \
|
|
$(top_builddir)/coregrind/libcoregrind-@VGCONF_ARCH_PRI@-@VGCONF_OS@.a \
|
|
$(top_builddir)/VEX/libvex-@VGCONF_ARCH_PRI@-@VGCONF_OS@.a
|
|
if VGCONF_HAVE_PLATFORM_SEC
|
|
TOOL_DEPENDENCIES_@VGCONF_PLATFORM_SEC_CAPS@ = \
|
|
$(top_builddir)/coregrind/libcoregrind-@VGCONF_ARCH_SEC@-@VGCONF_OS@.a \
|
|
$(top_builddir)/VEX/libvex-@VGCONF_ARCH_SEC@-@VGCONF_OS@.a
|
|
endif
|
|
|
|
|
|
TOOL_LDADD_COMMON = -lgcc
|
|
TOOL_LDADD_@VGCONF_PLATFORM_PRI_CAPS@ = \
|
|
$(TOOL_DEPENDENCIES_@VGCONF_PLATFORM_PRI_CAPS@) $(TOOL_LDADD_COMMON)
|
|
if VGCONF_HAVE_PLATFORM_SEC
|
|
TOOL_LDADD_@VGCONF_PLATFORM_SEC_CAPS@ = \
|
|
$(TOOL_DEPENDENCIES_@VGCONF_PLATFORM_SEC_CAPS@) $(TOOL_LDADD_COMMON)
|
|
endif
|
|
|
|
|
|
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_LDFLAGS_COMMON_DARWIN = -nodefaultlibs -nostartfiles \
|
|
-Wl,-u,__start -Wl,-e,__start -Wl,-bind_at_load /usr/lib/dyld
|
|
|
|
TOOL_LDFLAGS_X86_LINUX = \
|
|
$(TOOL_LDFLAGS_COMMON_LINUX) @FLAG_M32@ \
|
|
-Wl,-T,$(top_builddir)/valt_load_address_x86_linux.lds
|
|
|
|
TOOL_LDFLAGS_AMD64_LINUX = \
|
|
$(TOOL_LDFLAGS_COMMON_LINUX) @FLAG_M64@ \
|
|
-Wl,-T,$(top_builddir)/valt_load_address_amd64_linux.lds
|
|
|
|
TOOL_LDFLAGS_PPC32_LINUX = \
|
|
$(TOOL_LDFLAGS_COMMON_LINUX) @FLAG_M32@ \
|
|
-Wl,-T,$(top_builddir)/valt_load_address_ppc32_linux.lds
|
|
|
|
TOOL_LDFLAGS_PPC64_LINUX = \
|
|
$(TOOL_LDFLAGS_COMMON_LINUX) @FLAG_M64@ \
|
|
-Wl,-T,$(top_builddir)/valt_load_address_ppc64_linux.lds
|
|
|
|
TOOL_LDFLAGS_PPC32_AIX5 = \
|
|
$(TOOL_LDFLAGS_COMMON_AIX5) @FLAG_MAIX32@
|
|
|
|
TOOL_LDFLAGS_PPC64_AIX5 = \
|
|
$(TOOL_LDFLAGS_COMMON_AIX5) @FLAG_MAIX64@ -Wl,-bbigtoc
|
|
|
|
TOOL_LDFLAGS_X86_DARWIN = \
|
|
$(TOOL_LDFLAGS_COMMON_DARWIN) -arch i386 \
|
|
-Wl,-seg1addr,0xf0080000 \
|
|
-Wl,-stack_addr,0xf0080000 -Wl,-stack_size,0x80000 \
|
|
-Wl,-pagezero_size,0xf0000000
|
|
|
|
# pagezero can't be unmapped and remapped. Use stack instead.
|
|
# GrP fixme no stack guard
|
|
TOOL_LDFLAGS_AMD64_DARWIN = \
|
|
$(TOOL_LDFLAGS_COMMON_DARWIN) -arch x86_64 \
|
|
-Wl,-seg1addr,0x7fff55000000 \
|
|
-Wl,-stack_addr,0x7fff50080000 -Wl,-stack_size,0x7ffe50080000 \
|
|
-Wl,-pagezero_size,0x100000000
|
|
|
|
|
|
BUILT_SOURCES =
|
|
CLEANFILES =
|
|
if VGCONF_PLATFORMS_INCLUDE_X86_LINUX
|
|
BUILT_SOURCES += $(top_builddir)/valt_load_address_x86_linux.lds
|
|
CLEANFILES += $(top_builddir)/valt_load_address_x86_linux.lds
|
|
endif
|
|
if VGCONF_PLATFORMS_INCLUDE_AMD64_LINUX
|
|
BUILT_SOURCES += $(top_builddir)/valt_load_address_amd64_linux.lds
|
|
CLEANFILES += $(top_builddir)/valt_load_address_amd64_linux.lds
|
|
endif
|
|
if VGCONF_PLATFORMS_INCLUDE_PPC32_LINUX
|
|
BUILT_SOURCES += $(top_builddir)/valt_load_address_ppc32_linux.lds
|
|
CLEANFILES += $(top_builddir)/valt_load_address_ppc32_linux.lds
|
|
endif
|
|
if VGCONF_PLATFORMS_INCLUDE_PPC64_LINUX
|
|
BUILT_SOURCES += $(top_builddir)/valt_load_address_ppc64_linux.lds
|
|
CLEANFILES += $(top_builddir)/valt_load_address_ppc64_linux.lds
|
|
endif
|
|
if VGCONF_PLATFORMS_INCLUDE_PPC32_AIX5
|
|
# No need to generate $(top_builddir)/valt_load_address*.lds; the final
|
|
# executables can be linked to be at any address. They will be relocated by
|
|
# AIX kernel when they are loaded.
|
|
endif
|
|
if VGCONF_PLATFORMS_INCLUDE_PPC64_AIX5
|
|
# Ditto
|
|
endif
|
|
if VGCONF_OS_IS_DARWIN
|
|
# GrP untested, possibly hopeless
|
|
endif
|
|
|
|
|
|
# Generate a linker script for linking the binaries. This is the
|
|
# standard gcc linker script, except hacked so that an alternative
|
|
# load address can be specified by (1) asking gcc to use this script
|
|
# (-Wl,-T,valt_load_address.lds) and (2) setting the symbol
|
|
# valt_load_address to the required value
|
|
# (-Wl,-defsym,valt_load_address=0x70000000).
|
|
#
|
|
# Extract ld's default linker script and hack it to our needs.
|
|
# First we cut everything above and below the "=====..." lines at the top
|
|
# and bottom.
|
|
# Then we have to replace the load address with "valt_load_address".
|
|
# The line to replace in has one of the following two forms:
|
|
#
|
|
# . = 0x08048000 + SIZEOF_HEADERS;
|
|
#
|
|
# or
|
|
# PROVIDE (__executable_start = 0x08048000); . = 0x08048000 + SIZEOF_HEADERS;
|
|
#
|
|
# So we search for the line with a hex value "+ SIZEOF_HEADERS", and replace
|
|
# all the hex values in that line with "valt_load_address".
|
|
$(top_builddir)/valt_load_address_x86_linux.lds: Makefile
|
|
$(CC) @FLAG_M32@ -Wl,--verbose -nostdlib 2>&1 | sed \
|
|
-e '1,/^=====\+$$/d' \
|
|
-e '/^=====\+$$/,/.\*/d' \
|
|
-e '/\. = \(0x[0-9A-Fa-f]\+\|SEGMENT_START("[^"]\+", 0x[0-9A-Fa-f]\+)\) + SIZEOF_HEADERS/s/0x[0-9A-Fa-f]\+/valt_load_address/g' > $@ \
|
|
|| rm -f $@
|
|
|
|
$(top_builddir)/valt_load_address_amd64_linux.lds: Makefile
|
|
$(CC) -m64 -Wl,--verbose -nostdlib 2>&1 | sed \
|
|
-e '1,/^=====\+$$/d' \
|
|
-e '/^=====\+$$/,/.\*/d' \
|
|
-e '/\. = \(0x[0-9A-Fa-f]\+\|SEGMENT_START("[^"]\+", 0x[0-9A-Fa-f]\+)\) + SIZEOF_HEADERS/s/0x[0-9A-Fa-f]\+/valt_load_address/g' > $@ \
|
|
|| rm -f $@
|
|
|
|
$(top_builddir)/valt_load_address_ppc32_linux.lds: Makefile
|
|
$(CC) @FLAG_M32@ -Wl,--verbose -nostdlib 2>&1 | sed \
|
|
-e '1,/^=====\+$$/d' \
|
|
-e '/^=====\+$$/,/.\*/d' \
|
|
-e '/\. = \(0x[0-9A-Fa-f]\+\|SEGMENT_START("[^"]\+", 0x[0-9A-Fa-f]\+)\) + SIZEOF_HEADERS/s/0x[0-9A-Fa-f]\+/valt_load_address/g' > $@ \
|
|
|| rm -f $@
|
|
|
|
$(top_builddir)/valt_load_address_ppc64_linux.lds: Makefile
|
|
$(CC) -m64 -Wl,--verbose -nostdlib 2>&1 | sed \
|
|
-e '1,/^=====\+$$/d' \
|
|
-e '/^=====\+$$/,/.\*/d' \
|
|
-e '/\. = \(0x[0-9A-Fa-f]\+\|SEGMENT_START("[^"]\+", 0x[0-9A-Fa-f]\+)\) + SIZEOF_HEADERS/s/0x[0-9A-Fa-f]\+/valt_load_address/g' > $@ \
|
|
|| rm -f $@
|
|
|
|
#----------------------------------------------------------------------------
|
|
# vgpreload_<tool>-<platform>.a stuff
|
|
#----------------------------------------------------------------------------
|
|
|
|
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
|
|
|
|
LIBREPLACEMALLOC_X86_DARWIN = \
|
|
$(top_builddir)/coregrind/libreplacemalloc_toolpreload-x86-darwin.a
|
|
|
|
LIBREPLACEMALLOC_AMD64_DARWIN = \
|
|
$(top_builddir)/coregrind/libreplacemalloc_toolpreload-amd64-darwin.a
|
|
|
|
|
|
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)
|
|
|
|
LIBREPLACEMALLOC_LDFLAGS_X86_DARWIN = \
|
|
$(LIBREPLACEMALLOC_X86_DARWIN)
|
|
|
|
LIBREPLACEMALLOC_LDFLAGS_AMD64_DARWIN = \
|
|
$(LIBREPLACEMALLOC_AMD64_DARWIN)
|
|
|
|
#----------------------------------------------------------------------------
|
|
# General stuff
|
|
#----------------------------------------------------------------------------
|
|
|
|
all-local: inplace-noinst_PROGRAMS inplace-noinst_DSYMS
|
|
|
|
clean-local: clean-noinst_DSYMS
|
|
|
|
install-exec-local: install-noinst_PROGRAMS install-noinst_DSYMS
|
|
|