blob: ed1a206edca173ddf2ad27265842047d7d0e35c1 [file] [log] [blame]
nethercote4388a402004-09-01 23:20:49 +00001include $(top_srcdir)/Makefile.all.am
2include $(top_srcdir)/Makefile.core-AM_CPPFLAGS.am
njn25e49d8e72002-09-23 09:36:25 +00003
njn2521d322005-05-08 14:45:13 +00004MODULES = \
njn2521d322005-05-08 14:45:13 +00005 m_aspacemgr \
njn36b66df2005-05-12 05:13:04 +00006 m_demangle \
7 m_dispatch \
njn717cde52005-05-10 02:47:21 +00008 m_replacemalloc \
njn2521d322005-05-08 14:45:13 +00009 m_sigframe \
10 m_syscalls
11
njna5f1bcd2004-11-27 16:47:42 +000012## When building, we are only interested in the current arch/OS/platform.
13## But when doing 'make dist', we are interested in every arch/OS/platform.
14## That's what DIST_SUBDIRS specifies.
sewardj985fabb2005-04-24 14:18:14 +000015SUBDIRS = \
njn2521d322005-05-08 14:45:13 +000016 $(VG_ARCH) $(VG_OS) $(VG_PLATFORM) \
17 $(MODULES) .
sewardj985fabb2005-04-24 14:18:14 +000018
19DIST_SUBDIRS = \
20 $(VG_ARCH_ALL) $(VG_OS_ALL) $(VG_PLATFORM_ALL) \
njn2521d322005-05-08 14:45:13 +000021 $(MODULES) .
sewardjde4a1d02002-03-22 01:27:54 +000022
njn44e13682005-05-10 04:56:56 +000023AM_CPPFLAGS += -DVG_LIBDIR="\"$(valdir)"\" \
sewardjbc7df202005-05-02 10:25:34 +000024 -DKICKSTART_BASE=@KICKSTART_BASE@
25
sewardjb5f6f512005-03-10 23:59:00 +000026AM_CFLAGS = $(WERROR) -Wmissing-prototypes -Winline -Wall -Wshadow -O -g @ARCH_CORE_AM_CFLAGS@
sewardj2a99cf62004-11-24 10:44:19 +000027AM_CFLAGS += -fno-omit-frame-pointer
gobry3b777892002-04-04 09:18:39 +000028
29default.supp: $(SUPP_FILES)
sewardjde4a1d02002-03-22 01:27:54 +000030
fitzhardinge98abfc72003-12-16 02:05:15 +000031bin_PROGRAMS = \
32 valgrind
33
njn25e49d8e72002-09-23 09:36:25 +000034val_PROGRAMS = \
nethercote5f2ad772004-09-01 11:33:35 +000035 stage2 \
fitzhardinge98abfc72003-12-16 02:05:15 +000036 vg_inject.so
njn25cac76cb2002-09-23 11:21:57 +000037
nethercote799fb802004-10-20 18:40:40 +000038noinst_HEADERS = \
39 core.h \
njnf644a0b2005-05-14 21:51:49 +000040 core_asm.h \
njn2521d322005-05-08 14:45:13 +000041 pub_core_aspacemgr.h \
42 pub_core_debuglog.h \
njn44e13682005-05-10 04:56:56 +000043 pub_core_demangle.h \
njn36b66df2005-05-12 05:13:04 +000044 pub_core_dispatch.h \
njna733b5f2005-05-12 13:15:38 +000045 pub_core_dispatch_asm.h \
njnd2b17112005-04-19 04:10:25 +000046 pub_core_errormgr.h \
njnd01fef72005-03-25 23:35:48 +000047 pub_core_execontext.h \
njn81c00df2005-05-14 21:28:43 +000048 pub_core_hashtable.h \
njn717cde52005-05-10 02:47:21 +000049 pub_core_mallocfree.h \
njn20242342005-05-16 23:31:24 +000050 pub_core_options.h \
njn717cde52005-05-10 02:47:21 +000051 pub_core_replacemalloc.h\
sewardj1cf558c2005-04-25 01:36:56 +000052 pub_core_sigframe.h \
njn641d5cc2005-05-12 04:37:27 +000053 pub_core_skiplist.h \
njn2521d322005-05-08 14:45:13 +000054 pub_core_stacktrace.h \
55 pub_core_syscalls.h \
njn43b9a8a2005-05-10 04:37:01 +000056 pub_core_tooliface.h \
njncf443512005-05-13 23:14:40 +000057 pub_core_translate.h \
njn8bddf582005-05-13 23:40:55 +000058 pub_core_transtab.h \
njn2e8f4ef2005-05-14 21:44:20 +000059 pub_core_transtab_asm.h \
nethercote799fb802004-10-20 18:40:40 +000060 ume.h \
61 vg_symtab2.h \
njn51d827b2005-05-09 01:02:08 +000062 vg_symtypes.h
nethercote799fb802004-10-20 18:40:40 +000063
fitzhardinge98abfc72003-12-16 02:05:15 +000064EXTRA_DIST = \
sewardjb5f6f512005-03-10 23:59:00 +000065 valgrind.vs \
njn51d827b2005-05-09 01:02:08 +000066 README_MODULES.txt
sewardjde4a1d02002-03-22 01:27:54 +000067
fitzhardinge98abfc72003-12-16 02:05:15 +000068valgrind_SOURCES = \
fitzhardinge98abfc72003-12-16 02:05:15 +000069 ume.c \
nethercote107e1c02004-10-13 17:55:31 +000070 \
71 stage1.c \
sewardj1cf558c2005-04-25 01:36:56 +000072 m_debuglog.c \
nethercote107e1c02004-10-13 17:55:31 +000073 ${VG_ARCH}/jmp_with_stack.c
fitzhardinge98abfc72003-12-16 02:05:15 +000074valgrind_DEPENDENCIES =
nethercotec25c4492004-10-18 11:52:17 +000075valgrind_LDFLAGS=-static -g
fitzhardinge98abfc72003-12-16 02:05:15 +000076valgrind_LDADD=
sewardjde4a1d02002-03-22 01:27:54 +000077
fitzhardinge98abfc72003-12-16 02:05:15 +000078stage2_SOURCES = \
njn43b9a8a2005-05-10 04:37:01 +000079 m_debuglog.c \
sewardj267100d2005-04-24 12:33:12 +000080 m_errormgr.c \
81 m_execontext.c \
njn81c00df2005-05-14 21:28:43 +000082 m_hashtable.c \
njn717cde52005-05-10 02:47:21 +000083 m_mallocfree.c \
njn20242342005-05-16 23:31:24 +000084 m_options.c \
njn641d5cc2005-05-12 04:37:27 +000085 m_skiplist.c \
sewardj267100d2005-04-24 12:33:12 +000086 m_stacktrace.c \
njn43b9a8a2005-05-10 04:37:01 +000087 m_tooliface.c \
njn3cbfbc12005-05-13 23:11:40 +000088 m_translate.c \
njn8bddf582005-05-13 23:40:55 +000089 m_transtab.c \
fitzhardinge98abfc72003-12-16 02:05:15 +000090 ume.c \
fitzhardinge98abfc72003-12-16 02:05:15 +000091 \
sewardj2e93c502002-04-12 11:12:52 +000092 vg_scheduler.c \
sewardjde4a1d02002-03-22 01:27:54 +000093 vg_main.c \
sewardjde4a1d02002-03-22 01:27:54 +000094 vg_messages.c \
95 vg_mylibc.c \
njn25e49d8e72002-09-23 09:36:25 +000096 vg_dummy_profile.c \
sewardjde4a1d02002-03-22 01:27:54 +000097 vg_signals.c \
sewardjde4a1d02002-03-22 01:27:54 +000098 vg_symtab2.c \
sewardjb5f6f512005-03-10 23:59:00 +000099 vg_threadmodel.c \
100 vg_pthreadmodel.c \
101 vg_redir.c \
njn7ea9adc2003-10-18 13:58:44 +0000102 vg_dwarf.c \
103 vg_stabs.c \
njn8bddf582005-05-13 23:40:55 +0000104 vg_symtypes.c
nethercoteb77dee62004-11-16 17:13:24 +0000105
nethercote8ff888f2004-11-17 17:11:45 +0000106## libplatform.a must be before libarch.a and libos.a, it seems.
nethercoteb77dee62004-11-16 17:13:24 +0000107stage2_extra= \
njn36b66df2005-05-12 05:13:04 +0000108 m_dispatch/libdispatch.a \
njn44e13682005-05-10 04:56:56 +0000109 m_demangle/libdemangle.a \
sewardj55f9d1a2005-04-25 11:11:44 +0000110 m_aspacemgr/libaspacemgr.a \
njn2521d322005-05-08 14:45:13 +0000111 m_sigframe/libsigframe.a \
112 m_syscalls/libsyscalls.a \
nethercote8ff888f2004-11-17 17:11:45 +0000113 ${VG_PLATFORM}/libplatform.a \
nethercoteb77dee62004-11-16 17:13:24 +0000114 ${VG_ARCH}/libarch.a \
sewardj8b635a42004-11-22 19:01:47 +0000115 ${VG_OS}/libos.a \
116 @VEX_DIR@/libvex.a
nethercoteb77dee62004-11-16 17:13:24 +0000117
njn717cde52005-05-10 02:47:21 +0000118## These ones must be linked in with the --whole-archive flag, because they
119## wouldn't get pulled into stage otherwise (because they contain symbols
120## only referred to by tool shared objects).
121stage2_extra2 = \
122 m_replacemalloc/libreplacemalloc_core.a
123
124## Nb: older versions of automake don't seem to like having += within an
125## if-then-else, so we have to use these variables for the common parts.
126st2_DEPS_common = \
127 $(srcdir)/valgrind.vs \
128 $(stage2_extra) \
129 $(stage2_extra2)
130
131st2_LDFLAGS_common = \
132 -Wl,--export-dynamic -g \
133 -Wl,-version-script $(srcdir)/valgrind.vs
134
nethercotef8fbaaa2004-10-25 17:59:43 +0000135if USE_PIE
136stage2_CFLAGS = $(AM_CFLAGS) -fpie
njn717cde52005-05-10 02:47:21 +0000137stage2_DEPENDENCIES = $(st2_DEPS_common)
138stage2_LDFLAGS = \
139 $(st2_LDFLAGS_common) \
140 -Wl,--whole-archive $(stage2_extra2) -Wl,--no-whole-archive \
nethercotec69863e2004-10-25 19:13:41 +0000141 -pie
nethercote7f390022004-10-25 17:18:24 +0000142else
143stage2_CFLAGS = $(AM_CFLAGS)
njn717cde52005-05-10 02:47:21 +0000144stage2_DEPENDENCIES = $(st2_DEPS_common) ${VG_ARCH}/stage2.lds
145stage2_LDFLAGS = \
146 $(st2_LDFLAGS_common) \
147 -Wl,--whole-archive $(stage2_extra2) -Wl,--no-whole-archive \
nethercotec69863e2004-10-25 19:13:41 +0000148 -Wl,-defsym,kickstart_base=@KICKSTART_BASE@ -Wl,-T,${VG_ARCH}/stage2.lds
nethercote7f390022004-10-25 17:18:24 +0000149endif
nethercotec69863e2004-10-25 19:13:41 +0000150
njn717cde52005-05-10 02:47:21 +0000151stage2_LDADD= $(stage2_extra) \
152 -ldl
sewardjde4a1d02002-03-22 01:27:54 +0000153
sewardjb5f6f512005-03-10 23:59:00 +0000154vg_inject_so_SOURCES = vg_intercept.c
nethercote799fb802004-10-20 18:40:40 +0000155vg_inject_so_CFLAGS = $(AM_CFLAGS) -fpic
sewardjb5f6f512005-03-10 23:59:00 +0000156vg_inject_so_LDADD = -ldl
fitzhardinge98abfc72003-12-16 02:05:15 +0000157vg_inject_so_LDFLAGS = \
158 -shared \
159 -Wl,--soname,vg_inject.so \
160 -Wl,-z,initfirst
njn3e884182003-04-15 13:03:23 +0000161
sewardjb5f6f512005-03-10 23:59:00 +0000162MANUAL_DEPS = $(noinst_HEADERS) $(include_HEADERS)
sewardj71889e62002-05-10 03:03:57 +0000163
daywalker781132b2003-06-01 20:05:08 +0000164all-local:
fitzhardinge98abfc72003-12-16 02:05:15 +0000165 mkdir -p $(inplacedir)
166 for i in $(val_PROGRAMS); do \
sewardjb5f6f512005-03-10 23:59:00 +0000167 to=$(inplacedir)/$$i; \
fitzhardinge98abfc72003-12-16 02:05:15 +0000168 rm -f $$$to; \
nethercote03b19482004-08-25 11:57:21 +0000169 ln -sf ../$(subdir)/$$i $$to; \
fitzhardinge98abfc72003-12-16 02:05:15 +0000170 done
171