Bug 487993 - Alignment error when using Eigen with Valgrind and -m32
[valgrind.git] / auxprogs / Makefile.am
blob3a9709da6f0633b94127edc28e7d6aa335d4870f
1 include $(top_srcdir)/Makefile.all.am
3 dist_noinst_SCRIPTS = \
4         change-copyright-year \
5         dump_insn_ppc.sh \
6         gen-mdg \
7         gsl19test \
8         make_or_upd_vgversion_h \
9         nightly-build-summary \
10         update-demangler \
11         posixtestsuite-1.5.1-diff-results
13 EXTRA_DIST = \
14         docs/valgrind-listener-manpage.xml \
15         docs/valgrind-di-server-manpage.xml \
16         gsl-1.6.patch \
17         gsl-1.6.supp \
18         gsl-1.6.out.x86.exp \
19         posixtestsuite-1.5.1-diff.txt \
20         ppcfround.c \
21         ppc64shifts.c \
22         primes.c
24 #----------------------------------------------------------------------------
25 # valgrind_listener  (built for the primary target only)
26 # valgrind-di-server (ditto)
27 #----------------------------------------------------------------------------
29 bin_PROGRAMS = valgrind-listener valgrind-di-server
31 valgrind_listener_SOURCES = valgrind-listener.c
32 valgrind_listener_CPPFLAGS  = $(AM_CPPFLAGS_PRI) -I$(top_srcdir)/coregrind
33 valgrind_listener_CFLAGS    = $(AM_CFLAGS_PRI)
34 valgrind_listener_CCASFLAGS = $(AM_CCASFLAGS_PRI)
35 valgrind_listener_LDFLAGS   = $(AM_CFLAGS_PRI)
36 if VGCONF_PLATVARIANT_IS_ANDROID
37 valgrind_listener_CFLAGS    += -static
38 endif
39 # If there is no secondary platform, and the platforms include x86-darwin,
40 # then the primary platform must be x86-darwin.  Hence:
41 if ! VGCONF_HAVE_PLATFORM_SEC
42 if VGCONF_PLATFORMS_INCLUDE_X86_DARWIN
43 valgrind_listener_LDFLAGS   += -Wl,-read_only_relocs -Wl,suppress
44 endif
45 endif
46 if VGCONF_OS_IS_SOLARIS
47 valgrind_listener_LDADD      = -lsocket -lnsl
48 endif
50 valgrind_di_server_SOURCES   = valgrind-di-server.c
51 valgrind_di_server_CPPFLAGS  = $(AM_CPPFLAGS_PRI) -I$(top_srcdir)/coregrind
52 valgrind_di_server_CFLAGS    = $(AM_CFLAGS_PRI)
53 valgrind_di_server_CCASFLAGS = $(AM_CCASFLAGS_PRI)
54 valgrind_di_server_LDFLAGS   = $(AM_CFLAGS_PRI)
55 if VGCONF_PLATVARIANT_IS_ANDROID
56 valgrind_di_server_CFLAGS    += -static
57 endif
58 # If there is no secondary platform, and the platforms include x86-darwin,
59 # then the primary platform must be x86-darwin.  Hence:
60 if ! VGCONF_HAVE_PLATFORM_SEC
61 if VGCONF_PLATFORMS_INCLUDE_X86_DARWIN
62 valgrind_di_server_LDFLAGS   += -Wl,-read_only_relocs -Wl,suppress
63 endif
64 endif
65 if VGCONF_OS_IS_SOLARIS
66 valgrind_di_server_LDADD     = -lsocket -lnsl
67 endif
69 #----------------------------------------------------------------------------
70 # getoff-<platform>
71 # Used to retrieve user space various offsets, using user space libraries.
72 #----------------------------------------------------------------------------
74 noinst_PROGRAMS  = getoff-@VGCONF_ARCH_PRI@-@VGCONF_OS@
75 if VGCONF_HAVE_PLATFORM_SEC
76 noinst_PROGRAMS += getoff-@VGCONF_ARCH_SEC@-@VGCONF_OS@
77 endif
79 # The link flags for this are tricky, because we want to build it for
80 # both the primary and secondary platforms, and add 
81 # "-Wl,-read_only_relocs -Wl,suppress" to whichever of those is x86-darwin,
82 # if any.  Hence there's a double-nested conditional that adds to the
83 # LDFLAGS in both cases.
85 getoff_@VGCONF_ARCH_PRI@_@VGCONF_OS@_SOURCES   = getoff.c
86 getoff_@VGCONF_ARCH_PRI@_@VGCONF_OS@_CPPFLAGS  = $(AM_CPPFLAGS_@VGCONF_PLATFORM_PRI_CAPS@)
87 getoff_@VGCONF_ARCH_PRI@_@VGCONF_OS@_CFLAGS    = $(AM_CFLAGS_@VGCONF_PLATFORM_PRI_CAPS@)
88 getoff_@VGCONF_ARCH_PRI@_@VGCONF_OS@_CCASFLAGS = $(AM_CCASFLAGS_PRI)
89 getoff_@VGCONF_ARCH_PRI@_@VGCONF_OS@_LDFLAGS   = $(AM_CFLAGS_PRI) @LIB_UBSAN@
90 if HAVE_DLINFO_RTLD_DI_TLS_MODID
91 getoff_@VGCONF_ARCH_PRI@_@VGCONF_OS@_LDADD = $(LDADD) -ldl
92 endif
93 # If there is no secondary platform, and the platforms include x86-darwin,
94 # then the primary platform must be x86-darwin.  Hence:
95 if ! VGCONF_HAVE_PLATFORM_SEC
96 if VGCONF_PLATFORMS_INCLUDE_X86_DARWIN
97 getoff_@VGCONF_ARCH_PRI@_@VGCONF_OS@_LDFLAGS   += -Wl,-read_only_relocs -Wl,suppress
98 endif
99 endif
101 if VGCONF_HAVE_PLATFORM_SEC
102 getoff_@VGCONF_ARCH_SEC@_@VGCONF_OS@_SOURCES   = getoff.c
103 getoff_@VGCONF_ARCH_SEC@_@VGCONF_OS@_CPPFLAGS  = $(AM_CPPFLAGS_@VGCONF_PLATFORM_SEC_CAPS@)
104 getoff_@VGCONF_ARCH_SEC@_@VGCONF_OS@_CFLAGS    = $(AM_CFLAGS_@VGCONF_PLATFORM_SEC_CAPS@)
105 getoff_@VGCONF_ARCH_SEC@_@VGCONF_OS@_CCASFLAGS = $(AM_CCASFLAGS_SEC)
106 getoff_@VGCONF_ARCH_SEC@_@VGCONF_OS@_LDFLAGS   = $(AM_CFLAGS_SEC)
107 if HAVE_DLINFO_RTLD_DI_TLS_MODID
108 getoff_@VGCONF_ARCH_SEC@_@VGCONF_OS@_LDADD = $(LDADD) -ldl
109 endif
110 endif
111 # If there is a secondary platform, and the platforms include x86-darwin,
112 # then the primary platform must be amd64-darwin and the secondary platform
113 # must be x86-darwin.  Hence:
114 if VGCONF_HAVE_PLATFORM_SEC
115 if VGCONF_PLATFORMS_INCLUDE_X86_DARWIN
116 getoff_@VGCONF_ARCH_SEC@_@VGCONF_OS@_LDFLAGS   += -Wl,-read_only_relocs -Wl,suppress
117 endif
118 endif
120 #----------------------------------------------------------------------------
121 # Auxiliary testsuits
122 #----------------------------------------------------------------------------
124 auxchecks: gsl-check
125 auxclean: gsl-clean
127 # You can override AUX_CHECK_DIR to use a previous download/build.
128 # Must be an absolute path.
129 # e.g. make auxchecks AUX_CHECK_DIR=$HOME/valgrind-auxtests
130 AUX_CHECK_DIR=$(abs_builddir)/auxchecks
132 # GNU Scientific Library 1.6
133 GSL_DIR_NAME=gsl-1.6
134 GSL_TAR_NAME=$(GSL_DIR_NAME).tar.gz
135 GSL_URL=https://ftpmirror.gnu.org/gsl/$(GSL_TAR_NAME)
136 GSL_SHA256_SUM=52e097b5228a617fef788d54eba6855c1addc62b8f68a1dfb5895cad25594f1f
137 GSL_TAR=$(AUX_CHECK_DIR)/$(GSL_TAR_NAME)
138 GSL_SRC_DIR=$(AUX_CHECK_DIR)/$(GSL_DIR_NAME)
139 # By default we like -O3 to hopefully get some loop vectorization
140 # You can also override GSL_CFLAGS if you want e.g. -march=core-avx2
141 # Different GSL_CFLAGS will result in different build dirs (under AUX_CHECK_DIR)
142 GSL_CFLAGS=-g -O3
143 # i386 needs sse to get rounding for floating point correct.
144 # But we only want this if the primary isn't AMD64
145 if VGCONF_ARCHS_INCLUDE_X86
146 if !VGCONF_ARCHS_INCLUDE_AMD64
147 GSL_CFLAGS+=-mfpmath=sse -msse2
148 endif
149 endif
151 # Trick to get a literal space to use in substitutions
152 sp := $(subst ,, )
154 # Filter out spaces from GSL_CFLAGS to get unique build dir
155 GSL_BUILD_DIR=$(AUX_CHECK_DIR)/gsl-build$(subst $(sp),,$(GSL_CFLAGS))
157 # These are all the tests, except siman and randist which can take minutes.
158 GSL_TESTS=block cblas cdf cheb combination complex const deriv dht diff \
159           eigen err fft fit histogram ieee-utils integration interpolation \
160           linalg matrix min monte multifit multimin multiroots ntuple \
161           ode-initval permutation poly qrng rng roots sort specfunc \
162           statistics sum sys vector wavelet
164 # Get the tar file if we don't have it yet.
165 $(GSL_TAR):
166         mkdir -p $(AUX_CHECK_DIR)
167         wget -q -O $(GSL_TAR) $(GSL_URL)
169 # We need to autoreconf to make sure to get config.guess, config.sub
170 # and libtool for newer architectures.
171 $(GSL_SRC_DIR)/gsl-patched: $(GSL_TAR)
172         echo "$(GSL_SHA256_SUM)  $(GSL_TAR)" | @SHA256SUM@ --check -
173         (cd $(AUX_CHECK_DIR) && \
174          tar zxf $(GSL_TAR_NAME) && \
175          cd $(GSL_DIR_NAME) && \
176          patch -p1 < $(abs_top_srcdir)/auxprogs/gsl-1.6.patch && \
177          autoreconf -f -i -Wnone)
178         touch $@
180 # We need make check -k because
181 # some tests might fail even native (only on i386 though).
182 # make check doesn't work reliably with -j.
183 $(GSL_BUILD_DIR)/gsl-build: $(GSL_SRC_DIR)/gsl-patched
184         mkdir -p $(GSL_BUILD_DIR)
185         (cd $(GSL_BUILD_DIR) && \
186          $(GSL_SRC_DIR)/configure CC="${CC}" CXX="${CXX}" CFLAGS="$(GSL_CFLAGS)" && \
187          ${MAKE} -j $(nproc) && \
188          ${MAKE} check -k || true)
189         touch $@
191 # We hope all tests PASS (so don't produce output except for the test names).
192 # But on x86 we get one FAIL, so that is "fine" too.
193 # We currently don't check stderr, but we probably should.
194 gsl-check: $(GSL_BUILD_DIR)/gsl-build
195         (cd  $(GSL_BUILD_DIR); \
196          for gsl_test in $(GSL_TESTS); do \
197            echo $$gsl_test; \
198            ./libtool --mode=execute $(abs_top_builddir)/vg-in-place -q \
199                      --suppressions=$(abs_top_srcdir)/auxprogs/gsl-1.6.supp \
200                      $$gsl_test/test; \
201          done | grep --line-buffered -v ^PASS: | tee valgrind-gsl.out)
202         for gsl_test in $(GSL_TESTS); do echo $$gsl_test; done \
203           | cmp - $(GSL_BUILD_DIR)/valgrind-gsl.out || \
204         diff -u $(abs_top_srcdir)/auxprogs/gsl-1.6.out.x86.exp \
205                 $(GSL_BUILD_DIR)/valgrind-gsl.out
207 # We keep the tarball but remove the unpacked sources and build
208 gsl-clean:
209         rm -rf $(GSL_SRC_NAME) $(GSL_BUILD_DIR)
211 #----------------------------------------------------------------------------
212 # General stuff
213 #----------------------------------------------------------------------------
215 all-local: inplace-noinst_PROGRAMS inplace-noinst_DSYMS
217 clean-local: clean-noinst_DSYMS auxclean
219 install-exec-local: install-noinst_PROGRAMS install-noinst_DSYMS
221 uninstall-local: uninstall-noinst_PROGRAMS uninstall-noinst_DSYMS