nethercote | 4388a40 | 2004-09-01 23:20:49 +0000 | [diff] [blame] | 1 | include $(top_srcdir)/Makefile.all.am |
| 2 | include $(top_srcdir)/Makefile.core-AM_CPPFLAGS.am |
njn25 | e49d8e7 | 2002-09-23 09:36:25 +0000 | [diff] [blame] | 3 | |
njn | 2521d32 | 2005-05-08 14:45:13 +0000 | [diff] [blame] | 4 | MODULES = \ |
njn | 2521d32 | 2005-05-08 14:45:13 +0000 | [diff] [blame] | 5 | m_aspacemgr \ |
njn | ea27e46 | 2005-05-31 02:38:09 +0000 | [diff] [blame] | 6 | m_debuginfo \ |
njn | 36b66df | 2005-05-12 05:13:04 +0000 | [diff] [blame] | 7 | m_demangle \ |
| 8 | m_dispatch \ |
njn | 717cde5 | 2005-05-10 02:47:21 +0000 | [diff] [blame] | 9 | m_replacemalloc \ |
njn | 278b3d6 | 2005-05-30 23:20:51 +0000 | [diff] [blame] | 10 | m_scheduler \ |
njn | 2521d32 | 2005-05-08 14:45:13 +0000 | [diff] [blame] | 11 | m_sigframe \ |
njn | 8a4eeaf | 2005-06-17 22:27:21 +0000 | [diff] [blame] | 12 | m_syswrap |
njn | 2521d32 | 2005-05-08 14:45:13 +0000 | [diff] [blame] | 13 | |
njn | a5f1bcd | 2004-11-27 16:47:42 +0000 | [diff] [blame] | 14 | ## When building, we are only interested in the current arch/OS/platform. |
| 15 | ## But when doing 'make dist', we are interested in every arch/OS/platform. |
| 16 | ## That's what DIST_SUBDIRS specifies. |
sewardj | 985fabb | 2005-04-24 14:18:14 +0000 | [diff] [blame] | 17 | SUBDIRS = \ |
njn | 7b85dd5 | 2005-06-12 17:26:29 +0000 | [diff] [blame] | 18 | $(VG_ARCH) \ |
njn | 2521d32 | 2005-05-08 14:45:13 +0000 | [diff] [blame] | 19 | $(MODULES) . |
sewardj | 985fabb | 2005-04-24 14:18:14 +0000 | [diff] [blame] | 20 | |
| 21 | DIST_SUBDIRS = \ |
njn | 7b85dd5 | 2005-06-12 17:26:29 +0000 | [diff] [blame] | 22 | $(VG_ARCH_ALL) \ |
njn | 2521d32 | 2005-05-08 14:45:13 +0000 | [diff] [blame] | 23 | $(MODULES) . |
sewardj | de4a1d0 | 2002-03-22 01:27:54 +0000 | [diff] [blame] | 24 | |
njn | 44e1368 | 2005-05-10 04:56:56 +0000 | [diff] [blame] | 25 | AM_CPPFLAGS += -DVG_LIBDIR="\"$(valdir)"\" \ |
sewardj | bc7df20 | 2005-05-02 10:25:34 +0000 | [diff] [blame] | 26 | -DKICKSTART_BASE=@KICKSTART_BASE@ |
| 27 | |
gobry | 3b77789 | 2002-04-04 09:18:39 +0000 | [diff] [blame] | 28 | default.supp: $(SUPP_FILES) |
sewardj | de4a1d0 | 2002-03-22 01:27:54 +0000 | [diff] [blame] | 29 | |
fitzhardinge | 98abfc7 | 2003-12-16 02:05:15 +0000 | [diff] [blame] | 30 | bin_PROGRAMS = \ |
| 31 | valgrind |
| 32 | |
njn25 | e49d8e7 | 2002-09-23 09:36:25 +0000 | [diff] [blame] | 33 | val_PROGRAMS = \ |
nethercote | 5f2ad77 | 2004-09-01 11:33:35 +0000 | [diff] [blame] | 34 | stage2 \ |
njn | 16eeb4e | 2005-06-16 03:56:58 +0000 | [diff] [blame] | 35 | vg_preload_core.so |
njn25 | cac76cb | 2002-09-23 11:21:57 +0000 | [diff] [blame] | 36 | |
nethercote | 799fb80 | 2004-10-20 18:40:40 +0000 | [diff] [blame] | 37 | noinst_HEADERS = \ |
| 38 | core.h \ |
njn | 1277109 | 2005-06-18 02:18:04 +0000 | [diff] [blame] | 39 | coregrind.h \ |
njn | 2521d32 | 2005-05-08 14:45:13 +0000 | [diff] [blame] | 40 | pub_core_aspacemgr.h \ |
njn | ea27e46 | 2005-05-31 02:38:09 +0000 | [diff] [blame] | 41 | pub_core_debuginfo.h \ |
njn | 2521d32 | 2005-05-08 14:45:13 +0000 | [diff] [blame] | 42 | pub_core_debuglog.h \ |
njn | 44e1368 | 2005-05-10 04:56:56 +0000 | [diff] [blame] | 43 | pub_core_demangle.h \ |
njn | 36b66df | 2005-05-12 05:13:04 +0000 | [diff] [blame] | 44 | pub_core_dispatch.h \ |
njn | a733b5f | 2005-05-12 13:15:38 +0000 | [diff] [blame] | 45 | pub_core_dispatch_asm.h \ |
njn | d2b1711 | 2005-04-19 04:10:25 +0000 | [diff] [blame] | 46 | pub_core_errormgr.h \ |
njn | d01fef7 | 2005-03-25 23:35:48 +0000 | [diff] [blame] | 47 | pub_core_execontext.h \ |
njn | 81c00df | 2005-05-14 21:28:43 +0000 | [diff] [blame] | 48 | pub_core_hashtable.h \ |
njn | 97405b2 | 2005-06-02 03:39:33 +0000 | [diff] [blame] | 49 | pub_core_libcbase.h \ |
njn | 132bfcc | 2005-06-04 19:16:06 +0000 | [diff] [blame] | 50 | pub_core_libcassert.h \ |
njn | eb8896b | 2005-06-04 20:03:55 +0000 | [diff] [blame] | 51 | pub_core_libcfile.h \ |
njn | e9befc6 | 2005-06-11 15:51:30 +0000 | [diff] [blame] | 52 | pub_core_libcmman.h \ |
njn | 36a20fa | 2005-06-03 03:08:39 +0000 | [diff] [blame] | 53 | pub_core_libcprint.h \ |
njn | f39e9a3 | 2005-06-12 02:43:17 +0000 | [diff] [blame] | 54 | pub_core_libcproc.h \ |
njn | de62cbf | 2005-06-10 22:08:14 +0000 | [diff] [blame] | 55 | pub_core_libcsignal.h \ |
njn | f536bbb | 2005-06-13 04:21:38 +0000 | [diff] [blame] | 56 | pub_core_machine.h \ |
njn | 04e1698 | 2005-05-31 00:23:43 +0000 | [diff] [blame] | 57 | pub_core_main.h \ |
njn | 717cde5 | 2005-05-10 02:47:21 +0000 | [diff] [blame] | 58 | pub_core_mallocfree.h \ |
njn | 2024234 | 2005-05-16 23:31:24 +0000 | [diff] [blame] | 59 | pub_core_options.h \ |
njn | 31513b4 | 2005-06-01 03:09:59 +0000 | [diff] [blame] | 60 | pub_core_profile.h \ |
njn | 984a636 | 2005-06-11 01:07:00 +0000 | [diff] [blame] | 61 | pub_core_pthreadmodel.h \ |
njn | d1af003 | 2005-05-29 17:01:48 +0000 | [diff] [blame] | 62 | pub_core_redir.h \ |
njn | 717cde5 | 2005-05-10 02:47:21 +0000 | [diff] [blame] | 63 | pub_core_replacemalloc.h\ |
njn | 278b3d6 | 2005-05-30 23:20:51 +0000 | [diff] [blame] | 64 | pub_core_scheduler.h \ |
sewardj | 1cf558c | 2005-04-25 01:36:56 +0000 | [diff] [blame] | 65 | pub_core_sigframe.h \ |
njn | 0c24647 | 2005-05-31 01:00:08 +0000 | [diff] [blame] | 66 | pub_core_signals.h \ |
njn | 641d5cc | 2005-05-12 04:37:27 +0000 | [diff] [blame] | 67 | pub_core_skiplist.h \ |
njn | 2521d32 | 2005-05-08 14:45:13 +0000 | [diff] [blame] | 68 | pub_core_stacktrace.h \ |
njn | c1b0181 | 2005-06-17 22:19:06 +0000 | [diff] [blame] | 69 | pub_core_syswrap.h \ |
njn | 984a636 | 2005-06-11 01:07:00 +0000 | [diff] [blame] | 70 | pub_core_threadmodel.h \ |
njn | 43b9a8a | 2005-05-10 04:37:01 +0000 | [diff] [blame] | 71 | pub_core_tooliface.h \ |
njn | a7598f6 | 2005-06-18 03:27:58 +0000 | [diff] [blame] | 72 | pub_core_trampoline.h \ |
njn | cf44351 | 2005-05-13 23:14:40 +0000 | [diff] [blame] | 73 | pub_core_translate.h \ |
njn | 8bddf58 | 2005-05-13 23:40:55 +0000 | [diff] [blame] | 74 | pub_core_transtab.h \ |
njn | 2e8f4ef | 2005-05-14 21:44:20 +0000 | [diff] [blame] | 75 | pub_core_transtab_asm.h \ |
nethercote | 799fb80 | 2004-10-20 18:40:40 +0000 | [diff] [blame] | 76 | ume.h \ |
njn | 31ebb9a | 2005-05-29 23:30:48 +0000 | [diff] [blame] | 77 | vki_unistd.h \ |
| 78 | vki_unistd-amd64-linux.h\ |
| 79 | vki_unistd-arm-linux.h \ |
| 80 | vki_unistd-x86-linux.h |
nethercote | 799fb80 | 2004-10-20 18:40:40 +0000 | [diff] [blame] | 81 | |
fitzhardinge | 98abfc7 | 2003-12-16 02:05:15 +0000 | [diff] [blame] | 82 | EXTRA_DIST = \ |
sewardj | b5f6f51 | 2005-03-10 23:59:00 +0000 | [diff] [blame] | 83 | valgrind.vs \ |
njn | 51d827b | 2005-05-09 01:02:08 +0000 | [diff] [blame] | 84 | README_MODULES.txt |
sewardj | de4a1d0 | 2002-03-22 01:27:54 +0000 | [diff] [blame] | 85 | |
njn | 4986dbf | 2005-06-18 16:41:30 +0000 | [diff] [blame^] | 86 | BUILT_SOURCES = stage2.lds |
| 87 | CLEANFILES = stage2.lds |
| 88 | |
fitzhardinge | 98abfc7 | 2003-12-16 02:05:15 +0000 | [diff] [blame] | 89 | valgrind_SOURCES = \ |
fitzhardinge | 98abfc7 | 2003-12-16 02:05:15 +0000 | [diff] [blame] | 90 | ume.c \ |
nethercote | 107e1c0 | 2004-10-13 17:55:31 +0000 | [diff] [blame] | 91 | \ |
| 92 | stage1.c \ |
njn | fcb7c3e | 2005-06-18 15:54:25 +0000 | [diff] [blame] | 93 | m_debuglog.c |
fitzhardinge | 98abfc7 | 2003-12-16 02:05:15 +0000 | [diff] [blame] | 94 | valgrind_DEPENDENCIES = |
nethercote | c25c449 | 2004-10-18 11:52:17 +0000 | [diff] [blame] | 95 | valgrind_LDFLAGS=-static -g |
fitzhardinge | 98abfc7 | 2003-12-16 02:05:15 +0000 | [diff] [blame] | 96 | valgrind_LDADD= |
sewardj | de4a1d0 | 2002-03-22 01:27:54 +0000 | [diff] [blame] | 97 | |
fitzhardinge | 98abfc7 | 2003-12-16 02:05:15 +0000 | [diff] [blame] | 98 | stage2_SOURCES = \ |
njn | 43b9a8a | 2005-05-10 04:37:01 +0000 | [diff] [blame] | 99 | m_debuglog.c \ |
sewardj | 267100d | 2005-04-24 12:33:12 +0000 | [diff] [blame] | 100 | m_errormgr.c \ |
| 101 | m_execontext.c \ |
njn | 81c00df | 2005-05-14 21:28:43 +0000 | [diff] [blame] | 102 | m_hashtable.c \ |
njn | 97405b2 | 2005-06-02 03:39:33 +0000 | [diff] [blame] | 103 | m_libcbase.c \ |
njn | 132bfcc | 2005-06-04 19:16:06 +0000 | [diff] [blame] | 104 | m_libcassert.c \ |
njn | eb8896b | 2005-06-04 20:03:55 +0000 | [diff] [blame] | 105 | m_libcfile.c \ |
njn | e9befc6 | 2005-06-11 15:51:30 +0000 | [diff] [blame] | 106 | m_libcmman.c \ |
njn | 36a20fa | 2005-06-03 03:08:39 +0000 | [diff] [blame] | 107 | m_libcprint.c \ |
njn | f39e9a3 | 2005-06-12 02:43:17 +0000 | [diff] [blame] | 108 | m_libcproc.c \ |
njn | de62cbf | 2005-06-10 22:08:14 +0000 | [diff] [blame] | 109 | m_libcsignal.c \ |
njn | f536bbb | 2005-06-13 04:21:38 +0000 | [diff] [blame] | 110 | m_machine.c \ |
njn | 04e1698 | 2005-05-31 00:23:43 +0000 | [diff] [blame] | 111 | m_main.c \ |
njn | 717cde5 | 2005-05-10 02:47:21 +0000 | [diff] [blame] | 112 | m_mallocfree.c \ |
njn | 2024234 | 2005-05-16 23:31:24 +0000 | [diff] [blame] | 113 | m_options.c \ |
njn | 31513b4 | 2005-06-01 03:09:59 +0000 | [diff] [blame] | 114 | m_profile.c \ |
njn | 984a636 | 2005-06-11 01:07:00 +0000 | [diff] [blame] | 115 | m_pthreadmodel.c \ |
njn | d1af003 | 2005-05-29 17:01:48 +0000 | [diff] [blame] | 116 | m_redir.c \ |
njn | 0c24647 | 2005-05-31 01:00:08 +0000 | [diff] [blame] | 117 | m_signals.c \ |
njn | 641d5cc | 2005-05-12 04:37:27 +0000 | [diff] [blame] | 118 | m_skiplist.c \ |
sewardj | 267100d | 2005-04-24 12:33:12 +0000 | [diff] [blame] | 119 | m_stacktrace.c \ |
njn | 9abd608 | 2005-06-17 21:31:45 +0000 | [diff] [blame] | 120 | m_syscall.c \ |
njn | 984a636 | 2005-06-11 01:07:00 +0000 | [diff] [blame] | 121 | m_threadmodel.c \ |
njn | 43b9a8a | 2005-05-10 04:37:01 +0000 | [diff] [blame] | 122 | m_tooliface.c \ |
njn | a7598f6 | 2005-06-18 03:27:58 +0000 | [diff] [blame] | 123 | m_trampoline.S \ |
njn | 3cbfbc1 | 2005-05-13 23:11:40 +0000 | [diff] [blame] | 124 | m_translate.c \ |
njn | 8bddf58 | 2005-05-13 23:40:55 +0000 | [diff] [blame] | 125 | m_transtab.c \ |
fitzhardinge | 98abfc7 | 2003-12-16 02:05:15 +0000 | [diff] [blame] | 126 | \ |
njn | f39e9a3 | 2005-06-12 02:43:17 +0000 | [diff] [blame] | 127 | ume.c |
nethercote | b77dee6 | 2004-11-16 17:13:24 +0000 | [diff] [blame] | 128 | |
njn | 278b3d6 | 2005-05-30 23:20:51 +0000 | [diff] [blame] | 129 | ## Nb: libscheduler.a must precede libdispatch.a in this list. |
nethercote | b77dee6 | 2004-11-16 17:13:24 +0000 | [diff] [blame] | 130 | stage2_extra= \ |
njn | ea27e46 | 2005-05-31 02:38:09 +0000 | [diff] [blame] | 131 | m_debuginfo/libdebuginfo.a \ |
| 132 | m_demangle/libdemangle.a \ |
njn | 278b3d6 | 2005-05-30 23:20:51 +0000 | [diff] [blame] | 133 | m_scheduler/libscheduler.a \ |
njn | 36b66df | 2005-05-12 05:13:04 +0000 | [diff] [blame] | 134 | m_dispatch/libdispatch.a \ |
sewardj | 55f9d1a | 2005-04-25 11:11:44 +0000 | [diff] [blame] | 135 | m_aspacemgr/libaspacemgr.a \ |
njn | 2521d32 | 2005-05-08 14:45:13 +0000 | [diff] [blame] | 136 | m_sigframe/libsigframe.a \ |
njn | 8a4eeaf | 2005-06-17 22:27:21 +0000 | [diff] [blame] | 137 | m_syswrap/libsyswrap.a \ |
nethercote | b77dee6 | 2004-11-16 17:13:24 +0000 | [diff] [blame] | 138 | ${VG_ARCH}/libarch.a \ |
sewardj | 8b635a4 | 2004-11-22 19:01:47 +0000 | [diff] [blame] | 139 | @VEX_DIR@/libvex.a |
nethercote | b77dee6 | 2004-11-16 17:13:24 +0000 | [diff] [blame] | 140 | |
njn | 717cde5 | 2005-05-10 02:47:21 +0000 | [diff] [blame] | 141 | ## These ones must be linked in with the --whole-archive flag, because they |
| 142 | ## wouldn't get pulled into stage otherwise (because they contain symbols |
| 143 | ## only referred to by tool shared objects). |
| 144 | stage2_extra2 = \ |
| 145 | m_replacemalloc/libreplacemalloc_core.a |
tom | 7860441 | 2005-05-17 16:11:40 +0000 | [diff] [blame] | 146 | |
njn | 717cde5 | 2005-05-10 02:47:21 +0000 | [diff] [blame] | 147 | ## Nb: older versions of automake don't seem to like having += within an |
| 148 | ## if-then-else, so we have to use these variables for the common parts. |
| 149 | st2_DEPS_common = \ |
| 150 | $(srcdir)/valgrind.vs \ |
| 151 | $(stage2_extra) \ |
| 152 | $(stage2_extra2) |
| 153 | |
| 154 | st2_LDFLAGS_common = \ |
| 155 | -Wl,--export-dynamic -g \ |
| 156 | -Wl,-version-script $(srcdir)/valgrind.vs |
| 157 | |
nethercote | f8fbaaa | 2004-10-25 17:59:43 +0000 | [diff] [blame] | 158 | if USE_PIE |
njn | 717cde5 | 2005-05-10 02:47:21 +0000 | [diff] [blame] | 159 | stage2_DEPENDENCIES = $(st2_DEPS_common) |
| 160 | stage2_LDFLAGS = \ |
| 161 | $(st2_LDFLAGS_common) \ |
| 162 | -Wl,--whole-archive $(stage2_extra2) -Wl,--no-whole-archive \ |
nethercote | c69863e | 2004-10-25 19:13:41 +0000 | [diff] [blame] | 163 | -pie |
nethercote | 7f39002 | 2004-10-25 17:18:24 +0000 | [diff] [blame] | 164 | else |
njn | 4986dbf | 2005-06-18 16:41:30 +0000 | [diff] [blame^] | 165 | stage2_DEPENDENCIES = $(st2_DEPS_common) stage2.lds |
njn | 717cde5 | 2005-05-10 02:47:21 +0000 | [diff] [blame] | 166 | stage2_LDFLAGS = \ |
| 167 | $(st2_LDFLAGS_common) \ |
| 168 | -Wl,--whole-archive $(stage2_extra2) -Wl,--no-whole-archive \ |
njn | 4986dbf | 2005-06-18 16:41:30 +0000 | [diff] [blame^] | 169 | -Wl,-defsym,kickstart_base=@KICKSTART_BASE@ -Wl,-T,stage2.lds |
nethercote | 7f39002 | 2004-10-25 17:18:24 +0000 | [diff] [blame] | 170 | endif |
nethercote | c69863e | 2004-10-25 19:13:41 +0000 | [diff] [blame] | 171 | |
njn | 717cde5 | 2005-05-10 02:47:21 +0000 | [diff] [blame] | 172 | stage2_LDADD= $(stage2_extra) \ |
| 173 | -ldl |
sewardj | de4a1d0 | 2002-03-22 01:27:54 +0000 | [diff] [blame] | 174 | |
njn | 16eeb4e | 2005-06-16 03:56:58 +0000 | [diff] [blame] | 175 | vg_preload_core_so_SOURCES = vg_preloaded.c |
| 176 | vg_preload_core_so_CFLAGS = $(AM_CFLAGS) -fpic |
| 177 | vg_preload_core_so_LDADD = -ldl |
| 178 | vg_preload_core_so_LDFLAGS = \ |
fitzhardinge | 98abfc7 | 2003-12-16 02:05:15 +0000 | [diff] [blame] | 179 | -shared \ |
njn | 16eeb4e | 2005-06-16 03:56:58 +0000 | [diff] [blame] | 180 | -Wl,--soname,vg_preload_core.so \ |
fitzhardinge | 98abfc7 | 2003-12-16 02:05:15 +0000 | [diff] [blame] | 181 | -Wl,-z,initfirst |
njn | 3e88418 | 2003-04-15 13:03:23 +0000 | [diff] [blame] | 182 | |
njn | 4986dbf | 2005-06-18 16:41:30 +0000 | [diff] [blame^] | 183 | # Extract ld's default linker script and hack it to our needs. |
| 184 | # This relies on finding "executable_start" and replacing the address on |
| 185 | # that line with kickstart_base. |
| 186 | stage2.lds: Makefile |
| 187 | $(CC) -Wl,--verbose -nostdlib 2>&1 | sed \ |
| 188 | -e '1,/^=====\+$$/d' \ |
| 189 | -e '/^=====\+$$/d' \ |
| 190 | -e '/executable_start/s/0x[0-9A-Fa-f]\+/kickstart_base/g' > $@ \ |
| 191 | || rm -f $@ |
| 192 | |
sewardj | b5f6f51 | 2005-03-10 23:59:00 +0000 | [diff] [blame] | 193 | MANUAL_DEPS = $(noinst_HEADERS) $(include_HEADERS) |
sewardj | 71889e6 | 2002-05-10 03:03:57 +0000 | [diff] [blame] | 194 | |
daywalker | 781132b | 2003-06-01 20:05:08 +0000 | [diff] [blame] | 195 | all-local: |
fitzhardinge | 98abfc7 | 2003-12-16 02:05:15 +0000 | [diff] [blame] | 196 | mkdir -p $(inplacedir) |
| 197 | for i in $(val_PROGRAMS); do \ |
sewardj | b5f6f51 | 2005-03-10 23:59:00 +0000 | [diff] [blame] | 198 | to=$(inplacedir)/$$i; \ |
fitzhardinge | 98abfc7 | 2003-12-16 02:05:15 +0000 | [diff] [blame] | 199 | rm -f $$$to; \ |
nethercote | 03b1948 | 2004-08-25 11:57:21 +0000 | [diff] [blame] | 200 | ln -sf ../$(subdir)/$$i $$to; \ |
fitzhardinge | 98abfc7 | 2003-12-16 02:05:15 +0000 | [diff] [blame] | 201 | done |
| 202 | |