Add missing zstd.h to coregrind Makefile.am noinst_HEADERS
[valgrind.git] / Makefile.all.am
blobe221198d6ca2f8801e4b61f798371236d7c9cc56
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 #----------------------------------------------------------------------------
6 # Global stuff
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.
13 ##.NOTPARALLEL:
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"; \
30               dsymutil $$f; \
31           fi; \
32         done
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); \
42         done
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); \
50         done
52 # This is used by coregrind/Makefile.am and by <tool>/Makefile.am for doing
53 # "make install".  It copies $(noinst_PROGRAMS) into $prefix/libexec/valgrind/.
54 # It needs to be depended on by an 'install-exec-local' rule.
55 install-noinst_PROGRAMS: $(noinst_PROGRAMS)
56         $(mkinstalldirs) $(DESTDIR)$(pkglibexecdir); \
57         for f in $(noinst_PROGRAMS); do \
58           $(INSTALL_PROGRAM) $$f $(DESTDIR)$(pkglibexecdir); \
59         done
61 # This is used by coregrind/Makefile.am and by <tool>/Makefile.am for doing
62 # "make uninstall".  It removes $(noinst_PROGRAMS) from $prefix/libexec/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)$(pkglibexecdir)/$$f; \
67         done
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)$(pkglibexecdir); \
75         for f in $(noinst_DSYMS); do \
76           cp -R $$f.dSYM $(DESTDIR)$(pkglibexecdir); \
77         done
79 # Similar to uninstall-noinst_PROGRAMS.
80 uninstall-noinst_DSYMS:
81         for f in $(noinst_DSYMS); do \
82           rm -f $(DESTDIR)$(pkglibexecdir)/$$f.dSYM; \
83         done
85 # This needs to be depended on by a 'clean-local' rule.
86 clean-noinst_DSYMS:
87         for f in $(noinst_DSYMS); do \
88           rm -rf $$f.dSYM; \
89         done
91 #----------------------------------------------------------------------------
92 # Flags
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.
99 AM_CFLAGS_BASE = \
100         -O2 -g \
101         -Wall \
102         -Wmissing-prototypes \
103         -Wshadow \
104         -Wpointer-arith \
105         -Wstrict-prototypes \
106         -Wmissing-declarations \
107         -Wno-unused-result \
108         @FLAG_W_CAST_ALIGN@ \
109         @FLAG_W_CAST_QUAL@ \
110         @FLAG_W_WRITE_STRINGS@ \
111         @FLAG_W_EMPTY_BODY@ \
112         @FLAG_W_FORMAT@ \
113         @FLAG_W_FORMAT_SIGNEDNESS@ \
114         @FLAG_W_FORMAT_SECURITY@ \
115         @FLAG_W_IGNORED_QUALIFIERS@ \
116         @FLAG_W_MISSING_PARAMETER_TYPE@ \
117         @FLAG_W_LOGICAL_OP@ \
118         @FLAG_W_ENUM_CONVERSION@ \
119         @FLAG_W_IMPLICIT_FALLTHROUGH@ \
120         @FLAG_W_OLD_STYLE_DECLARATION@ \
121         @FLAG_FINLINE_FUNCTIONS@ \
122         @FLAG_FNO_STACK_PROTECTOR@ \
123         @FLAG_FSANITIZE@ \
124         -fno-strict-aliasing \
125         -fno-builtin
127 # Power ISA flag for use by guest_ppc_helpers.c
128 if HAS_XSCVHPDP
129 if HAS_DARN
130 ISA_3_0_BUILD_FLAG = -DHAS_XSCVHPDP -DHAS_DARN -DHAS_ISA_3_00
131 else
132 ISA_3_0_BUILD_FLAG = -DHAS_XSCVHPDP  -DHAS_ISA_3_00
133 endif
134 else
135 ISA_3_0_BUILD_FLAG =
136 endif
138 if COMPILER_IS_CLANG
139 AM_CFLAGS_BASE += -Wno-cast-align -Wno-self-assign \
140                   -Wno-tautological-compare
141 endif
143 # These flags are used for building the preload shared objects (PSOs).
144 # The aim is to give reasonable performance but also to have good
145 # stack traces, since users often see stack traces extending 
146 # into (and through) the preloads.  Also, we must use any
147 # -mpreferred-stack-boundary flag to build the preload shared
148 # objects, since that risks misaligning the client's stack and
149 # results in segfaults like (eg) #324050.
150 if VGCONF_OS_IS_DARWIN
151 AM_CFLAGS_PSO_BASE = -dynamic \
152                      -O -g -fno-omit-frame-pointer -fno-strict-aliasing \
153                      -fpic -fPIC -fno-builtin @FLAG_FNO_IPA_ICF@
154 else
155 if VGCONF_OS_IS_FREEBSD
156 AM_CFLAGS_PSO_BASE = -O -g -fno-omit-frame-pointer -fno-strict-aliasing \
157                      -fpic -fPIC -fno-builtin
158 if COMPILER_IS_CLANG
159    AM_CFLAGS_BASE += @FLAG_W_NO_EXPANSION_TO_DEFINED@
160 endif
161 else
162 AM_CFLAGS_PSO_BASE = -O -g -fno-omit-frame-pointer -fno-strict-aliasing \
163                      -fpic -fno-builtin @FLAG_FNO_IPA_ICF@
164 endif
165 endif
168 # Flags for specific targets.
170 # Nb: the AM_CPPFLAGS_* values are suitable for building tools and auxprogs.
171 # For building the core, coregrind/Makefile.am files add some extra things.
173 AM_CPPFLAGS_@VGCONF_PLATFORM_PRI_CAPS@ = \
174         -I$(top_srcdir) \
175         -I$(top_srcdir)/include \
176         -I$(top_builddir)/include \
177         -I$(top_srcdir)/VEX/pub \
178         -I$(top_builddir)/VEX/pub \
179         -DVGA_@VGCONF_ARCH_PRI@=1 \
180         -DVGO_@VGCONF_OS@=1 \
181         -DVGP_@VGCONF_ARCH_PRI@_@VGCONF_OS@=1 \
182         -DVGPV_@VGCONF_ARCH_PRI@_@VGCONF_OS@_@VGCONF_PLATVARIANT@=1
183 if VGCONF_HAVE_PLATFORM_SEC
184 AM_CPPFLAGS_@VGCONF_PLATFORM_SEC_CAPS@ = \
185         -I$(top_srcdir) \
186         -I$(top_srcdir)/include \
187         -I$(top_builddir)/include \
188         -I$(top_srcdir)/VEX/pub \
189         -I$(top_builddir)/VEX/pub \
190         -DVGA_@VGCONF_ARCH_SEC@=1 \
191         -DVGO_@VGCONF_OS@=1 \
192         -DVGP_@VGCONF_ARCH_SEC@_@VGCONF_OS@=1 \
193         -DVGPV_@VGCONF_ARCH_SEC@_@VGCONF_OS@_@VGCONF_PLATVARIANT@=1
194 endif
196 if VGCONF_HAVE_ABI
197 AM_CPPFLAGS_@VGCONF_PLATFORM_PRI_CAPS@ += -DVGABI_@VGCONF_ABI@
198 if VGCONF_HAVE_PLATFORM_SEC
199 AM_CPPFLAGS_@VGCONF_PLATFORM_SEC_CAPS@ += -DVGABI_@VGCONF_ABI@
200 endif
201 endif
203 AM_FLAG_M3264_X86_LINUX   = @FLAG_M32@
204 AM_CFLAGS_X86_LINUX       = @FLAG_M32@ @PREFERRED_STACK_BOUNDARY_2@ \
205                                 $(AM_CFLAGS_BASE) -fomit-frame-pointer
206 AM_CFLAGS_PSO_X86_LINUX   = @FLAG_M32@ $(AM_CFLAGS_BASE) $(AM_CFLAGS_PSO_BASE)
207 AM_CCASFLAGS_X86_LINUX    = @FLAG_M32@ -g
209 AM_FLAG_M3264_AMD64_LINUX = @FLAG_M64@
210 AM_CFLAGS_AMD64_LINUX     = @FLAG_M64@ \
211                                 $(AM_CFLAGS_BASE) -fomit-frame-pointer
212 AM_CFLAGS_PSO_AMD64_LINUX = @FLAG_M64@ $(AM_CFLAGS_BASE) $(AM_CFLAGS_PSO_BASE)
213 AM_CCASFLAGS_AMD64_LINUX  = @FLAG_M64@ -g
215 AM_FLAG_M3264_PPC32_LINUX = @FLAG_M32@
216 AM_CFLAGS_PPC32_LINUX     = @FLAG_M32@ $(AM_CFLAGS_BASE)
217 AM_CFLAGS_PSO_PPC32_LINUX = @FLAG_M32@ $(AM_CFLAGS_BASE) $(AM_CFLAGS_PSO_BASE)
218 AM_CCASFLAGS_PPC32_LINUX  = @FLAG_M32@ -g
220 AM_FLAG_M3264_PPC64BE_LINUX = @FLAG_M64@
221 AM_CFLAGS_PPC64BE_LINUX     = @FLAG_M64@ $(AM_CFLAGS_BASE)
222 AM_CFLAGS_PSO_PPC64BE_LINUX = @FLAG_M64@ $(AM_CFLAGS_BASE) $(AM_CFLAGS_PSO_BASE)
223 AM_CCASFLAGS_PPC64BE_LINUX  = @FLAG_M64@ -g
225 AM_FLAG_M3264_PPC64LE_LINUX = @FLAG_M64@
226 AM_CFLAGS_PPC64LE_LINUX     = @FLAG_M64@ $(AM_CFLAGS_BASE) $(ISA_3_0_BUILD_FLAG)
227 AM_CFLAGS_PSO_PPC64LE_LINUX = @FLAG_M64@ $(AM_CFLAGS_BASE) $(AM_CFLAGS_PSO_BASE)
228 AM_CCASFLAGS_PPC64LE_LINUX  = @FLAG_M64@ -g
230 AM_FLAG_M3264_X86_FREEBSD   = @FLAG_M32@
231 AM_CFLAGS_X86_FREEBSD       = @FLAG_M32@ @PREFERRED_STACK_BOUNDARY_2@ \
232                               $(AM_CFLAGS_BASE) -fomit-frame-pointer
233 AM_CFLAGS_PSO_X86_FREEBSD       = @FLAG_M32@ $(AM_CFLAGS_BASE) $(AM_CFLAGS_PSO_BASE)
234 AM_CCASFLAGS_X86_FREEBSD    = @FLAG_M32@ -g
236 AM_FLAG_M3264_ARM_LINUX   = @FLAG_M32@ @VGCONF_PLATFORM_ARM_ARCH@
237 AM_CFLAGS_ARM_LINUX       = @FLAG_M32@ $(AM_CFLAGS_BASE) @VGCONF_PLATFORM_ARM_ARCH@
238 AM_CFLAGS_PSO_ARM_LINUX   = @FLAG_M32@ $(AM_CFLAGS_BASE) \
239                                 $(AM_CFLAGS_PSO_BASE) @VGCONF_PLATFORM_ARM_ARCH@
240 AM_CCASFLAGS_ARM_LINUX    = @FLAG_M32@ @VGCONF_PLATFORM_ARM_ARCH@
242 AM_FLAG_M3264_ARM64_LINUX = @FLAG_M64@
243 AM_CFLAGS_ARM64_LINUX     = @FLAG_M64@ $(AM_CFLAGS_BASE)
244 AM_CFLAGS_PSO_ARM64_LINUX = @FLAG_M64@ $(AM_CFLAGS_BASE) $(AM_CFLAGS_PSO_BASE)
245 AM_CCASFLAGS_ARM64_LINUX  = @FLAG_M64@ -g
248 AM_FLAG_M3264_AMD64_FREEBSD = @FLAG_M64@
249 AM_CFLAGS_AMD64_FREEBSD     = @FLAG_M64@ \
250                                 $(AM_CFLAGS_BASE) -fomit-frame-pointer
251 AM_CFLAGS_PSO_AMD64_FREEBSD = @FLAG_M64@ $(AM_CFLAGS_BASE) $(AM_CFLAGS_PSO_BASE)
252 AM_CCASFLAGS_AMD64_FREEBSD  = @FLAG_M64@ -g
254 AM_CFLAGS_ARM64_FREEBSD    = @FLAG_M64@ $(AM_CFLAGS_BASE)
255 AM_CFLAGS_PSO_ARM64_FREEBSD= @FLAG_M64@ $(AM_CFLAGS_BASE) $(AM_CFLAGS_PSO_BASE)
256 AM_CCASFLAGS_ARM64_FREEBSD = @FLAG_M64@ -g
258 AM_FLAG_M3264_X86_DARWIN = -arch i386
259 AM_CFLAGS_X86_DARWIN     = $(WERROR) -arch i386 $(AM_CFLAGS_BASE) \
260                                 -mmacosx-version-min=10.6 \
261                                 -fno-pic -fno-PIC
263 AM_CFLAGS_PSO_X86_DARWIN = $(AM_CFLAGS_X86_DARWIN) $(AM_CFLAGS_PSO_BASE)
264 AM_CCASFLAGS_X86_DARWIN  = -arch i386 -g
266 AM_FLAG_M3264_AMD64_DARWIN = -arch x86_64
267 AM_CFLAGS_AMD64_DARWIN     = $(WERROR) -arch x86_64 $(AM_CFLAGS_BASE) \
268                             -mmacosx-version-min=10.6
269 AM_CFLAGS_PSO_AMD64_DARWIN = $(AM_CFLAGS_AMD64_DARWIN) $(AM_CFLAGS_PSO_BASE)
270 AM_CCASFLAGS_AMD64_DARWIN  = -arch x86_64 -g
272 AM_FLAG_M3264_S390X_LINUX = @FLAG_M64@
273 AM_CFLAGS_S390X_LINUX     = @FLAG_M64@ $(AM_CFLAGS_BASE) -fomit-frame-pointer
274 AM_CFLAGS_PSO_S390X_LINUX = @FLAG_M64@ $(AM_CFLAGS_BASE) $(AM_CFLAGS_PSO_BASE)
275 AM_CCASFLAGS_S390X_LINUX  = @FLAG_M64@ -g
277 AM_FLAG_M3264_MIPS32_LINUX = @FLAG_M32@
278 AM_CFLAGS_MIPS32_LINUX     = @FLAG_M32@ $(AM_CFLAGS_BASE)
279 AM_CFLAGS_PSO_MIPS32_LINUX = @FLAG_M32@ $(AM_CFLAGS_BASE) \
280                                 $(AM_CFLAGS_PSO_BASE)
281 AM_CCASFLAGS_MIPS32_LINUX  = @FLAG_M32@ -g
283 AM_FLAG_M3264_NANOMIPS_LINUX = @FLAG_M32@
284 AM_CFLAGS_NANOMIPS_LINUX     = @FLAG_M32@ $(AM_CFLAGS_BASE) -mno-jump-table-opt
285 AM_CFLAGS_PSO_NANOMIPS_LINUX = @FLAG_M32@ $(AM_CFLAGS_BASE) \
286                                 $(AM_CFLAGS_PSO_BASE)
287 AM_CCASFLAGS_NANOMIPS_LINUX  = @FLAG_M32@ -g
289 AM_FLAG_M3264_MIPS64_LINUX = @FLAG_M64@
290 AM_CFLAGS_MIPS64_LINUX     = @FLAG_M64@ $(AM_CFLAGS_BASE)
291 AM_CFLAGS_PSO_MIPS64_LINUX = @FLAG_M64@ $(AM_CFLAGS_BASE) \
292                                 $(AM_CFLAGS_PSO_BASE)
293 AM_CCASFLAGS_MIPS64_LINUX  = @FLAG_M64@ -g
295 AM_FLAG_M3264_X86_SOLARIS   = @FLAG_M32@
296 AM_CFLAGS_X86_SOLARIS       = @FLAG_M32@ @PREFERRED_STACK_BOUNDARY_2@ \
297                                 $(AM_CFLAGS_BASE) -fomit-frame-pointer @SOLARIS_UNDEF_LARGESOURCE@
298 AM_CFLAGS_PSO_X86_SOLARIS   = @FLAG_M32@ $(AM_CFLAGS_BASE) $(AM_CFLAGS_PSO_BASE)
299 AM_CCASFLAGS_X86_SOLARIS    = @FLAG_M32@ -g -D_ASM
301 AM_FLAG_M3264_AMD64_SOLARIS = @FLAG_M64@
302 AM_CFLAGS_AMD64_SOLARIS     = @FLAG_M64@ \
303                                 $(AM_CFLAGS_BASE) -fomit-frame-pointer
304 AM_CFLAGS_PSO_AMD64_SOLARIS  = @FLAG_M64@ $(AM_CFLAGS_BASE) $(AM_CFLAGS_PSO_BASE)
305 AM_CCASFLAGS_AMD64_SOLARIS  = @FLAG_M64@ -g -D_ASM
307 # Flags for the primary target.  These must be used to build the
308 # regtests and performance tests.  In fact, these must be used to
309 # build anything which is built only once on a dual-arch build.
311 AM_FLAG_M3264_PRI = $(AM_FLAG_M3264_@VGCONF_PLATFORM_PRI_CAPS@)
312 AM_CPPFLAGS_PRI   = $(AM_CPPFLAGS_@VGCONF_PLATFORM_PRI_CAPS@)
313 AM_CFLAGS_PRI     = $(AM_CFLAGS_@VGCONF_PLATFORM_PRI_CAPS@)
314 AM_CCASFLAGS_PRI  = $(AM_CCASFLAGS_@VGCONF_PLATFORM_PRI_CAPS@)
316 if VGCONF_HAVE_PLATFORM_SEC
317  AM_FLAG_M3264_SEC = $(AM_FLAG_M3264_@VGCONF_PLATFORM_SEC_CAPS@)
318 else
319  AM_FLAG_M3264_SEC = 
320 endif
323 # Baseline link flags for making vgpreload shared objects.
325 PRELOAD_LDFLAGS_COMMON_LINUX  = -nodefaultlibs -shared -Wl,-z,interpose,-z,initfirst
326 PRELOAD_LDFLAGS_COMMON_FREEBSD  = -nodefaultlibs -shared -Wl,-z,interpose,-z,initfirst
327 PRELOAD_LDFLAGS_COMMON_DARWIN = -dynamic -dynamiclib -all_load
328 PRELOAD_LDFLAGS_COMMON_SOLARIS = -nodefaultlibs -shared -Wl,-z,interpose,-z,initfirst
329 if SOLARIS_XPG_SYMBOLS_PRESENT
330 PRELOAD_LDFLAGS_COMMON_SOLARIS += -Wl,-M,$(top_srcdir)/solaris/vgpreload-solaris.mapfile
331 endif
333 if VGCONF_PLATVARIANT_IS_ANDROID
334 # The Android toolchain includes all kinds of stdlib helpers present in
335 # bionic which is bad because we are not linking with it and the Android
336 # linker will panic.
337 PRELOAD_LDFLAGS_COMMON_LINUX += -nostdlib
338 endif
340 PRELOAD_LDFLAGS_X86_LINUX      = $(PRELOAD_LDFLAGS_COMMON_LINUX) @FLAG_M32@
341 PRELOAD_LDFLAGS_AMD64_LINUX    = $(PRELOAD_LDFLAGS_COMMON_LINUX) @FLAG_M64@
342 PRELOAD_LDFLAGS_PPC32_LINUX    = $(PRELOAD_LDFLAGS_COMMON_LINUX) @FLAG_M32@
343 PRELOAD_LDFLAGS_PPC64BE_LINUX  = $(PRELOAD_LDFLAGS_COMMON_LINUX) @FLAG_M64@
344 PRELOAD_LDFLAGS_PPC64LE_LINUX  = $(PRELOAD_LDFLAGS_COMMON_LINUX) @FLAG_M64@
345 PRELOAD_LDFLAGS_ARM_LINUX      = $(PRELOAD_LDFLAGS_COMMON_LINUX) @FLAG_M32@
346 PRELOAD_LDFLAGS_ARM64_LINUX    = $(PRELOAD_LDFLAGS_COMMON_LINUX) @FLAG_M64@
347 PRELOAD_LDFLAGS_X86_FREEBSD    = $(PRELOAD_LDFLAGS_COMMON_FREEBSD) @FLAG_M32@
348 PRELOAD_LDFLAGS_AMD64_FREEBSD  = $(PRELOAD_LDFLAGS_COMMON_FREEBSD) @FLAG_M64@
349 PRELOAD_LDFLAGS_ARM64_FREEBSD  = $(PRELOAD_LDFLAGS_COMMON_FREEBSD) @FLAG_M64@
350 PRELOAD_LDFLAGS_X86_DARWIN     = $(PRELOAD_LDFLAGS_COMMON_DARWIN) -arch i386
351 PRELOAD_LDFLAGS_AMD64_DARWIN   = $(PRELOAD_LDFLAGS_COMMON_DARWIN) -arch x86_64
352 PRELOAD_LDFLAGS_S390X_LINUX    = $(PRELOAD_LDFLAGS_COMMON_LINUX) @FLAG_M64@
353 PRELOAD_LDFLAGS_MIPS32_LINUX   = $(PRELOAD_LDFLAGS_COMMON_LINUX) @FLAG_M32@
354 PRELOAD_LDFLAGS_NANOMIPS_LINUX = $(PRELOAD_LDFLAGS_COMMON_LINUX) @FLAG_M32@
355 PRELOAD_LDFLAGS_MIPS64_LINUX   = $(PRELOAD_LDFLAGS_COMMON_LINUX) @FLAG_M64@
356 PRELOAD_LDFLAGS_X86_SOLARIS    = $(PRELOAD_LDFLAGS_COMMON_SOLARIS) @FLAG_M32@
357 PRELOAD_LDFLAGS_AMD64_SOLARIS  = $(PRELOAD_LDFLAGS_COMMON_SOLARIS) @FLAG_M64@