blob: 76761bec1190b44e740d6793314b779112e4ceb8 [file] [log] [blame]
nethercote4388a402004-09-01 23:20:49 +00001
njn8b68b642009-06-24 00:37:09 +00002# This file should be included (directly or indirectly) by every
3# Makefile.am that builds programs. And also the top-level Makefile.am.
nethercote4388a402004-09-01 23:20:49 +00004
njn8b68b642009-06-24 00:37:09 +00005#----------------------------------------------------------------------------
6# Global stuff
7#----------------------------------------------------------------------------
8
nethercote4388a402004-09-01 23:20:49 +00009inplacedir = $(top_builddir)/.in_place
10
njn8b68b642009-06-24 00:37:09 +000011# This used to be required when Vex had a handwritten Makefile. It
12# shouldn't be needed any more, though.
13##.NOTPARALLEL:
nethercote4388a402004-09-01 23:20:49 +000014
njn8b68b642009-06-24 00:37:09 +000015#----------------------------------------------------------------------------
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)
njn609f25d2009-06-24 08:32:07 +000038 mkdir -p $(inplacedir); \
39 for f in $(noinst_PROGRAMS) ; do \
40 rm -f $(inplacedir)/$$f; \
41 ln -f -s ../$(subdir)/$$f $(inplacedir); \
42 done
njn8b68b642009-06-24 00:37:09 +000043
44# Similar to inplace-noinst_PROGRAMS
45inplace-noinst_DSYMS: build-noinst_DSYMS
njn609f25d2009-06-24 08:32:07 +000046 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
njn8b68b642009-06-24 00:37:09 +000051
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)
njn609f25d2009-06-24 08:32:07 +000056 $(mkinstalldirs) $(DESTDIR)$(pkglibdir); \
57 for f in $(noinst_PROGRAMS); do \
58 $(INSTALL_PROGRAM) $$f $(DESTDIR)$(pkglibdir); \
59 done
njn8b68b642009-06-24 00:37:09 +000060
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'...
65install-noinst_DSYMS: build-noinst_DSYMS
njn609f25d2009-06-24 08:32:07 +000066 $(mkinstalldirs) $(DESTDIR)$(pkglibdir); \
67 for f in $(noinst_DSYMS); do \
68 cp -R $$f.dSYM $(DESTDIR)$(pkglibdir); \
69 done
njn8b68b642009-06-24 00:37:09 +000070
71# This needs to be depended on by a 'clean-local' rule.
72clean-noinst_DSYMS:
73 for f in $(noinst_DSYMS); do \
74 rm -rf $$f.dSYM; \
75 done
76
77#----------------------------------------------------------------------------
78# Flags
79#----------------------------------------------------------------------------
80
81# Baseline flags for all compilations. Aim here is to maximise
82# performance and get whatever useful warnings we can out of gcc.
83AM_CFLAGS_BASE = \
84 -O2 -g \
85 -Wall \
86 -Wmissing-prototypes \
87 -Wshadow \
88 -Wpointer-arith \
89 -Wstrict-prototypes \
90 -Wmissing-declarations \
91 @FLAG_W_NO_FORMAT_ZERO_LENGTH@ \
92 -fno-strict-aliasing
93
94# These flags are used for building the preload shared objects.
95# The aim is to give reasonable performance but also to have good
96# stack traces, since users often see stack traces extending
97# into (and through) the preloads.
98if VGCONF_OS_IS_DARWIN
99AM_CFLAGS_PIC = -dynamic -O -g -fno-omit-frame-pointer -fno-strict-aliasing -mno-dynamic-no-pic
100else
101AM_CFLAGS_PIC = -fpic -O -g -fno-omit-frame-pointer -fno-strict-aliasing
102endif
103
104
105# Flags for specific targets.
106#
107# Nb: the AM_CPPFLAGS_* values are suitable for building tools and auxprogs.
108# For building the core, coregrind/Makefile.am files add some extra things.
109#
110# Also: in newer versions of automake (1.10 onwards?) asm files ending with
111# '.S' are considered "pre-processed" (as opposed to those ending in '.s')
112# and so the CPPFLAGS are passed to the assembler. But this is not true for
113# older automakes (e.g. 1.8.5, 1.9.6), sigh. So we include
114# AM_CPPFLAGS_<PLATFORM> in each AM_CCASFLAGS_<PLATFORM> variable. This
115# means some of the flags are duplicated on systems with newer versions of
116# automake, but this does not really matter and seems hard to avoid.
117
118AM_CPPFLAGS_@VGCONF_PLATFORM_PRI_CAPS@ = \
119 -I$(top_srcdir) \
120 -I$(top_srcdir)/include \
121 -I$(top_srcdir)/VEX/pub \
122 -DVGA_@VGCONF_ARCH_PRI@=1 \
123 -DVGO_@VGCONF_OS@=1 \
124 -DVGP_@VGCONF_ARCH_PRI@_@VGCONF_OS@=1
125if VGCONF_HAVE_PLATFORM_SEC
126AM_CPPFLAGS_@VGCONF_PLATFORM_SEC_CAPS@ = \
127 -I$(top_srcdir) \
128 -I$(top_srcdir)/include \
129 -I$(top_srcdir)/VEX/pub \
130 -DVGA_@VGCONF_ARCH_SEC@=1 \
131 -DVGO_@VGCONF_OS@=1 \
132 -DVGP_@VGCONF_ARCH_SEC@_@VGCONF_OS@=1
133endif
134
135AM_FLAG_M3264_X86_LINUX = @FLAG_M32@
136AM_CFLAGS_X86_LINUX = @FLAG_M32@ @PREFERRED_STACK_BOUNDARY@ \
137 $(AM_CFLAGS_BASE)
138AM_CCASFLAGS_X86_LINUX = $(AM_CPPFLAGS_X86_LINUX) @FLAG_M32@ -g
139
140AM_FLAG_M3264_AMD64_LINUX = @FLAG_M64@
141AM_CFLAGS_AMD64_LINUX = @FLAG_M64@ -fomit-frame-pointer \
142 @PREFERRED_STACK_BOUNDARY@ $(AM_CFLAGS_BASE)
143AM_CCASFLAGS_AMD64_LINUX = $(AM_CPPFLAGS_AMD64_LINUX) @FLAG_M64@ -g
144
145AM_FLAG_M3264_PPC32_LINUX = @FLAG_M32@
146AM_CFLAGS_PPC32_LINUX = @FLAG_M32@ $(AM_CFLAGS_BASE)
147AM_CCASFLAGS_PPC32_LINUX = $(AM_CPPFLAGS_PPC32_LINUX) @FLAG_M32@ -g
148
149AM_FLAG_M3264_PPC64_LINUX = @FLAG_M64@
150AM_CFLAGS_PPC64_LINUX = @FLAG_M64@ $(AM_CFLAGS_BASE)
151AM_CCASFLAGS_PPC64_LINUX = $(AM_CPPFLAGS_PPC64_LINUX) @FLAG_M64@ -g
152
153AM_FLAG_M3264_PPC32_AIX5 = @FLAG_MAIX32@
154AM_CFLAGS_PPC32_AIX5 = @FLAG_MAIX32@ -mcpu=powerpc $(AM_CFLAGS_BASE)
155AM_CCASFLAGS_PPC32_AIX5 = $(AM_CPPFLAGS_PPC32_AIX5) \
156 @FLAG_MAIX32@ -mcpu=powerpc -g
157
158AM_FLAG_M3264_PPC64_AIX5 = @FLAG_MAIX64@
159AM_CFLAGS_PPC64_AIX5 = @FLAG_MAIX64@ -mcpu=powerpc64 $(AM_CFLAGS_BASE)
160AM_CCASFLAGS_PPC64_AIX5 = $(AM_CPPFLAGS_PPC64_AIX5) \
161 @FLAG_MAIX64@ -mcpu=powerpc64 -g
162
163AM_FLAG_M3264_X86_DARWIN = -arch i386
164AM_CFLAGS_X86_DARWIN = $(WERROR) -arch i386 $(AM_CFLAGS_BASE) \
165 -mmacosx-version-min=10.5 -fno-stack-protector \
166 -mdynamic-no-pic
167AM_CCASFLAGS_X86_DARWIN = $(AM_CPPFLAGS_X86_DARWIN) -arch i386 -g
168
169AM_FLAG_M3264_AMD64_DARWIN = -arch x86_64
170AM_CFLAGS_AMD64_DARWIN = $(WERROR) -arch x86_64 $(AM_CFLAGS_BASE) \
171 -mmacosx-version-min=10.5 -fno-stack-protector
172AM_CCASFLAGS_AMD64_DARWIN = $(AM_CPPFLAGS_AMD64_DARWIN) -arch x86_64 -g
173
174# Flags for the primary target. These must be used to build the
175# regtests and performance tests. In fact, these must be used to
176# build anything which is built only once on a dual-arch build.
177#
178AM_FLAG_M3264_PRI = $(AM_FLAG_M3264_@VGCONF_PLATFORM_PRI_CAPS@)
179AM_CPPFLAGS_PRI = $(AM_CPPFLAGS_@VGCONF_PLATFORM_PRI_CAPS@)
180AM_CFLAGS_PRI = $(AM_CFLAGS_@VGCONF_PLATFORM_PRI_CAPS@)
181AM_CCASFLAGS_PRI = $(AM_CCASFLAGS_@VGCONF_PLATFORM_PRI_CAPS@)
182
183if VGCONF_HAVE_PLATFORM_SEC
184 AM_FLAG_M3264_SEC = $(AM_FLAG_M3264_@VGCONF_PLATFORM_SEC_CAPS@)
185else
186 AM_FLAG_M3264_SEC =
187endif
188
189
190# Baseline link flags for making vgpreload shared objects.
191#
192PRELOAD_LDFLAGS_COMMON_LINUX = -nodefaultlibs -shared -Wl,-z,interpose,-z,initfirst
193PRELOAD_LDFLAGS_COMMON_AIX5 = -nodefaultlibs -shared -Wl,-G -Wl,-bnogc
194PRELOAD_LDFLAGS_COMMON_DARWIN = -dynamic -dynamiclib -all_load
195
196PRELOAD_LDFLAGS_X86_LINUX = $(PRELOAD_LDFLAGS_COMMON_LINUX) @FLAG_M32@
197PRELOAD_LDFLAGS_AMD64_LINUX = $(PRELOAD_LDFLAGS_COMMON_LINUX) @FLAG_M64@
198PRELOAD_LDFLAGS_PPC32_LINUX = $(PRELOAD_LDFLAGS_COMMON_LINUX) @FLAG_M32@
199PRELOAD_LDFLAGS_PPC64_LINUX = $(PRELOAD_LDFLAGS_COMMON_LINUX) @FLAG_M64@
200PRELOAD_LDFLAGS_PPC32_AIX5 = $(PRELOAD_LDFLAGS_COMMON_AIX5) @FLAG_MAIX32@
201PRELOAD_LDFLAGS_PPC64_AIX5 = $(PRELOAD_LDFLAGS_COMMON_AIX5) @FLAG_MAIX64@
202PRELOAD_LDFLAGS_X86_DARWIN = $(PRELOAD_LDFLAGS_COMMON_DARWIN) -arch i386
203PRELOAD_LDFLAGS_AMD64_DARWIN = $(PRELOAD_LDFLAGS_COMMON_DARWIN) -arch x86_64
sewardjf5cc6b32005-11-11 18:35:32 +0000204