1 2# This file should be included (directly or indirectly) by every 3# Makefile.am that builds programs. And also the top-level Makefile.am. 4 5#---------------------------------------------------------------------------- 6# Global stuff 7#---------------------------------------------------------------------------- 8 9inplacedir = $(top_builddir)/.in_place 10 11# This used to be required when Vex had a handwritten Makefile. It 12# shouldn't be needed any more, though. 13##.NOTPARALLEL: 14 15#---------------------------------------------------------------------------- 16# noinst_PROGRAMS and noinst_DSYMS targets 17#---------------------------------------------------------------------------- 18 19# On Darwin, for a program 'p', the DWARF debug info is stored in the 20# directory 'p.dSYM'. This must be generated after the executable is 21# created, with 'dsymutil p'. We could redefine LINK with a script that 22# executes 'dsymutil' after linking, but that's a pain. Instead we use this 23# hook so that every time "make check" is run, we subsequently invoke 24# 'dsymutil' on all the executables that lack a .dSYM directory, or that are 25# newer than their corresponding .dSYM directory. 26build-noinst_DSYMS: $(noinst_DSYMS) 27 for f in $(noinst_DSYMS); do \ 28 if [ ! -e $$f.dSYM -o $$f -nt $$f.dSYM ] ; then \ 29 echo "dsymutil $$f"; \ 30 dsymutil $$f; \ 31 fi; \ 32 done 33 34# This is used by coregrind/Makefile.am and Makefile.tool.am for doing 35# "in-place" installs. It copies $(noinst_PROGRAMS) into $inplacedir. 36# It needs to be depended on by an 'all-local' rule. 37inplace-noinst_PROGRAMS: $(noinst_PROGRAMS) 38 mkdir -p $(inplacedir); \ 39 for f in $(noinst_PROGRAMS) ; do \ 40 rm -f $(inplacedir)/$$f; \ 41 ln -f -s ../$(subdir)/$$f $(inplacedir); \ 42 done 43 44# Similar to inplace-noinst_PROGRAMS 45inplace-noinst_DSYMS: build-noinst_DSYMS 46 mkdir -p $(inplacedir); \ 47 for f in $(noinst_DSYMS); do \ 48 rm -f $(inplacedir)/$$f.dSYM; \ 49 ln -f -s ../$(subdir)/$$f.dSYM $(inplacedir); \ 50 done 51 52# This is used by coregrind/Makefile.am and by <tool>/Makefile.am for doing 53# "make install". It copies $(noinst_PROGRAMS) into $prefix/lib/valgrind/. 54# It needs to be depended on by an 'install-exec-local' rule. 55install-noinst_PROGRAMS: $(noinst_PROGRAMS) 56 $(mkinstalldirs) $(DESTDIR)$(pkglibdir); \ 57 for f in $(noinst_PROGRAMS); do \ 58 $(INSTALL_PROGRAM) $$f $(DESTDIR)$(pkglibdir); \ 59 done 60 61# This is used by coregrind/Makefile.am and by <tool>/Makefile.am for doing 62# "make uninstall". It removes $(noinst_PROGRAMS) from $prefix/lib/valgrind/. 63# It needs to be depended on by an 'uninstall-local' rule. 64uninstall-noinst_PROGRAMS: 65 for f in $(noinst_PROGRAMS); do \ 66 rm -f $(DESTDIR)$(pkglibdir)/$$f; \ 67 done 68 69# Similar to install-noinst_PROGRAMS. 70# Nb: we don't use $(INSTALL_PROGRAM) here because it doesn't work with 71# directories. XXX: not sure whether the resulting permissions will be 72# correct when using 'cp -R'... 73install-noinst_DSYMS: build-noinst_DSYMS 74 $(mkinstalldirs) $(DESTDIR)$(pkglibdir); \ 75 for f in $(noinst_DSYMS); do \ 76 cp -R $$f.dSYM $(DESTDIR)$(pkglibdir); \ 77 done 78 79# Similar to uninstall-noinst_PROGRAMS. 80uninstall-noinst_DSYMS: 81 for f in $(noinst_DSYMS); do \ 82 rm -f $(DESTDIR)$(pkglibdir)/$$f.dSYM; \ 83 done 84 85# This needs to be depended on by a 'clean-local' rule. 86clean-noinst_DSYMS: 87 for f in $(noinst_DSYMS); do \ 88 rm -rf $$f.dSYM; \ 89 done 90 91#---------------------------------------------------------------------------- 92# Flags 93#---------------------------------------------------------------------------- 94 95# Baseline flags for all compilations. Aim here is to maximise 96# performance and get whatever useful warnings we can out of gcc. 97# -fno-builtin is important for defeating LLVM's idiom recognition 98# that somehow causes VG_(memset) to get into infinite recursion. 99AM_CFLAGS_BASE = \ 100 -O2 -g \ 101 -Wall \ 102 -Wmissing-prototypes \ 103 -Wshadow \ 104 -Wpointer-arith \ 105 -Wstrict-prototypes \ 106 -Wmissing-declarations \ 107 @FLAG_W_NO_FORMAT_ZERO_LENGTH@ \ 108 -fno-strict-aliasing \ 109 -fno-builtin 110 111# These flags are used for building the preload shared objects. 112# The aim is to give reasonable performance but also to have good 113# stack traces, since users often see stack traces extending 114# into (and through) the preloads. 115if VGCONF_OS_IS_DARWIN 116AM_CFLAGS_PIC = -dynamic -O -g -fno-omit-frame-pointer -fno-strict-aliasing \ 117 -mno-dynamic-no-pic -fpic -fPIC \ 118 -fno-builtin 119else 120AM_CFLAGS_PIC = -fpic -O -g -fno-omit-frame-pointer -fno-strict-aliasing \ 121 -fno-builtin 122endif 123 124 125# Flags for specific targets. 126# 127# Nb: the AM_CPPFLAGS_* values are suitable for building tools and auxprogs. 128# For building the core, coregrind/Makefile.am files add some extra things. 129 130AM_CPPFLAGS_@VGCONF_PLATFORM_PRI_CAPS@ = \ 131 -I$(top_srcdir) \ 132 -I$(top_srcdir)/include \ 133 -I$(top_srcdir)/VEX/pub \ 134 -I$(top_builddir)/VEX/pub \ 135 -DVGA_@VGCONF_ARCH_PRI@=1 \ 136 -DVGO_@VGCONF_OS@=1 \ 137 -DVGP_@VGCONF_ARCH_PRI@_@VGCONF_OS@=1 \ 138 -DVGPV_@VGCONF_ARCH_PRI@_@VGCONF_OS@_@VGCONF_PLATVARIANT@=1 139if VGCONF_HAVE_PLATFORM_SEC 140AM_CPPFLAGS_@VGCONF_PLATFORM_SEC_CAPS@ = \ 141 -I$(top_srcdir) \ 142 -I$(top_srcdir)/include \ 143 -I$(top_srcdir)/VEX/pub \ 144 -I$(top_builddir)/VEX/pub \ 145 -DVGA_@VGCONF_ARCH_SEC@=1 \ 146 -DVGO_@VGCONF_OS@=1 \ 147 -DVGP_@VGCONF_ARCH_SEC@_@VGCONF_OS@=1 \ 148 -DVGPV_@VGCONF_ARCH_SEC@_@VGCONF_OS@_@VGCONF_PLATVARIANT@=1 149endif 150 151AM_FLAG_M3264_X86_LINUX = @FLAG_M32@ 152AM_CFLAGS_X86_LINUX = @FLAG_M32@ @PREFERRED_STACK_BOUNDARY@ \ 153 $(AM_CFLAGS_BASE) -fomit-frame-pointer 154AM_CCASFLAGS_X86_LINUX = @FLAG_M32@ -g 155 156AM_FLAG_M3264_AMD64_LINUX = @FLAG_M64@ 157AM_CFLAGS_AMD64_LINUX = @FLAG_M64@ @PREFERRED_STACK_BOUNDARY@ \ 158 $(AM_CFLAGS_BASE) -fomit-frame-pointer 159AM_CCASFLAGS_AMD64_LINUX = @FLAG_M64@ -g 160 161AM_FLAG_M3264_PPC32_LINUX = @FLAG_M32@ 162AM_CFLAGS_PPC32_LINUX = @FLAG_M32@ $(AM_CFLAGS_BASE) 163AM_CCASFLAGS_PPC32_LINUX = @FLAG_M32@ -g 164 165AM_FLAG_M3264_PPC64_LINUX = @FLAG_M64@ 166AM_CFLAGS_PPC64_LINUX = @FLAG_M64@ $(AM_CFLAGS_BASE) 167AM_CCASFLAGS_PPC64_LINUX = @FLAG_M64@ -g 168 169AM_FLAG_M3264_ARM_LINUX = @FLAG_M32@ 170AM_CFLAGS_ARM_LINUX = @FLAG_M32@ @PREFERRED_STACK_BOUNDARY@ \ 171 $(AM_CFLAGS_BASE) -marm -mcpu=cortex-a8 172AM_CCASFLAGS_ARM_LINUX = @FLAG_M32@ \ 173 -marm -mcpu=cortex-a8 -g 174 175AM_FLAG_M3264_ARM64_LINUX = @FLAG_M64@ 176AM_CFLAGS_ARM64_LINUX = @FLAG_M64@ $(AM_CFLAGS_BASE) 177AM_CCASFLAGS_ARM64_LINUX = @FLAG_M64@ -g 178 179AM_FLAG_M3264_X86_DARWIN = -arch i386 180AM_CFLAGS_X86_DARWIN = $(WERROR) -arch i386 $(AM_CFLAGS_BASE) \ 181 -mmacosx-version-min=10.5 \ 182 -fno-stack-protector -fno-pic -fno-PIC 183 184AM_CCASFLAGS_X86_DARWIN = -arch i386 -g 185 186AM_FLAG_M3264_AMD64_DARWIN = -arch x86_64 187AM_CFLAGS_AMD64_DARWIN = $(WERROR) -arch x86_64 $(AM_CFLAGS_BASE) \ 188 -mmacosx-version-min=10.5 -fno-stack-protector 189AM_CCASFLAGS_AMD64_DARWIN = -arch x86_64 -g 190 191AM_FLAG_M3264_S390X_LINUX = @FLAG_M64@ 192AM_CFLAGS_S390X_LINUX = @FLAG_M64@ $(AM_CFLAGS_BASE) -fomit-frame-pointer 193AM_CCASFLAGS_S390X_LINUX = @FLAG_M64@ -g -mzarch -march=z900 194 195AM_FLAG_M3264_MIPS32_LINUX = @FLAG_M32@ 196AM_CFLAGS_MIPS32_LINUX = @FLAG_M32@ $(AM_CFLAGS_BASE) @FLAG_MIPS32@ 197AM_CCASFLAGS_MIPS32_LINUX = @FLAG_M32@ -g @FLAG_MIPS32@ 198 199AM_FLAG_M3264_MIPS64_LINUX = @FLAG_M64@ 200AM_CFLAGS_MIPS64_LINUX = @FLAG_M64@ $(AM_CFLAGS_BASE) @FLAG_MIPS64@ 201AM_CCASFLAGS_MIPS64_LINUX = @FLAG_M64@ -g @FLAG_MIPS64@ 202 203# Flags for the primary target. These must be used to build the 204# regtests and performance tests. In fact, these must be used to 205# build anything which is built only once on a dual-arch build. 206# 207AM_FLAG_M3264_PRI = $(AM_FLAG_M3264_@VGCONF_PLATFORM_PRI_CAPS@) 208AM_CPPFLAGS_PRI = $(AM_CPPFLAGS_@VGCONF_PLATFORM_PRI_CAPS@) 209AM_CFLAGS_PRI = $(AM_CFLAGS_@VGCONF_PLATFORM_PRI_CAPS@) 210AM_CCASFLAGS_PRI = $(AM_CCASFLAGS_@VGCONF_PLATFORM_PRI_CAPS@) 211 212if VGCONF_HAVE_PLATFORM_SEC 213 AM_FLAG_M3264_SEC = $(AM_FLAG_M3264_@VGCONF_PLATFORM_SEC_CAPS@) 214else 215 AM_FLAG_M3264_SEC = 216endif 217 218 219# Baseline link flags for making vgpreload shared objects. 220# 221PRELOAD_LDFLAGS_COMMON_LINUX = -nodefaultlibs -shared -Wl,-z,interpose,-z,initfirst 222PRELOAD_LDFLAGS_COMMON_DARWIN = -dynamic -dynamiclib -all_load 223 224if VGCONF_PLATVARIANT_IS_ANDROID 225# The Android toolchain includes all kinds of stdlib helpers present in 226# bionic which is bad because we are not linking with it and the Android 227# linker will panic. 228PRELOAD_LDFLAGS_COMMON_LINUX += -nostdlib 229endif 230 231PRELOAD_LDFLAGS_X86_LINUX = $(PRELOAD_LDFLAGS_COMMON_LINUX) @FLAG_M32@ 232PRELOAD_LDFLAGS_AMD64_LINUX = $(PRELOAD_LDFLAGS_COMMON_LINUX) @FLAG_M64@ 233PRELOAD_LDFLAGS_PPC32_LINUX = $(PRELOAD_LDFLAGS_COMMON_LINUX) @FLAG_M32@ 234PRELOAD_LDFLAGS_PPC64_LINUX = $(PRELOAD_LDFLAGS_COMMON_LINUX) @FLAG_M64@ 235PRELOAD_LDFLAGS_ARM_LINUX = $(PRELOAD_LDFLAGS_COMMON_LINUX) @FLAG_M32@ 236PRELOAD_LDFLAGS_ARM64_LINUX = $(PRELOAD_LDFLAGS_COMMON_LINUX) @FLAG_M64@ 237PRELOAD_LDFLAGS_X86_DARWIN = $(PRELOAD_LDFLAGS_COMMON_DARWIN) -arch i386 238PRELOAD_LDFLAGS_AMD64_DARWIN = $(PRELOAD_LDFLAGS_COMMON_DARWIN) -arch x86_64 239PRELOAD_LDFLAGS_S390X_LINUX = $(PRELOAD_LDFLAGS_COMMON_LINUX) @FLAG_M64@ 240PRELOAD_LDFLAGS_MIPS32_LINUX = $(PRELOAD_LDFLAGS_COMMON_LINUX) @FLAG_M32@ 241PRELOAD_LDFLAGS_MIPS64_LINUX = $(PRELOAD_LDFLAGS_COMMON_LINUX) @FLAG_M64@ 242 243