2 # This file should be included (directly or indirectly) by every
3 # Makefile.am that builds programs. And also the top-level Makefile.am.
5 #----------------------------------------------------------------------------
7 #----------------------------------------------------------------------------
9 inplacedir = $(top_builddir)/.in_place
11 # This used to be required when Vex had a handwritten Makefile. It
12 # shouldn't be needed any more, though.
15 #----------------------------------------------------------------------------
16 # noinst_PROGRAMS and noinst_DSYMS targets
17 #----------------------------------------------------------------------------
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.
26 build-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"; \
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.
37 inplace-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); \
44 # Similar to inplace-noinst_PROGRAMS
45 inplace-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); \
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.
55 install-noinst_PROGRAMS: $(noinst_PROGRAMS)
56 $(mkinstalldirs) $(DESTDIR)$(pkglibdir); \
57 for f in $(noinst_PROGRAMS); do \
58 $(INSTALL_PROGRAM) $$f $(DESTDIR)$(pkglibdir); \
61 # Similar to install-noinst_PROGRAMS.
62 # Nb: we don't use $(INSTALL_PROGRAM) here because it doesn't work with
63 # directories. XXX: not sure whether the resulting permissions will be
64 # correct when using 'cp -R'...
65 install-noinst_DSYMS: build-noinst_DSYMS
66 $(mkinstalldirs) $(DESTDIR)$(pkglibdir); \
67 for f in $(noinst_DSYMS); do \
68 cp -R $$f.dSYM $(DESTDIR)$(pkglibdir); \
71 # This needs to be depended on by a 'clean-local' rule.
73 for f in $(noinst_DSYMS); do \
77 #----------------------------------------------------------------------------
79 #----------------------------------------------------------------------------
81 # Baseline flags for all compilations. Aim here is to maximise
82 # performance and get whatever useful warnings we can out of gcc.
83 # -fno-builtin is important for defeating LLVM's idiom recognition
84 # that somehow causes VG_(memset) to get into infinite recursion.
88 -Wmissing-prototypes \
92 -Wmissing-declarations \
93 @FLAG_W_NO_FORMAT_ZERO_LENGTH@ \
94 -fno-strict-aliasing \
97 # These flags are used for building the preload shared objects.
98 # The aim is to give reasonable performance but also to have good
99 # stack traces, since users often see stack traces extending
100 # into (and through) the preloads.
101 if VGCONF_OS_IS_DARWIN
102 AM_CFLAGS_PIC = -dynamic -O -g -fno-omit-frame-pointer -fno-strict-aliasing \
103 -mno-dynamic-no-pic -fpic -fPIC \
106 AM_CFLAGS_PIC = -fpic -O -g -fno-omit-frame-pointer -fno-strict-aliasing \
111 # Flags for specific targets.
113 # Nb: the AM_CPPFLAGS_* values are suitable for building tools and auxprogs.
114 # For building the core, coregrind/Makefile.am files add some extra things.
116 AM_CPPFLAGS_@VGCONF_PLATFORM_PRI_CAPS@ = \
118 -I$(top_srcdir)/include \
119 -I$(top_srcdir)/VEX/pub \
120 -DVGA_@VGCONF_ARCH_PRI@=1 \
121 -DVGO_@VGCONF_OS@=1 \
122 -DVGP_@VGCONF_ARCH_PRI@_@VGCONF_OS@=1 \
123 -DVGPV_@VGCONF_ARCH_PRI@_@VGCONF_OS@_@VGCONF_PLATVARIANT@=1
124 if VGCONF_HAVE_PLATFORM_SEC
125 AM_CPPFLAGS_@VGCONF_PLATFORM_SEC_CAPS@ = \
127 -I$(top_srcdir)/include \
128 -I$(top_srcdir)/VEX/pub \
129 -DVGA_@VGCONF_ARCH_SEC@=1 \
130 -DVGO_@VGCONF_OS@=1 \
131 -DVGP_@VGCONF_ARCH_SEC@_@VGCONF_OS@=1 \
132 -DVGPV_@VGCONF_ARCH_SEC@_@VGCONF_OS@_@VGCONF_PLATVARIANT@=1
135 AM_FLAG_M3264_X86_LINUX = @FLAG_M32@
136 AM_CFLAGS_X86_LINUX = @FLAG_M32@ @PREFERRED_STACK_BOUNDARY@ \
137 $(AM_CFLAGS_BASE) -fomit-frame-pointer
138 AM_CCASFLAGS_X86_LINUX = @FLAG_M32@ -g
140 AM_FLAG_M3264_AMD64_LINUX = @FLAG_M64@
141 AM_CFLAGS_AMD64_LINUX = @FLAG_M64@ @PREFERRED_STACK_BOUNDARY@ \
142 $(AM_CFLAGS_BASE) -fomit-frame-pointer
143 AM_CCASFLAGS_AMD64_LINUX = @FLAG_M64@ -g
145 AM_FLAG_M3264_PPC32_LINUX = @FLAG_M32@
146 AM_CFLAGS_PPC32_LINUX = @FLAG_M32@ $(AM_CFLAGS_BASE)
147 AM_CCASFLAGS_PPC32_LINUX = @FLAG_M32@ -g
149 AM_FLAG_M3264_PPC64_LINUX = @FLAG_M64@
150 AM_CFLAGS_PPC64_LINUX = @FLAG_M64@ $(AM_CFLAGS_BASE)
151 AM_CCASFLAGS_PPC64_LINUX = @FLAG_M64@ -g
153 AM_FLAG_M3264_ARM_LINUX = @FLAG_M32@
154 AM_CFLAGS_ARM_LINUX = @FLAG_M32@ @PREFERRED_STACK_BOUNDARY@ \
155 $(AM_CFLAGS_BASE) -marm -mcpu=cortex-a8
156 AM_CCASFLAGS_ARM_LINUX = @FLAG_M32@ \
157 -marm -mcpu=cortex-a8 -g
159 AM_FLAG_M3264_ARM64_LINUX = @FLAG_M64@
160 AM_CFLAGS_ARM64_LINUX = @FLAG_M64@ $(AM_CFLAGS_BASE)
161 AM_CCASFLAGS_ARM64_LINUX = @FLAG_M64@ -g
163 AM_FLAG_M3264_X86_DARWIN = -arch i386
164 AM_CFLAGS_X86_DARWIN = $(WERROR) -arch i386 $(AM_CFLAGS_BASE) \
165 -mmacosx-version-min=10.5 \
166 -fno-stack-protector -fno-pic -fno-PIC
168 AM_CCASFLAGS_X86_DARWIN = -arch i386 -g
170 AM_FLAG_M3264_AMD64_DARWIN = -arch x86_64
171 AM_CFLAGS_AMD64_DARWIN = $(WERROR) -arch x86_64 $(AM_CFLAGS_BASE) \
172 -mmacosx-version-min=10.5 -fno-stack-protector
173 AM_CCASFLAGS_AMD64_DARWIN = -arch x86_64 -g
175 AM_FLAG_M3264_S390X_LINUX = @FLAG_M64@
176 AM_CFLAGS_S390X_LINUX = @FLAG_M64@ $(AM_CFLAGS_BASE) -fomit-frame-pointer
177 AM_CCASFLAGS_S390X_LINUX = @FLAG_M64@ -g -mzarch -march=z900
179 AM_FLAG_M3264_MIPS32_LINUX = @FLAG_M32@
180 AM_CFLAGS_MIPS32_LINUX = @FLAG_M32@ $(AM_CFLAGS_BASE) @FLAG_MIPS32@
181 AM_CCASFLAGS_MIPS32_LINUX = @FLAG_M32@ -g @FLAG_MIPS32@
183 AM_FLAG_M3264_MIPS64_LINUX = @FLAG_M64@
184 AM_CFLAGS_MIPS64_LINUX = @FLAG_M64@ $(AM_CFLAGS_BASE) @FLAG_MIPS64@
185 AM_CCASFLAGS_MIPS64_LINUX = @FLAG_M64@ -g @FLAG_MIPS64@
187 # Flags for the primary target. These must be used to build the
188 # regtests and performance tests. In fact, these must be used to
189 # build anything which is built only once on a dual-arch build.
191 AM_FLAG_M3264_PRI = $(AM_FLAG_M3264_@VGCONF_PLATFORM_PRI_CAPS@)
192 AM_CPPFLAGS_PRI = $(AM_CPPFLAGS_@VGCONF_PLATFORM_PRI_CAPS@)
193 AM_CFLAGS_PRI = $(AM_CFLAGS_@VGCONF_PLATFORM_PRI_CAPS@)
194 AM_CCASFLAGS_PRI = $(AM_CCASFLAGS_@VGCONF_PLATFORM_PRI_CAPS@)
196 if VGCONF_HAVE_PLATFORM_SEC
197 AM_FLAG_M3264_SEC = $(AM_FLAG_M3264_@VGCONF_PLATFORM_SEC_CAPS@)
203 # Baseline link flags for making vgpreload shared objects.
205 PRELOAD_LDFLAGS_COMMON_LINUX = -nodefaultlibs -shared -Wl,-z,interpose,-z,initfirst
206 PRELOAD_LDFLAGS_COMMON_DARWIN = -dynamic -dynamiclib -all_load
208 if VGCONF_PLATVARIANT_IS_ANDROID
209 # The Android toolchain includes all kinds of stdlib helpers present in
210 # bionic which is bad because we are not linking with it and the Android
212 PRELOAD_LDFLAGS_COMMON_LINUX += -nostdlib
215 PRELOAD_LDFLAGS_X86_LINUX = $(PRELOAD_LDFLAGS_COMMON_LINUX) @FLAG_M32@
216 PRELOAD_LDFLAGS_AMD64_LINUX = $(PRELOAD_LDFLAGS_COMMON_LINUX) @FLAG_M64@
217 PRELOAD_LDFLAGS_PPC32_LINUX = $(PRELOAD_LDFLAGS_COMMON_LINUX) @FLAG_M32@
218 PRELOAD_LDFLAGS_PPC64_LINUX = $(PRELOAD_LDFLAGS_COMMON_LINUX) @FLAG_M64@
219 PRELOAD_LDFLAGS_ARM_LINUX = $(PRELOAD_LDFLAGS_COMMON_LINUX) @FLAG_M32@
220 PRELOAD_LDFLAGS_ARM64_LINUX = $(PRELOAD_LDFLAGS_COMMON_LINUX) @FLAG_M64@
221 PRELOAD_LDFLAGS_X86_DARWIN = $(PRELOAD_LDFLAGS_COMMON_DARWIN) -arch i386
222 PRELOAD_LDFLAGS_AMD64_DARWIN = $(PRELOAD_LDFLAGS_COMMON_DARWIN) -arch x86_64
223 PRELOAD_LDFLAGS_S390X_LINUX = $(PRELOAD_LDFLAGS_COMMON_LINUX) @FLAG_M64@
224 PRELOAD_LDFLAGS_MIPS32_LINUX = $(PRELOAD_LDFLAGS_COMMON_LINUX) @FLAG_M32@
225 PRELOAD_LDFLAGS_MIPS64_LINUX = $(PRELOAD_LDFLAGS_COMMON_LINUX) @FLAG_M64@