blob: f7dd59b0261467093143a465a1a499b14d7aa481 [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 = \
njn44e13682005-05-10 04:56:56 +00005 m_demangle \
njn2521d322005-05-08 14:45:13 +00006 m_aspacemgr \
njn717cde52005-05-10 02:47:21 +00007 m_replacemalloc \
njn2521d322005-05-08 14:45:13 +00008 m_sigframe \
9 m_syscalls
10
njna5f1bcd2004-11-27 16:47:42 +000011## When building, we are only interested in the current arch/OS/platform.
12## But when doing 'make dist', we are interested in every arch/OS/platform.
13## That's what DIST_SUBDIRS specifies.
sewardj985fabb2005-04-24 14:18:14 +000014SUBDIRS = \
njn2521d322005-05-08 14:45:13 +000015 $(VG_ARCH) $(VG_OS) $(VG_PLATFORM) \
16 $(MODULES) .
sewardj985fabb2005-04-24 14:18:14 +000017
18DIST_SUBDIRS = \
19 $(VG_ARCH_ALL) $(VG_OS_ALL) $(VG_PLATFORM_ALL) \
njn2521d322005-05-08 14:45:13 +000020 $(MODULES) .
sewardjde4a1d02002-03-22 01:27:54 +000021
njn44e13682005-05-10 04:56:56 +000022AM_CPPFLAGS += -DVG_LIBDIR="\"$(valdir)"\" \
sewardjbc7df202005-05-02 10:25:34 +000023 -DKICKSTART_BASE=@KICKSTART_BASE@
24
sewardjb5f6f512005-03-10 23:59:00 +000025AM_CFLAGS = $(WERROR) -Wmissing-prototypes -Winline -Wall -Wshadow -O -g @ARCH_CORE_AM_CFLAGS@
sewardj2a99cf62004-11-24 10:44:19 +000026AM_CFLAGS += -fno-omit-frame-pointer
gobry3b777892002-04-04 09:18:39 +000027
28default.supp: $(SUPP_FILES)
sewardjde4a1d02002-03-22 01:27:54 +000029
fitzhardinge98abfc72003-12-16 02:05:15 +000030bin_PROGRAMS = \
31 valgrind
32
njn25e49d8e72002-09-23 09:36:25 +000033val_PROGRAMS = \
nethercote5f2ad772004-09-01 11:33:35 +000034 stage2 \
fitzhardinge98abfc72003-12-16 02:05:15 +000035 vg_inject.so
njn25cac76cb2002-09-23 11:21:57 +000036
nethercote799fb802004-10-20 18:40:40 +000037noinst_HEADERS = \
38 core.h \
39 core_asm.h \
njn2521d322005-05-08 14:45:13 +000040 pub_core_aspacemgr.h \
41 pub_core_debuglog.h \
njn44e13682005-05-10 04:56:56 +000042 pub_core_demangle.h \
njnd2b17112005-04-19 04:10:25 +000043 pub_core_errormgr.h \
njnd01fef72005-03-25 23:35:48 +000044 pub_core_execontext.h \
njn717cde52005-05-10 02:47:21 +000045 pub_core_mallocfree.h \
46 pub_core_replacemalloc.h\
sewardj1cf558c2005-04-25 01:36:56 +000047 pub_core_sigframe.h \
njn2521d322005-05-08 14:45:13 +000048 pub_core_stacktrace.h \
49 pub_core_syscalls.h \
njn43b9a8a2005-05-10 04:37:01 +000050 pub_core_tooliface.h \
nethercote799fb802004-10-20 18:40:40 +000051 ume.h \
52 vg_symtab2.h \
njn51d827b2005-05-09 01:02:08 +000053 vg_symtypes.h
nethercote799fb802004-10-20 18:40:40 +000054
fitzhardinge98abfc72003-12-16 02:05:15 +000055EXTRA_DIST = \
sewardjb5f6f512005-03-10 23:59:00 +000056 valgrind.vs \
njn51d827b2005-05-09 01:02:08 +000057 README_MODULES.txt
sewardjde4a1d02002-03-22 01:27:54 +000058
fitzhardinge98abfc72003-12-16 02:05:15 +000059valgrind_SOURCES = \
fitzhardinge98abfc72003-12-16 02:05:15 +000060 ume.c \
nethercote107e1c02004-10-13 17:55:31 +000061 \
62 stage1.c \
sewardj1cf558c2005-04-25 01:36:56 +000063 m_debuglog.c \
nethercote107e1c02004-10-13 17:55:31 +000064 ${VG_ARCH}/jmp_with_stack.c
fitzhardinge98abfc72003-12-16 02:05:15 +000065valgrind_DEPENDENCIES =
nethercotec25c4492004-10-18 11:52:17 +000066valgrind_LDFLAGS=-static -g
fitzhardinge98abfc72003-12-16 02:05:15 +000067valgrind_LDADD=
sewardjde4a1d02002-03-22 01:27:54 +000068
fitzhardinge98abfc72003-12-16 02:05:15 +000069stage2_SOURCES = \
njn43b9a8a2005-05-10 04:37:01 +000070 m_debuglog.c \
sewardj267100d2005-04-24 12:33:12 +000071 m_errormgr.c \
72 m_execontext.c \
njn717cde52005-05-10 02:47:21 +000073 m_mallocfree.c \
sewardj267100d2005-04-24 12:33:12 +000074 m_stacktrace.c \
njn43b9a8a2005-05-10 04:37:01 +000075 m_tooliface.c \
fitzhardinge98abfc72003-12-16 02:05:15 +000076 ume.c \
fitzhardinge98abfc72003-12-16 02:05:15 +000077 \
sewardj2e93c502002-04-12 11:12:52 +000078 vg_scheduler.c \
njn3e884182003-04-15 13:03:23 +000079 vg_hashtable.c \
sewardjde4a1d02002-03-22 01:27:54 +000080 vg_main.c \
sewardjde4a1d02002-03-22 01:27:54 +000081 vg_messages.c \
82 vg_mylibc.c \
njn25e49d8e72002-09-23 09:36:25 +000083 vg_dummy_profile.c \
sewardjde4a1d02002-03-22 01:27:54 +000084 vg_signals.c \
sewardjde4a1d02002-03-22 01:27:54 +000085 vg_symtab2.c \
sewardjb5f6f512005-03-10 23:59:00 +000086 vg_threadmodel.c \
87 vg_pthreadmodel.c \
88 vg_redir.c \
njn7ea9adc2003-10-18 13:58:44 +000089 vg_dwarf.c \
90 vg_stabs.c \
fitzhardinge98abfc72003-12-16 02:05:15 +000091 vg_skiplist.c \
jsgfcb1d1c02003-10-14 21:55:10 +000092 vg_symtypes.c \
sewardjde4a1d02002-03-22 01:27:54 +000093 vg_translate.c \
nethercote986202f2004-10-19 13:48:06 +000094 vg_transtab.c
nethercoteb77dee62004-11-16 17:13:24 +000095
nethercote8ff888f2004-11-17 17:11:45 +000096## libplatform.a must be before libarch.a and libos.a, it seems.
nethercoteb77dee62004-11-16 17:13:24 +000097stage2_extra= \
njn44e13682005-05-10 04:56:56 +000098 m_demangle/libdemangle.a \
sewardj55f9d1a2005-04-25 11:11:44 +000099 m_aspacemgr/libaspacemgr.a \
njn2521d322005-05-08 14:45:13 +0000100 m_sigframe/libsigframe.a \
101 m_syscalls/libsyscalls.a \
nethercote8ff888f2004-11-17 17:11:45 +0000102 ${VG_PLATFORM}/libplatform.a \
nethercoteb77dee62004-11-16 17:13:24 +0000103 ${VG_ARCH}/libarch.a \
sewardj8b635a42004-11-22 19:01:47 +0000104 ${VG_OS}/libos.a \
105 @VEX_DIR@/libvex.a
nethercoteb77dee62004-11-16 17:13:24 +0000106
njn717cde52005-05-10 02:47:21 +0000107## These ones must be linked in with the --whole-archive flag, because they
108## wouldn't get pulled into stage otherwise (because they contain symbols
109## only referred to by tool shared objects).
110stage2_extra2 = \
111 m_replacemalloc/libreplacemalloc_core.a
112
113## Nb: older versions of automake don't seem to like having += within an
114## if-then-else, so we have to use these variables for the common parts.
115st2_DEPS_common = \
116 $(srcdir)/valgrind.vs \
117 $(stage2_extra) \
118 $(stage2_extra2)
119
120st2_LDFLAGS_common = \
121 -Wl,--export-dynamic -g \
122 -Wl,-version-script $(srcdir)/valgrind.vs
123
nethercotef8fbaaa2004-10-25 17:59:43 +0000124if USE_PIE
125stage2_CFLAGS = $(AM_CFLAGS) -fpie
njn717cde52005-05-10 02:47:21 +0000126stage2_DEPENDENCIES = $(st2_DEPS_common)
127stage2_LDFLAGS = \
128 $(st2_LDFLAGS_common) \
129 -Wl,--whole-archive $(stage2_extra2) -Wl,--no-whole-archive \
nethercotec69863e2004-10-25 19:13:41 +0000130 -pie
nethercote7f390022004-10-25 17:18:24 +0000131else
132stage2_CFLAGS = $(AM_CFLAGS)
njn717cde52005-05-10 02:47:21 +0000133stage2_DEPENDENCIES = $(st2_DEPS_common) ${VG_ARCH}/stage2.lds
134stage2_LDFLAGS = \
135 $(st2_LDFLAGS_common) \
136 -Wl,--whole-archive $(stage2_extra2) -Wl,--no-whole-archive \
nethercotec69863e2004-10-25 19:13:41 +0000137 -Wl,-defsym,kickstart_base=@KICKSTART_BASE@ -Wl,-T,${VG_ARCH}/stage2.lds
nethercote7f390022004-10-25 17:18:24 +0000138endif
nethercotec69863e2004-10-25 19:13:41 +0000139
njn717cde52005-05-10 02:47:21 +0000140stage2_LDADD= $(stage2_extra) \
141 -ldl
sewardjde4a1d02002-03-22 01:27:54 +0000142
sewardjb5f6f512005-03-10 23:59:00 +0000143vg_inject_so_SOURCES = vg_intercept.c
nethercote799fb802004-10-20 18:40:40 +0000144vg_inject_so_CFLAGS = $(AM_CFLAGS) -fpic
sewardjb5f6f512005-03-10 23:59:00 +0000145vg_inject_so_LDADD = -ldl
fitzhardinge98abfc72003-12-16 02:05:15 +0000146vg_inject_so_LDFLAGS = \
147 -shared \
148 -Wl,--soname,vg_inject.so \
149 -Wl,-z,initfirst
njn3e884182003-04-15 13:03:23 +0000150
sewardjb5f6f512005-03-10 23:59:00 +0000151MANUAL_DEPS = $(noinst_HEADERS) $(include_HEADERS)
sewardj71889e62002-05-10 03:03:57 +0000152
daywalker781132b2003-06-01 20:05:08 +0000153all-local:
fitzhardinge98abfc72003-12-16 02:05:15 +0000154 mkdir -p $(inplacedir)
155 for i in $(val_PROGRAMS); do \
sewardjb5f6f512005-03-10 23:59:00 +0000156 to=$(inplacedir)/$$i; \
fitzhardinge98abfc72003-12-16 02:05:15 +0000157 rm -f $$$to; \
nethercote03b19482004-08-25 11:57:21 +0000158 ln -sf ../$(subdir)/$$i $$to; \
fitzhardinge98abfc72003-12-16 02:05:15 +0000159 done
160