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 # 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.
64 uninstall-noinst_PROGRAMS:
65 for f in $(noinst_PROGRAMS); do \
66 rm -f $(DESTDIR)$(pkglibdir)/$$f; \
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'...
73 install-noinst_DSYMS: build-noinst_DSYMS
74 $(mkinstalldirs) $(DESTDIR)$(pkglibdir); \
75 for f in $(noinst_DSYMS); do \
76 cp -R $$f.dSYM $(DESTDIR)$(pkglibdir); \
79 # Similar to uninstall-noinst_PROGRAMS.
80 uninstall-noinst_DSYMS:
81 for f in $(noinst_DSYMS); do \
82 rm -f $(DESTDIR)$(pkglibdir)/$$f.dSYM; \
85 # This needs to be depended on by a 'clean-local' rule.
87 for f in $(noinst_DSYMS); do \
91 #----------------------------------------------------------------------------
93 #----------------------------------------------------------------------------
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.
103 -Wmissing-prototypes \
106 -Wstrict-prototypes \
107 -Wmissing-declarations \
108 @FLAG_W_NO_FORMAT_ZERO_LENGTH@ \
109 @FLAG_W_NO_TAUTOLOGICAL_COMPARE@ \
110 -fno-strict-aliasing \
113 # These flags are used for building the preload shared objects (PSOs).
114 # The aim is to give reasonable performance but also to have good
115 # stack traces, since users often see stack traces extending
116 # into (and through) the preloads. Also, we must use any
117 # -mpreferred-stack-boundary flag to build the preload shared
118 # objects, since that risks misaligning the client's stack and
119 # results in segfaults like (eg) #324050.
120 if VGCONF_OS_IS_DARWIN
121 AM_CFLAGS_PSO_BASE = -dynamic \
122 -O -g -fno-omit-frame-pointer -fno-strict-aliasing \
123 -fpic -fPIC -fno-builtin
125 AM_CFLAGS_PSO_BASE = -O -g -fno-omit-frame-pointer -fno-strict-aliasing \
130 # Flags for specific targets.
132 # Nb: the AM_CPPFLAGS_* values are suitable for building tools and auxprogs.
133 # For building the core, coregrind/Makefile.am files add some extra things.
135 AM_CPPFLAGS_@VGCONF_PLATFORM_PRI_CAPS@ = \
137 -I$(top_srcdir)/include \
138 -I$(top_srcdir)/VEX/pub \
139 -I$(top_builddir)/VEX/pub \
140 -DVGA_@VGCONF_ARCH_PRI@=1 \
141 -DVGO_@VGCONF_OS@=1 \
142 -DVGP_@VGCONF_ARCH_PRI@_@VGCONF_OS@=1 \
143 -DVGPV_@VGCONF_ARCH_PRI@_@VGCONF_OS@_@VGCONF_PLATVARIANT@=1
144 if VGCONF_HAVE_PLATFORM_SEC
145 AM_CPPFLAGS_@VGCONF_PLATFORM_SEC_CAPS@ = \
147 -I$(top_srcdir)/include \
148 -I$(top_srcdir)/VEX/pub \
149 -I$(top_builddir)/VEX/pub \
150 -DVGA_@VGCONF_ARCH_SEC@=1 \
151 -DVGO_@VGCONF_OS@=1 \
152 -DVGP_@VGCONF_ARCH_SEC@_@VGCONF_OS@=1 \
153 -DVGPV_@VGCONF_ARCH_SEC@_@VGCONF_OS@_@VGCONF_PLATVARIANT@=1
156 AM_FLAG_M3264_X86_LINUX = @FLAG_M32@
157 AM_CFLAGS_X86_LINUX = @FLAG_M32@ @PREFERRED_STACK_BOUNDARY_2@ \
158 $(AM_CFLAGS_BASE) -fomit-frame-pointer
159 AM_CFLAGS_PSO_X86_LINUX = @FLAG_M32@ $(AM_CFLAGS_BASE) $(AM_CFLAGS_PSO_BASE)
160 AM_CCASFLAGS_X86_LINUX = @FLAG_M32@ -g
162 AM_FLAG_M3264_AMD64_LINUX = @FLAG_M64@
163 AM_CFLAGS_AMD64_LINUX = @FLAG_M64@ \
164 $(AM_CFLAGS_BASE) -fomit-frame-pointer
165 AM_CFLAGS_PSO_AMD64_LINUX = @FLAG_M64@ $(AM_CFLAGS_BASE) $(AM_CFLAGS_PSO_BASE)
166 AM_CCASFLAGS_AMD64_LINUX = @FLAG_M64@ -g
168 AM_FLAG_M3264_PPC32_LINUX = @FLAG_M32@
169 AM_CFLAGS_PPC32_LINUX = @FLAG_M32@ $(AM_CFLAGS_BASE)
170 AM_CFLAGS_PSO_PPC32_LINUX = @FLAG_M32@ $(AM_CFLAGS_BASE) $(AM_CFLAGS_PSO_BASE)
171 AM_CCASFLAGS_PPC32_LINUX = @FLAG_M32@ -g
173 AM_FLAG_M3264_PPC64BE_LINUX = @FLAG_M64@
174 AM_CFLAGS_PPC64BE_LINUX = @FLAG_M64@ $(AM_CFLAGS_BASE)
175 AM_CFLAGS_PSO_PPC64BE_LINUX = @FLAG_M64@ $(AM_CFLAGS_BASE) $(AM_CFLAGS_PSO_BASE)
176 AM_CCASFLAGS_PPC64BE_LINUX = @FLAG_M64@ -g
178 AM_FLAG_M3264_PPC64LE_LINUX = @FLAG_M64@
179 AM_CFLAGS_PPC64LE_LINUX = @FLAG_M64@ $(AM_CFLAGS_BASE)
180 AM_CFLAGS_PSO_PPC64LE_LINUX = @FLAG_M64@ $(AM_CFLAGS_BASE) $(AM_CFLAGS_PSO_BASE)
181 AM_CCASFLAGS_PPC64LE_LINUX = @FLAG_M64@ -g
183 AM_FLAG_M3264_ARM_LINUX = @FLAG_M32@
184 AM_CFLAGS_ARM_LINUX = @FLAG_M32@ \
185 $(AM_CFLAGS_BASE) -marm -mcpu=cortex-a8
186 AM_CFLAGS_PSO_ARM_LINUX = @FLAG_M32@ $(AM_CFLAGS_BASE) \
187 -marm -mcpu=cortex-a8 $(AM_CFLAGS_PSO_BASE)
188 AM_CCASFLAGS_ARM_LINUX = @FLAG_M32@ \
189 -marm -mcpu=cortex-a8 -g
191 AM_FLAG_M3264_ARM64_LINUX = @FLAG_M64@
192 AM_CFLAGS_ARM64_LINUX = @FLAG_M64@ $(AM_CFLAGS_BASE)
193 AM_CFLAGS_PSO_ARM64_LINUX = @FLAG_M64@ $(AM_CFLAGS_BASE) $(AM_CFLAGS_PSO_BASE)
194 AM_CCASFLAGS_ARM64_LINUX = @FLAG_M64@ -g
196 AM_FLAG_M3264_X86_DARWIN = -arch i386
197 AM_CFLAGS_X86_DARWIN = $(WERROR) -arch i386 $(AM_CFLAGS_BASE) \
198 -mmacosx-version-min=10.5 \
199 -fno-stack-protector -fno-pic -fno-PIC
201 AM_CFLAGS_PSO_X86_DARWIN = $(AM_CFLAGS_X86_DARWIN) $(AM_CFLAGS_PSO_BASE)
202 AM_CCASFLAGS_X86_DARWIN = -arch i386 -g
204 AM_FLAG_M3264_AMD64_DARWIN = -arch x86_64
205 AM_CFLAGS_AMD64_DARWIN = $(WERROR) -arch x86_64 $(AM_CFLAGS_BASE) \
206 -mmacosx-version-min=10.5 -fno-stack-protector
207 AM_CFLAGS_PSO_AMD64_DARWIN = $(AM_CFLAGS_AMD64_DARWIN) $(AM_CFLAGS_PSO_BASE)
208 AM_CCASFLAGS_AMD64_DARWIN = -arch x86_64 -g
210 AM_FLAG_M3264_S390X_LINUX = @FLAG_M64@
211 AM_CFLAGS_S390X_LINUX = @FLAG_M64@ $(AM_CFLAGS_BASE) -fomit-frame-pointer
212 AM_CFLAGS_PSO_S390X_LINUX = @FLAG_M64@ $(AM_CFLAGS_BASE) $(AM_CFLAGS_PSO_BASE)
213 AM_CCASFLAGS_S390X_LINUX = @FLAG_M64@ -g -mzarch -march=z900
215 AM_FLAG_M3264_MIPS32_LINUX = @FLAG_M32@
216 AM_CFLAGS_MIPS32_LINUX = @FLAG_M32@ $(AM_CFLAGS_BASE) @FLAG_MIPS32@
217 AM_CFLAGS_PSO_MIPS32_LINUX = @FLAG_M32@ $(AM_CFLAGS_BASE) @FLAG_MIPS32@ \
218 $(AM_CFLAGS_PSO_BASE)
219 AM_CCASFLAGS_MIPS32_LINUX = @FLAG_M32@ -g @FLAG_MIPS32@
221 AM_FLAG_M3264_MIPS64_LINUX = @FLAG_M64@
222 AM_CFLAGS_MIPS64_LINUX = @FLAG_M64@ $(AM_CFLAGS_BASE) @FLAG_MIPS64@
223 AM_CFLAGS_PSO_MIPS64_LINUX = @FLAG_M64@ $(AM_CFLAGS_BASE) @FLAG_MIPS64@ \
224 $(AM_CFLAGS_PSO_BASE)
225 AM_CCASFLAGS_MIPS64_LINUX = @FLAG_M64@ -g @FLAG_MIPS64@
227 # Flags for the primary target. These must be used to build the
228 # regtests and performance tests. In fact, these must be used to
229 # build anything which is built only once on a dual-arch build.
231 AM_FLAG_M3264_PRI = $(AM_FLAG_M3264_@VGCONF_PLATFORM_PRI_CAPS@)
232 AM_CPPFLAGS_PRI = $(AM_CPPFLAGS_@VGCONF_PLATFORM_PRI_CAPS@)
233 AM_CFLAGS_PRI = $(AM_CFLAGS_@VGCONF_PLATFORM_PRI_CAPS@)
234 AM_CCASFLAGS_PRI = $(AM_CCASFLAGS_@VGCONF_PLATFORM_PRI_CAPS@)
236 if VGCONF_HAVE_PLATFORM_SEC
237 AM_FLAG_M3264_SEC = $(AM_FLAG_M3264_@VGCONF_PLATFORM_SEC_CAPS@)
243 # Baseline link flags for making vgpreload shared objects.
245 PRELOAD_LDFLAGS_COMMON_LINUX = -nodefaultlibs -shared -Wl,-z,interpose,-z,initfirst
246 PRELOAD_LDFLAGS_COMMON_DARWIN = -dynamic -dynamiclib -all_load
248 if VGCONF_PLATVARIANT_IS_ANDROID
249 # The Android toolchain includes all kinds of stdlib helpers present in
250 # bionic which is bad because we are not linking with it and the Android
252 PRELOAD_LDFLAGS_COMMON_LINUX += -nostdlib
255 PRELOAD_LDFLAGS_X86_LINUX = $(PRELOAD_LDFLAGS_COMMON_LINUX) @FLAG_M32@
256 PRELOAD_LDFLAGS_AMD64_LINUX = $(PRELOAD_LDFLAGS_COMMON_LINUX) @FLAG_M64@
257 PRELOAD_LDFLAGS_PPC32_LINUX = $(PRELOAD_LDFLAGS_COMMON_LINUX) @FLAG_M32@
258 PRELOAD_LDFLAGS_PPC64BE_LINUX = $(PRELOAD_LDFLAGS_COMMON_LINUX) @FLAG_M64@
259 PRELOAD_LDFLAGS_PPC64LE_LINUX = $(PRELOAD_LDFLAGS_COMMON_LINUX) @FLAG_M64@
260 PRELOAD_LDFLAGS_ARM_LINUX = $(PRELOAD_LDFLAGS_COMMON_LINUX) @FLAG_M32@
261 PRELOAD_LDFLAGS_ARM64_LINUX = $(PRELOAD_LDFLAGS_COMMON_LINUX) @FLAG_M64@
262 PRELOAD_LDFLAGS_X86_DARWIN = $(PRELOAD_LDFLAGS_COMMON_DARWIN) -arch i386
263 PRELOAD_LDFLAGS_AMD64_DARWIN = $(PRELOAD_LDFLAGS_COMMON_DARWIN) -arch x86_64
264 PRELOAD_LDFLAGS_S390X_LINUX = $(PRELOAD_LDFLAGS_COMMON_LINUX) @FLAG_M64@
265 PRELOAD_LDFLAGS_MIPS32_LINUX = $(PRELOAD_LDFLAGS_COMMON_LINUX) @FLAG_M32@
266 PRELOAD_LDFLAGS_MIPS64_LINUX = $(PRELOAD_LDFLAGS_COMMON_LINUX) @FLAG_M64@