Derek Schuff | bc64313 | 2014-05-22 16:39:25 -0700 | [diff] [blame] | 1 | # The following variables will likely need to be modified, depending on where |
| 2 | # and how you built LLVM & Clang. They can be overridden in a command-line |
| 3 | # invocation of make, like: |
| 4 | # |
Jim Stichnoth | 0a9e126 | 2015-04-21 09:59:21 -0700 | [diff] [blame] | 5 | # make LLVM_SRC_PATH=<path> LIBCXX_INSTALL_PATH=<path> CLANG_PATH=<path> \ |
Jan Voung | 44c3a80 | 2015-03-27 16:29:08 -0700 | [diff] [blame] | 6 | # PNACL_BIN_PATH=<path> ... |
Derek Schuff | bc64313 | 2014-05-22 16:39:25 -0700 | [diff] [blame] | 7 | # |
| 8 | |
| 9 | # LLVM_SRC_PATH is the path to the root of the checked out source code. This |
| 10 | # directory should contain the configure script, the include/ and lib/ |
| 11 | # directories of LLVM, Clang in tools/clang/, etc. |
| 12 | # Alternatively, if you're building vs. a binary download of LLVM, then |
| 13 | # LLVM_SRC_PATH can point to the main untarred directory. |
| 14 | LLVM_SRC_PATH ?= ../llvm |
| 15 | |
Jan Voung | 44c3a80 | 2015-03-27 16:29:08 -0700 | [diff] [blame] | 16 | # The x86-32-specific sandboxed translator directory. |
| 17 | # It holds sandboxed versions of libraries and binaries. |
| 18 | SB_LLVM_PATH ?= $(shell readlink -e \ |
Jim Stichnoth | 2e7de23 | 2015-11-02 08:25:57 -0800 | [diff] [blame] | 19 | ../../out/sandboxed_translators_work/translator-i686/llvm-sb/Release) |
Jan Voung | 44c3a80 | 2015-03-27 16:29:08 -0700 | [diff] [blame] | 20 | |
| 21 | # NACL_ROOT is the root of the native client repository. |
| 22 | NACL_ROOT ?= $(shell python -c "import sys; sys.path.insert(0, 'pydir'); \ |
Jim Stichnoth | 2e7de23 | 2015-11-02 08:25:57 -0800 | [diff] [blame] | 23 | import utils; print utils.FindBaseNaCl()") |
Jan Voung | 44c3a80 | 2015-03-27 16:29:08 -0700 | [diff] [blame] | 24 | |
Jan Voung | 8e32fed | 2015-06-17 10:16:23 -0700 | [diff] [blame] | 25 | # TOOLCHAIN_ROOT is the location of NaCl/PNaCl toolchains and other |
| 26 | # tools like qemu. |
| 27 | TOOLCHAIN_ROOT ?= $(shell readlink -e $(NACL_ROOT)/toolchain/linux_x86) |
| 28 | |
Jan Voung | 68a0633 | 2015-03-05 14:33:38 -0800 | [diff] [blame] | 29 | # PNACL_TOOLCHAIN_ROOT is the location of the PNaCl toolchain. |
| 30 | # This is used as the default root for finding binutils, libcxx, etc. |
Jan Voung | 8e32fed | 2015-06-17 10:16:23 -0700 | [diff] [blame] | 31 | PNACL_TOOLCHAIN_ROOT ?= $(shell readlink -e $(TOOLCHAIN_ROOT)/pnacl_newlib_raw) |
Jan Voung | 44c3a80 | 2015-03-27 16:29:08 -0700 | [diff] [blame] | 32 | |
| 33 | # The location of PNaCl tools (e.g., binutils objdump, pnacl-clang++, etc.). |
| 34 | PNACL_BIN_PATH ?= $(shell readlink -e $(PNACL_TOOLCHAIN_ROOT)/bin) |
Karl Schimpf | 8fcefc3 | 2014-09-15 12:56:50 -0700 | [diff] [blame] | 35 | |
Reed Kotler | 2c3c82e | 2016-01-21 20:33:08 -0800 | [diff] [blame] | 36 | # Allow tests to be overridden, e.g.: |
| 37 | # make -f Makefile.standalone check-lit \ |
| 38 | # CHECK_LIT_TESTS="tests_lit/llvm2ice_tests/{alloc,arith}.ll" |
| 39 | # make -f Makefile.standalone check-xtest \ |
| 40 | # CHECK_XTEST_TESTS=crosstest/Output/simple_loop_x8632_native_O2_sse2.xtest |
| 41 | CHECK_LIT_TESTS ?= tests_lit |
| 42 | CHECK_XTEST_TESTS ?= crosstest/Output |
| 43 | |
Jim Stichnoth | 0a9e126 | 2015-04-21 09:59:21 -0700 | [diff] [blame] | 44 | # Hack to auto-detect autoconf versus cmake build of LLVM. If the LLVM tools |
Jim Stichnoth | e5b58fb | 2015-06-01 15:17:20 -0700 | [diff] [blame] | 45 | # were dynamically linked with something like libLLVM-3.7svn.so, it is an |
Jim Stichnoth | 0a9e126 | 2015-04-21 09:59:21 -0700 | [diff] [blame] | 46 | # autoconf build, otherwise it is a cmake build. AUTOCONF is set to 0 for |
| 47 | # cmake, nonzero for autoconf. |
| 48 | AUTOCONF ?= $(shell ldd $(PNACL_BIN_PATH)/opt | grep -c libLLVM-) |
| 49 | |
Jan Voung | 68a0633 | 2015-03-05 14:33:38 -0800 | [diff] [blame] | 50 | # CLANG_PATH is the location of the clang compiler to use for building |
| 51 | # the host binaries. |
Karl Schimpf | 8fcefc3 | 2014-09-15 12:56:50 -0700 | [diff] [blame] | 52 | CLANG_PATH ?= $(shell readlink -e \ |
Jim Stichnoth | 2e7de23 | 2015-11-02 08:25:57 -0800 | [diff] [blame] | 53 | $(NACL_ROOT)/../third_party/llvm-build/Release+Asserts/bin) |
Karl Schimpf | 8fcefc3 | 2014-09-15 12:56:50 -0700 | [diff] [blame] | 54 | |
Jan Voung | 68a0633 | 2015-03-05 14:33:38 -0800 | [diff] [blame] | 55 | # LIBCXX_INSTALL_PATH is the directory where libc++ is located. It should |
| 56 | # contain header files and corresponding libraries. This is used for |
| 57 | # building the host binaries in conjuction with clang. |
| 58 | LIBCXX_INSTALL_PATH ?= $(PNACL_TOOLCHAIN_ROOT) |
Karl Schimpf | 9d92854 | 2015-04-16 15:08:05 -0700 | [diff] [blame] | 59 | STDLIB_FLAGS := -stdlib=libc++ -I$(LIBCXX_INSTALL_PATH)/include/c++/v1 |
Jan Voung | 68a0633 | 2015-03-05 14:33:38 -0800 | [diff] [blame] | 60 | |
Jan Voung | 4c127ba | 2014-09-19 13:11:36 -0700 | [diff] [blame] | 61 | HOST_ARCH ?= x86_64 |
Jan Voung | 839c4ce | 2014-07-28 15:19:43 -0700 | [diff] [blame] | 62 | ifeq ($(HOST_ARCH),x86_64) |
Jim Stichnoth | 6c6adf1 | 2015-04-07 14:22:25 -0700 | [diff] [blame] | 63 | HOST_FLAGS = -m64 |
Jan Voung | 839c4ce | 2014-07-28 15:19:43 -0700 | [diff] [blame] | 64 | else |
| 65 | ifeq ($(HOST_ARCH),x86) |
Jim Stichnoth | 6c6adf1 | 2015-04-07 14:22:25 -0700 | [diff] [blame] | 66 | HOST_FLAGS = -m32 |
Jan Voung | 839c4ce | 2014-07-28 15:19:43 -0700 | [diff] [blame] | 67 | endif |
| 68 | endif |
| 69 | |
Jim Stichnoth | fddef24 | 2014-09-26 18:53:41 -0700 | [diff] [blame] | 70 | ifdef DEBUG |
| 71 | OBJDIR = build/Debug |
| 72 | OPTLEVEL = -O0 |
Jan Voung | 44c3a80 | 2015-03-27 16:29:08 -0700 | [diff] [blame] | 73 | LINKOPTLEVEL = -O0 |
Jim Stichnoth | fddef24 | 2014-09-26 18:53:41 -0700 | [diff] [blame] | 74 | else |
| 75 | OBJDIR = build/Release |
Jim Stichnoth | a49e9d9 | 2014-12-07 14:25:34 -0800 | [diff] [blame] | 76 | OPTLEVEL = -O2 -ffunction-sections -fdata-sections |
Jan Voung | 44c3a80 | 2015-03-27 16:29:08 -0700 | [diff] [blame] | 77 | LINKOPTLEVEL = -O2 |
Jim Stichnoth | fddef24 | 2014-09-26 18:53:41 -0700 | [diff] [blame] | 78 | endif |
| 79 | |
Karl Schimpf | b262c5e | 2014-10-27 14:41:57 -0700 | [diff] [blame] | 80 | # The list of CXX defines that are dependent on build parameters. |
Jan Voung | 44c3a80 | 2015-03-27 16:29:08 -0700 | [diff] [blame] | 81 | BASE_CXX_DEFINES = |
Jim Stichnoth | fa4efea | 2015-01-27 05:06:03 -0800 | [diff] [blame] | 82 | CXX_EXTRA = |
| 83 | LD_EXTRA = |
Karl Schimpf | b262c5e | 2014-10-27 14:41:57 -0700 | [diff] [blame] | 84 | |
| 85 | ifdef MINIMAL |
Jim Stichnoth | e3c02c2 | 2014-12-05 14:16:07 -0800 | [diff] [blame] | 86 | NOASSERT = 1 |
Jim Stichnoth | b88d8c8 | 2016-03-11 15:33:00 -0800 | [diff] [blame] | 87 | NODUMP = 1 |
Karl Schimpf | b262c5e | 2014-10-27 14:41:57 -0700 | [diff] [blame] | 88 | OBJDIR := $(OBJDIR)+Min |
Jim Stichnoth | b88d8c8 | 2016-03-11 15:33:00 -0800 | [diff] [blame] | 89 | BASE_CXX_DEFINES += -DALLOW_LLVM_CL=0 -DALLOW_LLVM_IR=0 \ |
| 90 | -DALLOW_LLVM_IR_AS_INPUT=0 -DALLOW_TIMERS=0 -DALLOW_MINIMAL_BUILD=1 |
Karl Schimpf | b262c5e | 2014-10-27 14:41:57 -0700 | [diff] [blame] | 91 | else |
Jim Stichnoth | b88d8c8 | 2016-03-11 15:33:00 -0800 | [diff] [blame] | 92 | BASE_CXX_DEFINES += -DALLOW_LLVM_CL=1 -DALLOW_LLVM_IR=1 \ |
| 93 | -DALLOW_LLVM_IR_AS_INPUT=1 -DALLOW_TIMERS=1 -DALLOW_MINIMAL_BUILD=0 |
| 94 | endif |
| 95 | |
| 96 | ifdef NODUMP |
| 97 | OBJDIR := $(OBJDIR)+NoDump |
| 98 | BASE_CXX_DEFINES += -DALLOW_DUMP=0 |
| 99 | else |
| 100 | BASE_CXX_DEFINES += -DALLOW_DUMP=1 |
Karl Schimpf | b262c5e | 2014-10-27 14:41:57 -0700 | [diff] [blame] | 101 | endif |
| 102 | |
Jim Stichnoth | 999a22f | 2016-03-12 10:22:53 -0800 | [diff] [blame] | 103 | # Restrict to a single supported target. Current options: |
| 104 | # SZTARGET=ARM32 |
| 105 | # SZTARGET=MIPS32 |
| 106 | # SZTARGET=X8632 |
| 107 | # SZTARGET=X8664 |
| 108 | ifdef SZTARGET |
| 109 | OBJDIR := $(OBJDIR)+T_$(SZTARGET) |
| 110 | BASE_CXX_DEFINES += -DSZTARGET=$(SZTARGET) |
| 111 | endif |
| 112 | |
Jim Stichnoth | f5fdd23 | 2016-05-09 12:24:36 -0700 | [diff] [blame] | 113 | BASE_CXX_DEFINES += -DPNACL_LLVM |
Jim Stichnoth | 6b0ee2a | 2016-08-17 16:20:21 -0700 | [diff] [blame] | 114 | SZ_COMMIT_COUNT := $(shell git rev-list --count HEAD) |
| 115 | SZ_GIT_HASH := $(shell git rev-parse HEAD) |
| 116 | BASE_CXX_DEFINES += -DSUBZERO_REVISION=$(SZ_COMMIT_COUNT)_$(SZ_GIT_HASH) |
Jim Stichnoth | f5fdd23 | 2016-05-09 12:24:36 -0700 | [diff] [blame] | 117 | |
Jan Voung | 44c3a80 | 2015-03-27 16:29:08 -0700 | [diff] [blame] | 118 | CXX_DEFINES := $(BASE_CXX_DEFINES) -DPNACL_BROWSER_TRANSLATOR=0 |
| 119 | |
Jim Stichnoth | 9c234e2 | 2014-10-01 09:28:21 -0700 | [diff] [blame] | 120 | ifdef NOASSERT |
| 121 | ASSERTIONS = -DNDEBUG |
| 122 | else |
| 123 | ASSERTIONS = |
| 124 | OBJDIR := $(OBJDIR)+Asserts |
| 125 | endif |
| 126 | |
Andrew Scull | 6ef7949 | 2015-09-09 15:50:42 -0700 | [diff] [blame] | 127 | ifdef UBSAN |
| 128 | OBJDIR := $(OBJDIR)+UBSan |
Jim Stichnoth | 2e7de23 | 2015-11-02 08:25:57 -0800 | [diff] [blame] | 129 | CXX_EXTRA += -fsanitize=undefined -fno-sanitize=vptr \ |
| 130 | -fno-sanitize=nonnull-attribute |
Andrew Scull | 6ef7949 | 2015-09-09 15:50:42 -0700 | [diff] [blame] | 131 | LD_EXTRA += -fsanitize=undefined |
| 132 | endif |
| 133 | |
| 134 | ifdef UBSAN_TRAP |
| 135 | OBJDIR := $(OBJDIR)+UBSan_Trap |
Jim Stichnoth | 2e7de23 | 2015-11-02 08:25:57 -0800 | [diff] [blame] | 136 | CXX_EXTRA += -fsanitize=undefined-trap -fsanitize-undefined-trap-on-error \ |
| 137 | -fno-sanitize=vptr -fno-sanitize=nonnull-attribute |
Andrew Scull | 6ef7949 | 2015-09-09 15:50:42 -0700 | [diff] [blame] | 138 | LD_EXTRA += -fsanitize=undefined-trap |
| 139 | endif |
| 140 | |
Jim Stichnoth | fa4efea | 2015-01-27 05:06:03 -0800 | [diff] [blame] | 141 | ifdef TSAN |
| 142 | OBJDIR := $(OBJDIR)+TSan |
| 143 | CXX_EXTRA += -fsanitize=thread |
| 144 | LD_EXTRA += -fsanitize=thread |
| 145 | endif |
| 146 | |
Andrew Scull | 86df4e9 | 2015-07-30 13:54:44 -0700 | [diff] [blame] | 147 | ifdef ASAN |
| 148 | OBJDIR := $(OBJDIR)+ASan |
| 149 | CXX_EXTRA += -fsanitize=address |
| 150 | LD_EXTRA += -fsanitize=address |
| 151 | endif |
| 152 | |
Andrew Scull | 6ef7949 | 2015-09-09 15:50:42 -0700 | [diff] [blame] | 153 | ifdef MSAN |
Andrew Scull | 00741a0 | 2015-09-16 19:04:09 -0700 | [diff] [blame] | 154 | # TODO(ascull): this has an as yet undiagnosed uninitialized memory access |
Andrew Scull | 6ef7949 | 2015-09-09 15:50:42 -0700 | [diff] [blame] | 155 | OBJDIR := $(OBJDIR)+MSan |
| 156 | CXX_EXTRA += -fsanitize=memory |
| 157 | LD_EXTRA += -fsanitize=memory |
| 158 | endif |
| 159 | |
David Sehr | b19d39c | 2016-01-13 14:17:37 -0800 | [diff] [blame] | 160 | ifdef FORCEASM |
| 161 | FORCEASM_FLAG = --filetype=asm |
| 162 | # With --filetype=asm and --sandbox, the llvm-mc assembler emits the lock and |
| 163 | # 16-bit prefixes in the "wrong" order, causing the validator to reject the |
| 164 | # resulting nexe. So we just disable those tests for now. |
| 165 | FORCEASM_XTEST_EXCLUDES = -e x8632,sandbox,test_sync_atomic |
| 166 | FORCEASM_LIT_PARAM = --param=FORCEASM |
John Porto | 27fddcc | 2016-02-02 15:06:09 -0800 | [diff] [blame] | 167 | # x86 sandboxing lit tests are disabled because filetype=asm does not |
| 168 | # handle bundle_lock pad-to-end correctly. |
John Porto | 56958cb | 2016-01-14 09:18:18 -0800 | [diff] [blame] | 169 | # TODO(jpp): fix this. |
| 170 | FORCEASM_LIT_TEST_EXCLUDES = --filter='^(?!.*/x86/sandboxing.ll).*' |
David Sehr | b19d39c | 2016-01-13 14:17:37 -0800 | [diff] [blame] | 171 | else |
| 172 | FORCEASM_FLAG = |
| 173 | FORCEASM_XTEST_EXCLUDES = |
| 174 | FORCEASM_LIT_PARAM = |
John Porto | 56958cb | 2016-01-14 09:18:18 -0800 | [diff] [blame] | 175 | FORCEASM_LIT_TEST_EXCLUDES = |
David Sehr | b19d39c | 2016-01-13 14:17:37 -0800 | [diff] [blame] | 176 | endif |
| 177 | |
David Sehr | 4c16ac0 | 2016-03-17 13:51:42 -0700 | [diff] [blame] | 178 | ifdef LINUX_MALLOC_PROFILE |
| 179 | OBJDIR := $(OBJDIR)+MalProf |
| 180 | CXX_EXTRA += -DALLOW_LINUX_MALLOC_PROFILE=1 |
| 181 | LD_EXTRA += -Wl,--export-dynamic |
| 182 | endif |
| 183 | |
Jan Voung | 44c3a80 | 2015-03-27 16:29:08 -0700 | [diff] [blame] | 184 | SB_OBJDIR := $(OBJDIR)+Sandboxed |
Jim Stichnoth | c4ed549 | 2016-02-29 09:16:00 -0800 | [diff] [blame] | 185 | SBB_OBJDIR := $(OBJDIR)+SandboxedBrowser |
Jan Voung | 44c3a80 | 2015-03-27 16:29:08 -0700 | [diff] [blame] | 186 | |
Eric Holk | 16f8061 | 2016-04-04 17:07:42 -0700 | [diff] [blame] | 187 | V8_DIR = $(NACL_ROOT)/../v8 |
| 188 | V8_CXXFLAGS := -I$(V8_DIR) |
| 189 | |
Derek Schuff | bc64313 | 2014-05-22 16:39:25 -0700 | [diff] [blame] | 190 | $(info -----------------------------------------------) |
| 191 | $(info Using LLVM_SRC_PATH = $(LLVM_SRC_PATH)) |
Jan Voung | 44c3a80 | 2015-03-27 16:29:08 -0700 | [diff] [blame] | 192 | $(info Using SB_LLVM_PATH = $(SB_LLVM_PATH)) |
| 193 | $(info Using NACL_ROOT = $(NACL_ROOT)) |
Jan Voung | 8e32fed | 2015-06-17 10:16:23 -0700 | [diff] [blame] | 194 | $(info Using TOOLCHAIN_ROOT = $(TOOLCHAIN_ROOT)) |
Jan Voung | 68a0633 | 2015-03-05 14:33:38 -0800 | [diff] [blame] | 195 | $(info Using PNACL_TOOLCHAIN_ROOT = $(PNACL_TOOLCHAIN_ROOT)) |
Jan Voung | 44c3a80 | 2015-03-27 16:29:08 -0700 | [diff] [blame] | 196 | $(info Using PNACL_BIN_PATH = $(PNACL_BIN_PATH)) |
Karl Schimpf | 8fcefc3 | 2014-09-15 12:56:50 -0700 | [diff] [blame] | 197 | $(info Using CLANG_PATH = $(CLANG_PATH)) |
Jan Voung | 68a0633 | 2015-03-05 14:33:38 -0800 | [diff] [blame] | 198 | $(info Using LIBCXX_INSTALL_PATH = $(LIBCXX_INSTALL_PATH)) |
Jan Voung | 839c4ce | 2014-07-28 15:19:43 -0700 | [diff] [blame] | 199 | $(info Using HOST_ARCH = $(HOST_ARCH)) |
Derek Schuff | bc64313 | 2014-05-22 16:39:25 -0700 | [diff] [blame] | 200 | $(info -----------------------------------------------) |
| 201 | |
Jim Stichnoth | 0a9e126 | 2015-04-21 09:59:21 -0700 | [diff] [blame] | 202 | LLVM_CXXFLAGS := `$(PNACL_BIN_PATH)/llvm-config --cxxflags` |
Jan Voung | 44c3a80 | 2015-03-27 16:29:08 -0700 | [diff] [blame] | 203 | SB_LLVM_CXXFLAGS := $(LLVM_CXXFLAGS) |
| 204 | |
| 205 | # Listing specific libraries that are needed for pnacl-sz |
| 206 | # and the unittests, since we build "tools-only" for the |
| 207 | # sandboxed_translators (which doesn't include every library |
| 208 | # listed by llvm-config). |
Jim Stichnoth | 0a9e126 | 2015-04-21 09:59:21 -0700 | [diff] [blame] | 209 | |
| 210 | LLVM_LIBS_LIST := -lLLVMIRReader -lLLVMBitReader -lLLVMNaClBitTestUtils \ |
| 211 | -lLLVMNaClBitReader -lLLVMNaClBitAnalysis -lLLVMNaClBitWriter \ |
| 212 | -lLLVMAsmParser -lLLVMNaClAnalysis -lLLVMCore -lLLVMSupport |
| 213 | |
| 214 | ifeq ($(AUTOCONF), 0) |
| 215 | # LLVM cmake build |
Karl Schimpf | 28f3f73 | 2015-06-24 09:32:40 -0700 | [diff] [blame] | 216 | LLVM_LIBS := $(LLVM_LIBS_LIST) |
Jim Stichnoth | 0a9e126 | 2015-04-21 09:59:21 -0700 | [diff] [blame] | 217 | # For the cmake build, the gtest libs end up in the same place as the LLVM |
| 218 | # libs, so no "-L..." arg is needed. |
| 219 | GTEST_LIB_PATH ?= |
| 220 | CLANG_FORMAT_PATH ?= $(PNACL_BIN_PATH) |
| 221 | else |
| 222 | # LLVM autoconf build |
Jim Stichnoth | e5b58fb | 2015-06-01 15:17:20 -0700 | [diff] [blame] | 223 | LLVM_LIBS := -lLLVM-3.7svn |
Jim Stichnoth | 0a9e126 | 2015-04-21 09:59:21 -0700 | [diff] [blame] | 224 | GTEST_LIB_PATH ?= -L../../out/llvm_x86_64_linux_work/Release+Asserts/lib |
Srdjan Obucina | 2d152e3 | 2016-06-22 09:04:07 -0700 | [diff] [blame] | 225 | ifneq ($(wildcard \ |
| 226 | ../../out/llvm_x86_64_linux_work/Release+Asserts/bin/clang-format),) |
| 227 | CLANG_FORMAT_PATH ?= ../../out/llvm_x86_64_linux_work/Release+Asserts/bin |
| 228 | else |
| 229 | CLANG_FORMAT_PATH ?= \ |
| 230 | ../../out/llvm_x86_64_linux_debug_work/Debug+Asserts/bin |
| 231 | endif |
Jim Stichnoth | 0a9e126 | 2015-04-21 09:59:21 -0700 | [diff] [blame] | 232 | endif |
| 233 | |
Jan Voung | 44c3a80 | 2015-03-27 16:29:08 -0700 | [diff] [blame] | 234 | LLVM_LDFLAGS := $(LLVM_LIBS) \ |
Jim Stichnoth | 0a9e126 | 2015-04-21 09:59:21 -0700 | [diff] [blame] | 235 | `$(PNACL_BIN_PATH)/llvm-config --ldflags` \ |
| 236 | `$(PNACL_BIN_PATH)/llvm-config --system-libs` |
Jim Stichnoth | 7a20a40 | 2016-02-24 21:32:53 -0800 | [diff] [blame] | 237 | SB_LLVM_LDFLAGS := -Wl,--start-group $(LLVM_LIBS_LIST) -Wl,--end-group \ |
Jan Voung | 44c3a80 | 2015-03-27 16:29:08 -0700 | [diff] [blame] | 238 | -L$(SB_LLVM_PATH)/lib |
Derek Schuff | bc64313 | 2014-05-22 16:39:25 -0700 | [diff] [blame] | 239 | |
Jim Stichnoth | 5e06f9f | 2014-09-17 08:41:21 -0700 | [diff] [blame] | 240 | CCACHE := `command -v ccache` |
| 241 | CXX := CCACHE_CPP2=yes $(CCACHE) $(CLANG_PATH)/clang++ |
Jan Voung | 44c3a80 | 2015-03-27 16:29:08 -0700 | [diff] [blame] | 242 | SB_CXX := CCACHE_CPP2=yes $(CCACHE) $(PNACL_BIN_PATH)/pnacl-clang++ |
| 243 | SB_TRANSLATE := $(PNACL_BIN_PATH)/pnacl-translate |
Jim Stichnoth | 7a20a40 | 2016-02-24 21:32:53 -0800 | [diff] [blame] | 244 | SB_FINALIZE := $(PNACL_BIN_PATH)/pnacl-finalize --no-strip-syms |
Jan Voung | 839c4ce | 2014-07-28 15:19:43 -0700 | [diff] [blame] | 245 | |
Jan Voung | c2648c2 | 2015-07-30 21:29:14 -0700 | [diff] [blame] | 246 | # Extra warnings that LLVM's build system adds in addition to -Wall. |
| 247 | LLVM_EXTRA_WARNINGS := -Wcovered-switch-default |
| 248 | |
Jim Stichnoth | caeaa27 | 2016-01-10 12:53:44 -0800 | [diff] [blame] | 249 | # Use g++ to compile, to check for errors/warnings that clang++ might have |
| 250 | # missed. It's unlikely to link, unless LLVM was also built with g++, so the |
| 251 | # compile_only target should be used. Note: This ifdef section is deliberately |
| 252 | # placed here instead of with the other ifdef sections, so that its redefinition |
| 253 | # of CXX/STDLIB_FLAGS/LLVM_EXTRA_WARNINGS follows their normal definitions. |
| 254 | ifdef GPLUSPLUS |
| 255 | CXX := CCACHE_CPP2=yes $(CCACHE) g++ |
| 256 | STDLIB_FLAGS := |
Jim Stichnoth | b0051df | 2016-01-13 11:39:15 -0800 | [diff] [blame] | 257 | LLVM_EXTRA_WARNINGS := \ |
| 258 | -Wcast-qual \ |
| 259 | -Wno-comment \ |
| 260 | -Wno-long-long \ |
| 261 | -Wno-maybe-uninitialized \ |
| 262 | -Wno-missing-field-initializers \ |
| 263 | -Wno-unused-parameter \ |
| 264 | -Wwrite-strings |
Jim Stichnoth | caeaa27 | 2016-01-10 12:53:44 -0800 | [diff] [blame] | 265 | OBJDIR := $(OBJDIR)+Gplusplus |
| 266 | endif |
| 267 | |
Eric Holk | 16f8061 | 2016-04-04 17:07:42 -0700 | [diff] [blame] | 268 | BASE_CXXFLAGS := -std=gnu++11 -Wall -Wextra -fno-rtti \ |
Jim Stichnoth | 2e7de23 | 2015-11-02 08:25:57 -0800 | [diff] [blame] | 269 | -fno-exceptions $(OPTLEVEL) $(ASSERTIONS) -g -pedantic \ |
Eric Holk | 67c7c41 | 2016-04-15 13:05:37 -0700 | [diff] [blame] | 270 | $(LLVM_EXTRA_WARNINGS) $(CXX_EXTRA) -MP -MD -Werror |
Jan Voung | 44c3a80 | 2015-03-27 16:29:08 -0700 | [diff] [blame] | 271 | |
Eric Holk | 16f8061 | 2016-04-04 17:07:42 -0700 | [diff] [blame] | 272 | ifdef WASM |
Eric Holk | 16f8061 | 2016-04-04 17:07:42 -0700 | [diff] [blame] | 273 | BASE_CXXFLAGS := $(BASE_CXXFLAGS) $(V8_CXXFLAGS) -DALLOW_WASM=1 |
| 274 | OBJDIR := $(OBJDIR)+Wasm |
| 275 | else |
Eric Holk | 67c7c41 | 2016-04-15 13:05:37 -0700 | [diff] [blame] | 276 | BASE_CXXFLAGS := $(BASE_CXXFLAGS) -DALLOW_WASM=0 |
Eric Holk | 16f8061 | 2016-04-04 17:07:42 -0700 | [diff] [blame] | 277 | endif |
| 278 | |
Jim Stichnoth | 7146e99 | 2016-05-02 12:06:22 -0700 | [diff] [blame] | 279 | # TODO(stichnot,jpp): Restructure static fields in template classes to avoid |
| 280 | # needing -Wno-undefined-var-template . |
Jan Voung | 44c3a80 | 2015-03-27 16:29:08 -0700 | [diff] [blame] | 281 | CXXFLAGS := $(LLVM_CXXFLAGS) $(BASE_CXXFLAGS) $(CXX_DEFINES) $(HOST_FLAGS) \ |
Jim Stichnoth | 7146e99 | 2016-05-02 12:06:22 -0700 | [diff] [blame] | 282 | $(STDLIB_FLAGS) -Wno-undefined-var-template |
Jim Stichnoth | c4ed549 | 2016-02-29 09:16:00 -0800 | [diff] [blame] | 283 | SB_CXXFLAGS := $(SB_LLVM_CXXFLAGS) $(BASE_CXXFLAGS) $(BASE_CXX_DEFINES) \ |
| 284 | -Wno-unknown-pragmas -I$(NACL_ROOT) -I$(NACL_ROOT)/.. |
Jan Voung | 44c3a80 | 2015-03-27 16:29:08 -0700 | [diff] [blame] | 285 | |
Jim Stichnoth | fa4efea | 2015-01-27 05:06:03 -0800 | [diff] [blame] | 286 | LDFLAGS := $(HOST_FLAGS) -L$(LIBCXX_INSTALL_PATH)/lib -Wl,--gc-sections \ |
Jim Stichnoth | 2e7de23 | 2015-11-02 08:25:57 -0800 | [diff] [blame] | 287 | $(LD_EXTRA) $(STDLIB_FLAGS) |
Jan Voung | 44c3a80 | 2015-03-27 16:29:08 -0700 | [diff] [blame] | 288 | # Not specifying -Wl,--gc-sections but instead doing bitcode linking GC w/ LTO. |
| 289 | SB_LDFLAGS := $(LINKOPTLEVEL) $(LD_EXTRA) |
Derek Schuff | bc64313 | 2014-05-22 16:39:25 -0700 | [diff] [blame] | 290 | |
Jim Stichnoth | c59288b | 2015-11-09 11:38:40 -0800 | [diff] [blame] | 291 | # List the target-specific source files first, which generally take longer to |
| 292 | # compile, in the hope of improving parallel build time. |
Karl Schimpf | ab06df3 | 2014-10-29 14:58:25 -0700 | [diff] [blame] | 293 | SRCS = \ |
Jim Stichnoth | 2e7de23 | 2015-11-02 08:25:57 -0800 | [diff] [blame] | 294 | IceAssemblerARM32.cpp \ |
Jaydeep Patil | 135f5db | 2016-08-29 05:14:05 -0700 | [diff] [blame] | 295 | IceAssemblerMIPS32.cpp \ |
Jim Stichnoth | c59288b | 2015-11-09 11:38:40 -0800 | [diff] [blame] | 296 | IceInstARM32.cpp \ |
| 297 | IceInstMIPS32.cpp \ |
| 298 | IceInstX8632.cpp \ |
| 299 | IceInstX8664.cpp \ |
| 300 | IceTargetLowering.cpp \ |
| 301 | IceTargetLoweringARM32.cpp \ |
| 302 | IceTargetLoweringMIPS32.cpp \ |
David Sehr | 6b80cf1 | 2016-01-21 23:16:58 -0800 | [diff] [blame] | 303 | IceTargetLoweringX86.cpp \ |
Jim Stichnoth | c59288b | 2015-11-09 11:38:40 -0800 | [diff] [blame] | 304 | IceTargetLoweringX8632.cpp \ |
| 305 | IceTargetLoweringX8664.cpp \ |
| 306 | IceAssembler.cpp \ |
Jim Stichnoth | 2e7de23 | 2015-11-02 08:25:57 -0800 | [diff] [blame] | 307 | IceBrowserCompileServer.cpp \ |
| 308 | IceCfg.cpp \ |
| 309 | IceCfgNode.cpp \ |
| 310 | IceClFlags.cpp \ |
| 311 | IceCompiler.cpp \ |
| 312 | IceCompileServer.cpp \ |
| 313 | IceELFObjectWriter.cpp \ |
| 314 | IceELFSection.cpp \ |
| 315 | IceFixups.cpp \ |
| 316 | IceGlobalContext.cpp \ |
| 317 | IceGlobalInits.cpp \ |
| 318 | IceInst.cpp \ |
Jim Stichnoth | 2e7de23 | 2015-11-02 08:25:57 -0800 | [diff] [blame] | 319 | IceIntrinsics.cpp \ |
| 320 | IceLiveness.cpp \ |
| 321 | IceLoopAnalyzer.cpp \ |
Jim Stichnoth | 98ba006 | 2016-03-07 09:26:22 -0800 | [diff] [blame] | 322 | IceMangling.cpp \ |
John Porto | e82b560 | 2016-02-24 15:58:55 -0800 | [diff] [blame] | 323 | IceMemory.cpp \ |
Jim Stichnoth | 2e7de23 | 2015-11-02 08:25:57 -0800 | [diff] [blame] | 324 | IceOperand.cpp \ |
Jim Stichnoth | dd6dcfa | 2016-04-18 12:52:09 -0700 | [diff] [blame] | 325 | IceRangeSpec.cpp \ |
Jim Stichnoth | 2e7de23 | 2015-11-02 08:25:57 -0800 | [diff] [blame] | 326 | IceRegAlloc.cpp \ |
Jim Stichnoth | 54cf1a2 | 2016-08-08 14:15:00 -0700 | [diff] [blame] | 327 | IceRevision.cpp \ |
Jim Stichnoth | 2e7de23 | 2015-11-02 08:25:57 -0800 | [diff] [blame] | 328 | IceRNG.cpp \ |
| 329 | IceSwitchLowering.cpp \ |
Jim Stichnoth | 2e7de23 | 2015-11-02 08:25:57 -0800 | [diff] [blame] | 330 | IceThreading.cpp \ |
| 331 | IceTimerTree.cpp \ |
| 332 | IceTranslator.cpp \ |
| 333 | IceTypes.cpp \ |
Jim Stichnoth | b9a8472 | 2016-08-01 13:18:36 -0700 | [diff] [blame] | 334 | IceVariableSplitting.cpp \ |
David Sehr | 4c16ac0 | 2016-03-17 13:51:42 -0700 | [diff] [blame] | 335 | LinuxMallocProfiling.cpp \ |
Jim Stichnoth | 2e7de23 | 2015-11-02 08:25:57 -0800 | [diff] [blame] | 336 | main.cpp \ |
| 337 | PNaClTranslator.cpp |
Derek Schuff | bc64313 | 2014-05-22 16:39:25 -0700 | [diff] [blame] | 338 | |
Karl Schimpf | ab06df3 | 2014-10-29 14:58:25 -0700 | [diff] [blame] | 339 | ifndef MINIMAL |
Jim Stichnoth | 2e7de23 | 2015-11-02 08:25:57 -0800 | [diff] [blame] | 340 | SRCS += \ |
Thomas Lively | 7f0ab86 | 2016-06-14 14:06:17 -0700 | [diff] [blame] | 341 | IceASanInstrumentation.cpp \ |
Jim Stichnoth | 2e7de23 | 2015-11-02 08:25:57 -0800 | [diff] [blame] | 342 | IceConverter.cpp \ |
Thomas Lively | 7f0ab86 | 2016-06-14 14:06:17 -0700 | [diff] [blame] | 343 | IceInstrumentation.cpp \ |
Jim Stichnoth | 2e7de23 | 2015-11-02 08:25:57 -0800 | [diff] [blame] | 344 | IceTypeConverter.cpp |
Karl Schimpf | ab06df3 | 2014-10-29 14:58:25 -0700 | [diff] [blame] | 345 | endif |
| 346 | |
Eric Holk | 16f8061 | 2016-04-04 17:07:42 -0700 | [diff] [blame] | 347 | ifdef WASM |
| 348 | SRCS += \ |
| 349 | WasmTranslator.cpp |
| 350 | endif |
| 351 | |
Jim Stichnoth | fddef24 | 2014-09-26 18:53:41 -0700 | [diff] [blame] | 352 | OBJS=$(patsubst %.cpp, $(OBJDIR)/%.o, $(SRCS)) |
Jan Voung | 44c3a80 | 2015-03-27 16:29:08 -0700 | [diff] [blame] | 353 | SB_OBJS=$(patsubst %.cpp, $(SB_OBJDIR)/%.o, $(SRCS)) |
Jim Stichnoth | c4ed549 | 2016-02-29 09:16:00 -0800 | [diff] [blame] | 354 | SBB_OBJS=$(patsubst %.cpp, $(SBB_OBJDIR)/%.o, $(SRCS)) |
Derek Schuff | bc64313 | 2014-05-22 16:39:25 -0700 | [diff] [blame] | 355 | |
Jan Voung | 08c3bcd | 2014-12-01 17:55:16 -0800 | [diff] [blame] | 356 | UNITTEST_SRCS = \ |
Jim Stichnoth | 2e7de23 | 2015-11-02 08:25:57 -0800 | [diff] [blame] | 357 | BitcodeMunge.cpp \ |
| 358 | IceELFSectionTest.cpp \ |
| 359 | IceParseInstsTest.cpp |
John Porto | 59f2d92 | 2015-07-31 13:45:48 -0700 | [diff] [blame] | 360 | |
| 361 | # The X86 assembler tests take too long to compile. Given how infrequently the |
| 362 | # assembler will change, we disable them. |
| 363 | ifdef CHECK_X86_ASM |
Jim Stichnoth | 2e7de23 | 2015-11-02 08:25:57 -0800 | [diff] [blame] | 364 | ifndef DEBUG |
| 365 | $(error Run check-unit with DEBUG=1 lest your machine perish) |
| 366 | endif |
John Porto | 59f2d92 | 2015-07-31 13:45:48 -0700 | [diff] [blame] | 367 | UNITTEST_SRCS += AssemblerX8632/LowLevel.cpp \ |
Jim Stichnoth | 2e7de23 | 2015-11-02 08:25:57 -0800 | [diff] [blame] | 368 | AssemblerX8632/DataMov.cpp \ |
| 369 | AssemblerX8632/Locked.cpp \ |
| 370 | AssemblerX8632/GPRArith.cpp \ |
| 371 | AssemblerX8632/XmmArith.cpp \ |
| 372 | AssemblerX8632/ControlFlow.cpp \ |
| 373 | AssemblerX8632/Other.cpp \ |
| 374 | AssemblerX8632/X87.cpp \ |
| 375 | AssemblerX8664/LowLevel.cpp \ |
| 376 | AssemblerX8664/DataMov.cpp \ |
| 377 | AssemblerX8664/Locked.cpp \ |
| 378 | AssemblerX8664/GPRArith.cpp \ |
| 379 | AssemblerX8664/XmmArith.cpp \ |
| 380 | AssemblerX8664/ControlFlow.cpp \ |
| 381 | AssemblerX8664/Other.cpp |
John Porto | 59f2d92 | 2015-07-31 13:45:48 -0700 | [diff] [blame] | 382 | endif |
Jan Voung | 08c3bcd | 2014-12-01 17:55:16 -0800 | [diff] [blame] | 383 | |
| 384 | UNITTEST_OBJS = $(patsubst %.cpp, $(OBJDIR)/unittest/%.o, $(UNITTEST_SRCS)) |
Jim Stichnoth | fa0cfa5 | 2015-02-26 09:42:36 -0800 | [diff] [blame] | 385 | UNITTEST_LIB_OBJS = $(filter-out $(OBJDIR)/main.o,$(OBJS)) |
Jan Voung | 08c3bcd | 2014-12-01 17:55:16 -0800 | [diff] [blame] | 386 | |
Jim Stichnoth | c4ed549 | 2016-02-29 09:16:00 -0800 | [diff] [blame] | 387 | NEXES = $(SB_OBJDIR)/pnacl-sz.x8632.nexe \ |
| 388 | $(SB_OBJDIR)/pnacl-sz.x8664.nexe \ |
| 389 | $(SBB_OBJDIR)/pnacl_public_x86_32_pnacl_sz_nexe \ |
| 390 | $(SBB_OBJDIR)/pnacl_public_x86_64_pnacl_sz_nexe |
Jim Stichnoth | e13d1eb | 2016-03-21 12:49:33 -0700 | [diff] [blame] | 391 | NEXES_LITE = $(SB_OBJDIR)/pnacl-sz.x8664.nexe |
Jim Stichnoth | c4ed549 | 2016-02-29 09:16:00 -0800 | [diff] [blame] | 392 | |
Derek Schuff | bc64313 | 2014-05-22 16:39:25 -0700 | [diff] [blame] | 393 | # Keep all the first target so it's the default. |
Jim Stichnoth | fa0cfa5 | 2015-02-26 09:42:36 -0800 | [diff] [blame] | 394 | all: $(OBJDIR)/pnacl-sz make_symlink runtime |
Derek Schuff | bc64313 | 2014-05-22 16:39:25 -0700 | [diff] [blame] | 395 | |
Jan Voung | 44c3a80 | 2015-03-27 16:29:08 -0700 | [diff] [blame] | 396 | ifdef TSAN |
Jim Stichnoth | e13d1eb | 2016-03-21 12:49:33 -0700 | [diff] [blame] | 397 | sb sb-lite: |
Jan Voung | 44c3a80 | 2015-03-27 16:29:08 -0700 | [diff] [blame] | 398 | @echo "Skipping pnacl-sz.*.nexe: TSAN isn't supported under NaCl." |
| 399 | else |
Jim Stichnoth | 96fac39 | 2016-03-11 14:58:23 -0800 | [diff] [blame] | 400 | sb: $(NEXES) sb_make_symlink exists-sbtc |
Jim Stichnoth | e13d1eb | 2016-03-21 12:49:33 -0700 | [diff] [blame] | 401 | sb-lite: $(NEXES_LITE) exists-sbtc |
Jan Voung | 44c3a80 | 2015-03-27 16:29:08 -0700 | [diff] [blame] | 402 | endif |
| 403 | |
Karl Schimpf | 6f9ba11 | 2015-06-22 13:20:23 -0700 | [diff] [blame] | 404 | # SHOW_BUILD_ATTS is an executable that is run to show what build |
| 405 | # attributes were used to build pnacl-sz. |
Karl Schimpf | cb6e95a | 2015-07-23 09:10:03 -0700 | [diff] [blame] | 406 | SHOW_BUILD_ATTS = $(OBJDIR)/pnacl-sz --build-atts |
Karl Schimpf | 6f9ba11 | 2015-06-22 13:20:23 -0700 | [diff] [blame] | 407 | |
Karl Schimpf | 6af6336 | 2014-10-29 14:55:00 -0700 | [diff] [blame] | 408 | # Creates symbolic link so that testing is easier. Also runs |
Jim Stichnoth | fa0cfa5 | 2015-02-26 09:42:36 -0800 | [diff] [blame] | 409 | # pnacl-sz to verify that the defines flags have valid values, |
Karl Schimpf | 6af6336 | 2014-10-29 14:55:00 -0700 | [diff] [blame] | 410 | # as well as describe the corresponding build attributes. |
Jim Stichnoth | fa0cfa5 | 2015-02-26 09:42:36 -0800 | [diff] [blame] | 411 | make_symlink: $(OBJDIR)/pnacl-sz |
| 412 | rm -rf pnacl-sz |
| 413 | ln -s $(OBJDIR)/pnacl-sz |
Karl Schimpf | 6af6336 | 2014-10-29 14:55:00 -0700 | [diff] [blame] | 414 | @echo "Build Attributes:" |
Karl Schimpf | 6f9ba11 | 2015-06-22 13:20:23 -0700 | [diff] [blame] | 415 | @$(SHOW_BUILD_ATTS) |
Derek Schuff | bc64313 | 2014-05-22 16:39:25 -0700 | [diff] [blame] | 416 | |
Jim Stichnoth | c4ed549 | 2016-02-29 09:16:00 -0800 | [diff] [blame] | 417 | sb_make_symlink: $(NEXES) |
| 418 | $(foreach nexe,$(NEXES),rm -rf $(notdir $(nexe)); ln -s $(nexe);) |
| 419 | |
| 420 | %.pexe : %.nonfinal.pexe |
| 421 | $(SB_FINALIZE) -o $@ $< |
Jim Stichnoth | 7a20a40 | 2016-02-24 21:32:53 -0800 | [diff] [blame] | 422 | |
Reed Kotler | 2c3c82e | 2016-01-21 20:33:08 -0800 | [diff] [blame] | 423 | .PHONY: all compile_only make_symlink runtime bloat sb docs help \ |
Jim Stichnoth | 96fac39 | 2016-03-11 14:58:23 -0800 | [diff] [blame] | 424 | help-check-lit help-check-xtest exists-nonsfi-x8632 \ |
| 425 | exists-nonsfi-arm32 exists-sbtc exists-spec |
Jim Stichnoth | 23bee88 | 2015-11-17 06:14:05 -0800 | [diff] [blame] | 426 | |
| 427 | compile_only: $(OBJS) |
Jim Stichnoth | fddef24 | 2014-09-26 18:53:41 -0700 | [diff] [blame] | 428 | |
Eric Holk | 16f8061 | 2016-04-04 17:07:42 -0700 | [diff] [blame] | 429 | V8_LIBDIR=$(V8_DIR)/out/native/lib.target |
| 430 | |
| 431 | ifdef WASM |
| 432 | V8_LIBS := \ |
| 433 | $(V8_LIBDIR)/libv8.so \ |
| 434 | $(V8_LIBDIR)/libicuuc.so \ |
| 435 | $(V8_LIBDIR)/libicui18n.so |
| 436 | endif |
| 437 | |
Jim Stichnoth | fa0cfa5 | 2015-02-26 09:42:36 -0800 | [diff] [blame] | 438 | $(OBJDIR)/pnacl-sz: $(OBJS) |
Jim Stichnoth | 3324642 | 2014-11-24 14:36:23 -0800 | [diff] [blame] | 439 | $(CXX) $(LDFLAGS) -o $@ $^ $(LLVM_LDFLAGS) \ |
Eric Holk | 16f8061 | 2016-04-04 17:07:42 -0700 | [diff] [blame] | 440 | -Wl,-rpath=$(abspath $(LIBCXX_INSTALL_PATH)/lib) $(V8_LIBS) |
Derek Schuff | bc64313 | 2014-05-22 16:39:25 -0700 | [diff] [blame] | 441 | |
Jim Stichnoth | 7a20a40 | 2016-02-24 21:32:53 -0800 | [diff] [blame] | 442 | $(SB_OBJDIR)/pnacl-sz.nonfinal.pexe: $(SB_OBJS) |
| 443 | $(SB_CXX) $(SB_LDFLAGS) -o $@ $^ $(SB_LLVM_LDFLAGS) |
| 444 | |
Jim Stichnoth | c4ed549 | 2016-02-29 09:16:00 -0800 | [diff] [blame] | 445 | $(SBB_OBJDIR)/pnacl-sz.nonfinal.pexe: $(SBB_OBJS) |
| 446 | $(SB_CXX) $(SB_LDFLAGS) -o $@ $^ $(SB_LLVM_LDFLAGS) \ |
| 447 | --pnacl-disable-abi-check |
Jim Stichnoth | 7a20a40 | 2016-02-24 21:32:53 -0800 | [diff] [blame] | 448 | |
| 449 | $(SB_OBJDIR)/pnacl-sz.x8632.nexe: $(SB_OBJDIR)/pnacl-sz.pexe |
| 450 | $(SB_TRANSLATE) -arch x86-32 $^ -o $@ |
| 451 | |
| 452 | $(SB_OBJDIR)/pnacl-sz.x8664.nexe: $(SB_OBJDIR)/pnacl-sz.pexe |
| 453 | $(SB_TRANSLATE) -arch x86-64 $^ -o $@ |
Jan Voung | 44c3a80 | 2015-03-27 16:29:08 -0700 | [diff] [blame] | 454 | |
Jim Stichnoth | c4ed549 | 2016-02-29 09:16:00 -0800 | [diff] [blame] | 455 | $(SBB_OBJDIR)/pnacl_public_x86_32_pnacl_sz_nexe: $(SBB_OBJDIR)/pnacl-sz.pexe |
| 456 | $(SB_TRANSLATE) -arch x86-32 $^ -o $@ |
| 457 | |
| 458 | $(SBB_OBJDIR)/pnacl_public_x86_64_pnacl_sz_nexe: $(SBB_OBJDIR)/pnacl-sz.pexe |
| 459 | $(SB_TRANSLATE) -arch x86-64 $^ -o $@ |
| 460 | |
John Porto | 2187c84 | 2015-12-16 07:48:25 -0800 | [diff] [blame] | 461 | src/IceRegistersARM32.def: pydir/gen_arm32_reg_tables.py |
| 462 | python $< > $@ |
| 463 | |
John Porto | 70e3f1c | 2016-03-16 04:20:49 -0700 | [diff] [blame] | 464 | -include $(foreach dep,$(SRCS:.cpp=.d),$(OBJDIR)/$(dep)) |
| 465 | $(OBJS): $(OBJDIR)/%.o: src/%.cpp |
Derek Schuff | bc64313 | 2014-05-22 16:39:25 -0700 | [diff] [blame] | 466 | $(CXX) -c $(CXXFLAGS) $< -o $@ |
| 467 | |
John Porto | 70e3f1c | 2016-03-16 04:20:49 -0700 | [diff] [blame] | 468 | -include $(foreach dep,$(SRCS:.cpp=.d),$(SB_OBJDIR)/$(dep)) |
| 469 | $(SB_OBJS): $(SB_OBJDIR)/%.o: src/%.cpp |
Jim Stichnoth | c4ed549 | 2016-02-29 09:16:00 -0800 | [diff] [blame] | 470 | $(SB_CXX) -c $(SB_CXXFLAGS) -DPNACL_BROWSER_TRANSLATOR=0 $< -o $@ |
| 471 | |
John Porto | 70e3f1c | 2016-03-16 04:20:49 -0700 | [diff] [blame] | 472 | -include $(foreach dep,$(SRCS:.cpp=.d),$(SBB_OBJDIR)/$(dep)) |
| 473 | $(SBB_OBJS): $(SBB_OBJDIR)/%.o: src/%.cpp |
Jim Stichnoth | c4ed549 | 2016-02-29 09:16:00 -0800 | [diff] [blame] | 474 | $(SB_CXX) -c $(SB_CXXFLAGS) -DPNACL_BROWSER_TRANSLATOR=1 $< -o $@ |
Jan Voung | 44c3a80 | 2015-03-27 16:29:08 -0700 | [diff] [blame] | 475 | |
Jan Voung | 08c3bcd | 2014-12-01 17:55:16 -0800 | [diff] [blame] | 476 | $(OBJDIR)/run_unittests: $(UNITTEST_OBJS) $(UNITTEST_LIB_OBJS) |
Jim Stichnoth | e7e9b02 | 2015-04-21 15:05:22 -0700 | [diff] [blame] | 477 | $(CXX) $(GTEST_LIB_PATH) $(LDFLAGS) -o $@ $^ $(LLVM_LDFLAGS) \ |
Jim Stichnoth | 2e7de23 | 2015-11-02 08:25:57 -0800 | [diff] [blame] | 478 | -lgtest -lgtest_main -ldl \ |
| 479 | -Wl,-rpath=$(abspath $(LIBCXX_INSTALL_PATH)/lib) |
Jan Voung | 08c3bcd | 2014-12-01 17:55:16 -0800 | [diff] [blame] | 480 | |
John Porto | 70e3f1c | 2016-03-16 04:20:49 -0700 | [diff] [blame] | 481 | -include $(foreach dep,$(UNITTEST_SRCS:.cpp=.d),$(OBJDIR)/unittest/$(dep)) |
| 482 | $(UNITTEST_OBJS): $(OBJDIR)/unittest/%.o: unittest/%.cpp |
Jan Voung | 08c3bcd | 2014-12-01 17:55:16 -0800 | [diff] [blame] | 483 | $(CXX) -c $(CXXFLAGS) \ |
Jim Stichnoth | 2e7de23 | 2015-11-02 08:25:57 -0800 | [diff] [blame] | 484 | -Isrc/ \ |
| 485 | -Iunittest/ \ |
| 486 | -I$(LLVM_SRC_PATH)/utils/unittest/googletest/include \ |
| 487 | -I$(LLVM_SRC_PATH) \ |
| 488 | -DGTEST_HAS_RTTI=0 -DGTEST_USE_OWN_TR1_TUPLE \ |
Jim Stichnoth | 5526c17 | 2016-03-08 22:46:19 -0800 | [diff] [blame] | 489 | -Wno-expansion-to-defined \ |
Jim Stichnoth | 2e7de23 | 2015-11-02 08:25:57 -0800 | [diff] [blame] | 490 | $< -o $@ |
Jan Voung | 08c3bcd | 2014-12-01 17:55:16 -0800 | [diff] [blame] | 491 | |
Jim Stichnoth | fddef24 | 2014-09-26 18:53:41 -0700 | [diff] [blame] | 492 | $(OBJS): | $(OBJDIR) |
Jan Voung | 44c3a80 | 2015-03-27 16:29:08 -0700 | [diff] [blame] | 493 | $(SB_OBJS): | $(SB_OBJDIR) |
Jim Stichnoth | c4ed549 | 2016-02-29 09:16:00 -0800 | [diff] [blame] | 494 | $(SBB_OBJS): | $(SBB_OBJDIR) |
Derek Schuff | bc64313 | 2014-05-22 16:39:25 -0700 | [diff] [blame] | 495 | |
Jim Stichnoth | 2e7de23 | 2015-11-02 08:25:57 -0800 | [diff] [blame] | 496 | $(UNITTEST_OBJS): | $(OBJDIR)/unittest $(OBJDIR)/unittest/AssemblerX8632 \ |
| 497 | $(OBJDIR)/unittest/AssemblerX8664 |
Jan Voung | 08c3bcd | 2014-12-01 17:55:16 -0800 | [diff] [blame] | 498 | |
Jim Stichnoth | fddef24 | 2014-09-26 18:53:41 -0700 | [diff] [blame] | 499 | $(OBJDIR): |
Derek Schuff | bc64313 | 2014-05-22 16:39:25 -0700 | [diff] [blame] | 500 | @mkdir -p $@ |
Jan Voung | 44c3a80 | 2015-03-27 16:29:08 -0700 | [diff] [blame] | 501 | $(SB_OBJDIR): |
| 502 | @mkdir -p $@ |
Jim Stichnoth | c4ed549 | 2016-02-29 09:16:00 -0800 | [diff] [blame] | 503 | $(SBB_OBJDIR): |
| 504 | @mkdir -p $@ |
Derek Schuff | bc64313 | 2014-05-22 16:39:25 -0700 | [diff] [blame] | 505 | |
Jan Voung | 08c3bcd | 2014-12-01 17:55:16 -0800 | [diff] [blame] | 506 | $(OBJDIR)/unittest: $(OBJDIR) |
| 507 | @mkdir -p $@ |
| 508 | |
John Porto | 2fea26c | 2015-07-28 16:28:07 -0700 | [diff] [blame] | 509 | $(OBJDIR)/unittest/AssemblerX8632: $(OBJDIR)/unittest |
| 510 | @mkdir -p $@ |
| 511 | $(OBJDIR)/unittest/AssemblerX8664: $(OBJDIR)/unittest |
| 512 | @mkdir -p $@ |
| 513 | |
Jim Stichnoth | 8ff4b28 | 2016-01-04 15:39:06 -0800 | [diff] [blame] | 514 | RT_SRC := runtime/szrt.c runtime/szrt_ll.ll runtime/szrt_profiler.c \ |
| 515 | runtime/szrt_asm_x8632.s runtime/szrt_asm_x8664.s \ |
Thomas Lively | 4e81fe0 | 2016-06-15 10:00:21 -0700 | [diff] [blame] | 516 | runtime/szrt_asm_arm32.s runtime/szrt_asan.c |
Jan Voung | 050deaa | 2015-06-12 15:12:05 -0700 | [diff] [blame] | 517 | RT_OBJ := build/runtime/szrt_native_x8632.o build/runtime/szrt_sb_x8632.o \ |
Jim Stichnoth | 8ff4b28 | 2016-01-04 15:39:06 -0800 | [diff] [blame] | 518 | build/runtime/szrt_nonsfi_x8632.o \ |
Jim Stichnoth | 2e7de23 | 2015-11-02 08:25:57 -0800 | [diff] [blame] | 519 | build/runtime/szrt_native_x8664.o build/runtime/szrt_sb_x8664.o \ |
Jim Stichnoth | 8ff4b28 | 2016-01-04 15:39:06 -0800 | [diff] [blame] | 520 | build/runtime/szrt_nonsfi_x8664.o \ |
| 521 | build/runtime/szrt_native_arm32.o build/runtime/szrt_sb_arm32.o \ |
Thomas Lively | 4e81fe0 | 2016-06-15 10:00:21 -0700 | [diff] [blame] | 522 | build/runtime/szrt_nonsfi_arm32.o \ |
| 523 | build/runtime/szrt_asan_x8632.o build/runtime/szrt_asan_x8664.o \ |
| 524 | build/runtime/szrt_asan_arm32.o |
Jim Stichnoth | 9738a9e | 2015-02-23 16:39:06 -0800 | [diff] [blame] | 525 | |
Srdjan Obucina | 623f8ce | 2016-09-26 20:03:20 -0700 | [diff] [blame] | 526 | EXCLUDED_RT := |
| 527 | ifdef MIPS |
| 528 | RT_SRC += runtime/szrt_asm_mips32.s |
| 529 | RT_OBJ += build/runtime/szrt_native_mips32.o build/runtime/szrt_sb_mips32.o |
| 530 | else |
| 531 | EXCLUDED_RT += --exclude-target=mips32 |
| 532 | endif |
| 533 | |
Jim Stichnoth | 9738a9e | 2015-02-23 16:39:06 -0800 | [diff] [blame] | 534 | runtime: $(RT_OBJ) |
| 535 | |
| 536 | # Use runtime.is.built so that build-runtime.py is invoked only once |
| 537 | # even in a parallel build. |
| 538 | .INTERMEDIATE: runtime.is.built |
| 539 | $(RT_OBJ): runtime.is.built |
John Porto | f8b4cc8 | 2015-06-09 18:06:19 -0700 | [diff] [blame] | 540 | runtime.is.built: $(RT_SRC) pydir/build-runtime.py |
Jim Stichnoth | 9738a9e | 2015-02-23 16:39:06 -0800 | [diff] [blame] | 541 | @echo ================ Building Subzero runtime ================ |
Srdjan Obucina | 623f8ce | 2016-09-26 20:03:20 -0700 | [diff] [blame] | 542 | ./pydir/build-runtime.py -v --pnacl-root $(PNACL_TOOLCHAIN_ROOT) \ |
| 543 | $(EXCLUDED_RT) |
Jim Stichnoth | 9738a9e | 2015-02-23 16:39:06 -0800 | [diff] [blame] | 544 | |
Thomas Lively | 3f97afb | 2016-07-07 14:56:21 -0700 | [diff] [blame] | 545 | check-lit: $(OBJDIR)/pnacl-sz make_symlink runtime |
Jim Stichnoth | 0a9e126 | 2015-04-21 09:59:21 -0700 | [diff] [blame] | 546 | PNACL_BIN_PATH=$(PNACL_BIN_PATH) \ |
Reed Kotler | 2c3c82e | 2016-01-21 20:33:08 -0800 | [diff] [blame] | 547 | $(LLVM_SRC_PATH)/utils/lit/lit.py -sv $(CHECK_LIT_TESTS) \ |
John Porto | 56958cb | 2016-01-14 09:18:18 -0800 | [diff] [blame] | 548 | $(FORCEASM_LIT_TEST_EXCLUDES) $(FORCEASM_LIT_PARAM) |
Jim Stichnoth | ac9c943 | 2014-08-26 14:07:13 -0700 | [diff] [blame] | 549 | |
Karl Schimpf | ab06df3 | 2014-10-29 14:58:25 -0700 | [diff] [blame] | 550 | ifdef MINIMAL |
Jim Stichnoth | e13d1eb | 2016-03-21 12:49:33 -0700 | [diff] [blame] | 551 | check-xtest check-xtest-lite: $(OBJDIR)/pnacl-sz make_symlink runtime |
Jim Stichnoth | c925822 | 2015-03-13 11:59:49 -0700 | [diff] [blame] | 552 | @echo "Crosstests disabled, minimal build" |
Karl Schimpf | ab06df3 | 2014-10-29 14:58:25 -0700 | [diff] [blame] | 553 | else |
Jim Stichnoth | cc8bc16 | 2016-09-02 06:29:48 -0700 | [diff] [blame] | 554 | ifdef MIPS |
| 555 | check-xtest check-xtest-lite: $(OBJDIR)/pnacl-sz make_symlink runtime \ |
| 556 | crosstest/test_arith_ll.ll |
| 557 | # Do all x8664/native/sse2 tests as a smoke test. |
| 558 | # Add in mips32 tests as they come online. |
| 559 | ./pydir/crosstest_generator.py -v --lit \ |
| 560 | --toolchain-root $(TOOLCHAIN_ROOT) \ |
| 561 | $(FORCEASM_FLAG) \ |
| 562 | $(FORCEASM_XTEST_EXCLUDES) \ |
| 563 | -i x8664,native,sse2 \ |
Srdjan Obucina | 623f8ce | 2016-09-26 20:03:20 -0700 | [diff] [blame] | 564 | -i mips32,native,Om1,simple_loop \ |
| 565 | -i mips32,native,Om1,test_strengthreduce |
Jim Stichnoth | cc8bc16 | 2016-09-02 06:29:48 -0700 | [diff] [blame] | 566 | PNACL_BIN_PATH=$(PNACL_BIN_PATH) \ |
| 567 | $(LLVM_SRC_PATH)/utils/lit/lit.py -sv $(CHECK_XTEST_TESTS) |
| 568 | else |
Jim Stichnoth | 96fac39 | 2016-03-11 14:58:23 -0800 | [diff] [blame] | 569 | check-xtest: $(OBJDIR)/pnacl-sz make_symlink runtime \ |
Jim Stichnoth | 7dbe802 | 2016-05-31 12:21:51 -0700 | [diff] [blame] | 570 | exists-nonsfi-x8632 exists-nonsfi-arm32 crosstest/test_arith_ll.ll |
Jim Stichnoth | dc7c597 | 2015-03-10 11:17:15 -0700 | [diff] [blame] | 571 | # Do all native/sse2 tests, but only test_vector_ops for native/sse4.1. |
| 572 | # For (slow) sandboxed tests, limit to Om1/sse4.1. |
John Porto | 94e97f6 | 2016-02-18 08:02:10 -0800 | [diff] [blame] | 573 | # run.py (used to run the sandboxed xtests) does not support |
| 574 | # specifying -cpu cortex-a15 to qemu, hence we disable the |
| 575 | # hwdiv-arm tests. |
Jim Stichnoth | dc7c597 | 2015-03-10 11:17:15 -0700 | [diff] [blame] | 576 | ./pydir/crosstest_generator.py -v --lit \ |
Jim Stichnoth | 2e7de23 | 2015-11-02 08:25:57 -0800 | [diff] [blame] | 577 | --toolchain-root $(TOOLCHAIN_ROOT) \ |
David Sehr | b19d39c | 2016-01-13 14:17:37 -0800 | [diff] [blame] | 578 | $(FORCEASM_FLAG) \ |
| 579 | $(FORCEASM_XTEST_EXCLUDES) \ |
Jim Stichnoth | 2e7de23 | 2015-11-02 08:25:57 -0800 | [diff] [blame] | 580 | -i x8632,native,sse2 \ |
| 581 | -i x8632,native,sse4.1,test_vector_ops \ |
| 582 | -i x8632,sandbox,sse4.1,Om1 \ |
Jim Stichnoth | 57a8aab | 2016-01-06 09:34:36 -0800 | [diff] [blame] | 583 | -i x8632,nonsfi,sse2,O2 \ |
John Porto | 008f4ce | 2015-12-24 13:22:18 -0800 | [diff] [blame] | 584 | -i x8664,native,sse2 \ |
| 585 | -i x8664,native,sse4.1,test_vector_ops \ |
John Porto | 56958cb | 2016-01-14 09:18:18 -0800 | [diff] [blame] | 586 | -i x8664,sandbox,sse4.1,Om1 \ |
John Porto | 94e97f6 | 2016-02-18 08:02:10 -0800 | [diff] [blame] | 587 | -i arm32 \ |
John Porto | e82b560 | 2016-02-24 15:58:55 -0800 | [diff] [blame] | 588 | -e arm32,sandbox,hwdiv-arm |
Jim Stichnoth | 0a9e126 | 2015-04-21 09:59:21 -0700 | [diff] [blame] | 589 | PNACL_BIN_PATH=$(PNACL_BIN_PATH) \ |
Reed Kotler | 2c3c82e | 2016-01-21 20:33:08 -0800 | [diff] [blame] | 590 | $(LLVM_SRC_PATH)/utils/lit/lit.py -sv $(CHECK_XTEST_TESTS) |
Jim Stichnoth | e13d1eb | 2016-03-21 12:49:33 -0700 | [diff] [blame] | 591 | check-xtest-lite: $(OBJDIR)/pnacl-sz make_symlink runtime \ |
Jim Stichnoth | 7dbe802 | 2016-05-31 12:21:51 -0700 | [diff] [blame] | 592 | exists-nonsfi-x8632 exists-nonsfi-arm32 crosstest/test_arith_ll.ll |
Jim Stichnoth | e13d1eb | 2016-03-21 12:49:33 -0700 | [diff] [blame] | 593 | # Do all native/sse2/neon tests, which are relatively fast. |
| 594 | # Limit to test_global+mem_intrin for sandbox+nonsfi because sandbox and |
| 595 | # nonsfi builds are slow, and test_global and mem_intrin are the most |
| 596 | # common sources of problems. |
| 597 | ./pydir/crosstest_generator.py -v --lit \ |
| 598 | --toolchain-root $(TOOLCHAIN_ROOT) \ |
| 599 | $(FORCEASM_FLAG) \ |
| 600 | $(FORCEASM_XTEST_EXCLUDES) \ |
| 601 | -i x8632,native,sse2,O2 \ |
| 602 | -i x8664,native,sse2,O2 \ |
| 603 | -i arm32,native,neon,O2 \ |
| 604 | -i x8632,sse2,O2,test_global \ |
| 605 | -i x8632,sse2,O2,mem_intrin \ |
| 606 | -i x8664,sse2,O2,test_global \ |
| 607 | -i x8664,sse2,O2,mem_intrin \ |
| 608 | -i arm32,neon,O2,test_global \ |
| 609 | -i arm32,neon,O2,mem_intrin \ |
| 610 | -e x8664,nonsfi |
| 611 | PNACL_BIN_PATH=$(PNACL_BIN_PATH) \ |
| 612 | $(LLVM_SRC_PATH)/utils/lit/lit.py -sv $(CHECK_XTEST_TESTS) |
Jim Stichnoth | 7dbe802 | 2016-05-31 12:21:51 -0700 | [diff] [blame] | 613 | crosstest/test_arith_ll.ll: pydir/gen_test_arith_ll.py |
| 614 | python $< > $@ |
Karl Schimpf | ab06df3 | 2014-10-29 14:58:25 -0700 | [diff] [blame] | 615 | endif |
Jim Stichnoth | cc8bc16 | 2016-09-02 06:29:48 -0700 | [diff] [blame] | 616 | endif |
Derek Schuff | bc64313 | 2014-05-22 16:39:25 -0700 | [diff] [blame] | 617 | |
Jim Stichnoth | c925822 | 2015-03-13 11:59:49 -0700 | [diff] [blame] | 618 | check-unit: $(OBJDIR)/run_unittests |
| 619 | $(OBJDIR)/run_unittests |
| 620 | |
Jim Stichnoth | c59288b | 2015-11-09 11:38:40 -0800 | [diff] [blame] | 621 | # List the spec2k components in roughly reverse order of runtime, to help with |
| 622 | # parallel execution speed. |
| 623 | ALLSPEC := 253.perlbmk 177.mesa 188.ammp 256.bzip2 164.gzip 179.art 183.equake \ |
| 624 | 175.vpr 176.gcc 181.mcf 186.crafty 197.parser 254.gap 255.vortex \ |
| 625 | 300.twolf 252.eon |
Jim Stichnoth | 2e7de23 | 2015-11-02 08:25:57 -0800 | [diff] [blame] | 626 | .PHONY: $(ALLSPEC) |
| 627 | |
| 628 | TARGET := x8632 |
| 629 | ifeq ($(TARGET),x8632) |
| 630 | TARGETFLAG=x8632 |
| 631 | SETUP=SetupGccX8632Opt |
Jim Stichnoth | c8f56a3 | 2016-03-07 09:54:15 -0800 | [diff] [blame] | 632 | SPEC := --filetype=obj |
Jim Stichnoth | 2e7de23 | 2015-11-02 08:25:57 -0800 | [diff] [blame] | 633 | endif |
John Porto | 3c275ce | 2015-12-22 08:14:00 -0800 | [diff] [blame] | 634 | ifeq ($(TARGET),x8664) |
| 635 | TARGETFLAG=x8664 |
| 636 | SETUP=SetupGccX8664Opt |
Jim Stichnoth | c8f56a3 | 2016-03-07 09:54:15 -0800 | [diff] [blame] | 637 | SPEC := --filetype=obj |
John Porto | 3c275ce | 2015-12-22 08:14:00 -0800 | [diff] [blame] | 638 | endif |
Jim Stichnoth | 2e7de23 | 2015-11-02 08:25:57 -0800 | [diff] [blame] | 639 | ifeq ($(TARGET),arm32) |
| 640 | TARGETFLAG=arm32 |
| 641 | SETUP=SetupGccArmOpt |
Jim Stichnoth | c8f56a3 | 2016-03-07 09:54:15 -0800 | [diff] [blame] | 642 | SPEC := --filetype=obj |
Jim Stichnoth | 2e7de23 | 2015-11-02 08:25:57 -0800 | [diff] [blame] | 643 | endif |
Srdjan Obucina | 623f8ce | 2016-09-26 20:03:20 -0700 | [diff] [blame] | 644 | ifeq ($(TARGET),mips32) |
| 645 | # native_client/tests/spec2k/{Makefile.common,run_all.sh} do not currently |
| 646 | # have MIPS configs, so those would need to be added for proper Subzero |
| 647 | # testing. |
| 648 | TARGETFLAG=mips32 |
| 649 | SETUP=SetupGccMipsOpt |
| 650 | SPEC := --filetype=asm |
| 651 | endif |
Jim Stichnoth | c8f56a3 | 2016-03-07 09:54:15 -0800 | [diff] [blame] | 652 | SPECFLAGS := -O2 |
Jim Stichnoth | 45f7700 | 2016-04-01 18:26:16 -0700 | [diff] [blame] | 653 | SPECRUN := --run |
Jim Stichnoth | c59288b | 2015-11-09 11:38:40 -0800 | [diff] [blame] | 654 | %.spec2k: % $(OBJDIR)/pnacl-sz make_symlink runtime |
Jim Stichnoth | bc3bd50 | 2016-01-20 15:01:39 -0800 | [diff] [blame] | 655 | ./pydir/szbuild_spec2k.py -v \ |
Jim Stichnoth | 45f7700 | 2016-04-01 18:26:16 -0700 | [diff] [blame] | 656 | $(SPECFLAGS) --target=$(TARGETFLAG) $(SPEC) $< $(SPECRUN) |
Jim Stichnoth | 2e7de23 | 2015-11-02 08:25:57 -0800 | [diff] [blame] | 657 | |
Jim Stichnoth | cc8bc16 | 2016-09-02 06:29:48 -0700 | [diff] [blame] | 658 | ifdef MIPS |
| 659 | # Don't test spec2k on mips32, at least not yet. |
| 660 | check-spec: |
| 661 | else |
Jim Stichnoth | 96fac39 | 2016-03-11 14:58:23 -0800 | [diff] [blame] | 662 | check-spec: exists-spec $(ALLSPEC:=.spec2k) |
Jim Stichnoth | cc8bc16 | 2016-09-02 06:29:48 -0700 | [diff] [blame] | 663 | endif |
Jim Stichnoth | 2e7de23 | 2015-11-02 08:25:57 -0800 | [diff] [blame] | 664 | |
Jim Stichnoth | c925822 | 2015-03-13 11:59:49 -0700 | [diff] [blame] | 665 | check: check-lit check-unit check-xtest |
| 666 | |
Jim Stichnoth | 96fac39 | 2016-03-11 14:58:23 -0800 | [diff] [blame] | 667 | NONSFI_LOADER_X8632 = \ |
| 668 | $(NACL_ROOT)/scons-out/opt-linux-x86-32/obj/src/nonsfi/loader/nonsfi_loader |
| 669 | NONSFI_LOADER_ARM32 = \ |
| 670 | $(NACL_ROOT)/scons-out/opt-linux-arm/obj/src/nonsfi/loader/nonsfi_loader |
| 671 | SBTC_LIBFILE = $(SB_LLVM_PATH)/lib/libLLVMSupport.a |
| 672 | SPEC_SAMPLE_PEXE = $(NACL_ROOT)/tests/spec2k/176.gcc/gcc.opt.stripped.pexe |
| 673 | |
| 674 | exists-nonsfi-x8632: |
| 675 | @if [ ! -f $(NONSFI_LOADER_X8632) ] ; then \ |
| 676 | echo "Missing file $(NONSFI_LOADER_X8632)"; \ |
Jim Stichnoth | 7146e99 | 2016-05-02 12:06:22 -0700 | [diff] [blame] | 677 | echo "Consider running './scons nonsfi_loader'" \ |
Jim Stichnoth | 96fac39 | 2016-03-11 14:58:23 -0800 | [diff] [blame] | 678 | "in the native_client directory."; \ |
| 679 | exit 1 ; \ |
| 680 | fi |
| 681 | |
| 682 | exists-nonsfi-arm32: |
| 683 | @if [ ! -f $(NONSFI_LOADER_ARM32) ] ; then \ |
| 684 | echo "Missing file $(NONSFI_LOADER_ARM32)"; \ |
Jim Stichnoth | 7146e99 | 2016-05-02 12:06:22 -0700 | [diff] [blame] | 685 | echo "Consider running './scons platform=arm nonsfi_loader'" \ |
Jim Stichnoth | 96fac39 | 2016-03-11 14:58:23 -0800 | [diff] [blame] | 686 | "in the native_client directory."; \ |
| 687 | exit 1 ; \ |
| 688 | fi |
| 689 | |
| 690 | exists-sbtc: |
| 691 | @if [ ! -f $(SBTC_LIBFILE) ] ; then \ |
| 692 | echo "Missing file $(SBTC_LIBFILE)"; \ |
| 693 | echo "Consider running 'toolchain_build_pnacl.py --build-sbtc'."; \ |
| 694 | exit 1 ; \ |
| 695 | fi |
| 696 | |
| 697 | exists-spec: |
| 698 | @if [ ! -f $(SPEC_SAMPLE_PEXE) ] ; then \ |
| 699 | echo "Missing file $(SPEC_SAMPLE_PEXE)"; \ |
| 700 | echo "Consider running" \ |
Jim Stichnoth | 7146e99 | 2016-05-02 12:06:22 -0700 | [diff] [blame] | 701 | "'./run_all.sh BuildBenchmarks 0 SetupPnaclX8632Opt'" \ |
Jim Stichnoth | 96fac39 | 2016-03-11 14:58:23 -0800 | [diff] [blame] | 702 | "in the native_client/tests/spec2k directory."; \ |
| 703 | exit 1 ; \ |
| 704 | fi |
| 705 | |
Jim Stichnoth | cc8bc16 | 2016-09-02 06:29:48 -0700 | [diff] [blame] | 706 | ifdef MIPS |
| 707 | check-presubmit presubmit: exists-sbtc |
| 708 | # Make sure clang-format gets run. |
| 709 | +make -f Makefile.standalone format |
| 710 | # Verify MINIMAL build, plus proper usage of REQUIRES in lit tests. |
| 711 | +make -f Makefile.standalone \ |
| 712 | MINIMAL=1 check |
| 713 | # Check that there are no g++ build errors or warnings. |
| 714 | +make -f Makefile.standalone \ |
| 715 | GPLUSPLUS=1 compile_only |
| 716 | # Run lit tests, cross tests, and unit tests. |
| 717 | +make -f Makefile.standalone \ |
| 718 | check |
| 719 | # Check a sandboxed translator build. |
| 720 | +make -f Makefile.standalone \ |
| 721 | DEBUG=1 sb |
| 722 | # Provide validation of user awesomeness! |
| 723 | echo Success |
| 724 | else |
Jim Stichnoth | 96fac39 | 2016-03-11 14:58:23 -0800 | [diff] [blame] | 725 | check-presubmit presubmit: exists-nonsfi-x8632 exists-nonsfi-arm32 \ |
| 726 | exists-sbtc exists-spec |
Jim Stichnoth | 23bee88 | 2015-11-17 06:14:05 -0800 | [diff] [blame] | 727 | # Make sure clang-format gets run. |
Jim Stichnoth | 6c4ad84 | 2015-11-16 12:47:57 -0800 | [diff] [blame] | 728 | +make -f Makefile.standalone format |
Jim Stichnoth | 23bee88 | 2015-11-17 06:14:05 -0800 | [diff] [blame] | 729 | # Verify MINIMAL build, plus proper usage of REQUIRES in lit tests. |
Jim Stichnoth | 6c4ad84 | 2015-11-16 12:47:57 -0800 | [diff] [blame] | 730 | +make -f Makefile.standalone \ |
Jim Stichnoth | c4ed549 | 2016-02-29 09:16:00 -0800 | [diff] [blame] | 731 | MINIMAL=1 check |
Jim Stichnoth | fc22f77 | 2015-11-22 06:06:34 -0800 | [diff] [blame] | 732 | # Check that there are no g++ build errors or warnings. |
| 733 | +make -f Makefile.standalone \ |
| 734 | GPLUSPLUS=1 compile_only |
Jim Stichnoth | 23bee88 | 2015-11-17 06:14:05 -0800 | [diff] [blame] | 735 | # Check the x86 assembler unit tests. |
Jim Stichnoth | 6c4ad84 | 2015-11-16 12:47:57 -0800 | [diff] [blame] | 736 | +make -f Makefile.standalone \ |
Jim Stichnoth | c4ed549 | 2016-02-29 09:16:00 -0800 | [diff] [blame] | 737 | DEBUG=1 CHECK_X86_ASM=1 check-unit sb |
David Sehr | b19d39c | 2016-01-13 14:17:37 -0800 | [diff] [blame] | 738 | # Run lit tests, cross tests, unit tests, and spec2k/x86-32. |
Jim Stichnoth | 6c4ad84 | 2015-11-16 12:47:57 -0800 | [diff] [blame] | 739 | +make -f Makefile.standalone \ |
Jim Stichnoth | 98ba006 | 2016-03-07 09:26:22 -0800 | [diff] [blame] | 740 | check check-spec |
John Porto | 4ab4fbe | 2016-01-20 13:44:30 -0800 | [diff] [blame] | 741 | # Run spec2k/x86-64. |
| 742 | +make -f Makefile.standalone \ |
| 743 | TARGET=x8664 check-spec |
Jim Stichnoth | 45f7700 | 2016-04-01 18:26:16 -0700 | [diff] [blame] | 744 | # Run spec2k/x86-64 with sandboxing. |
| 745 | +make -f Makefile.standalone \ |
| 746 | SPECFLAGS='-O2 --sandbox' TARGET=x8664 check-spec |
Jim Stichnoth | 23bee88 | 2015-11-17 06:14:05 -0800 | [diff] [blame] | 747 | # Build spec2k under -Om1/x86-32, to check for liveness errors. |
Jim Stichnoth | 6c4ad84 | 2015-11-16 12:47:57 -0800 | [diff] [blame] | 748 | +make -f Makefile.standalone \ |
Jim Stichnoth | 45f7700 | 2016-04-01 18:26:16 -0700 | [diff] [blame] | 749 | SPECFLAGS='-Om1' SPECRUN= check-spec |
John Porto | 4ab4fbe | 2016-01-20 13:44:30 -0800 | [diff] [blame] | 750 | # Build spec2k under -Om1/x86-64, to check for liveness errors. |
| 751 | +make -f Makefile.standalone \ |
Jim Stichnoth | 45f7700 | 2016-04-01 18:26:16 -0700 | [diff] [blame] | 752 | SPECFLAGS='-Om1' TARGET=x8664 SPECRUN= check-spec |
Jim Stichnoth | 23bee88 | 2015-11-17 06:14:05 -0800 | [diff] [blame] | 753 | # Run spec2k for x86-32 without advanced phi lowering. |
Jim Stichnoth | 6c4ad84 | 2015-11-16 12:47:57 -0800 | [diff] [blame] | 754 | +make -f Makefile.standalone \ |
Jim Stichnoth | c8f56a3 | 2016-03-07 09:54:15 -0800 | [diff] [blame] | 755 | SPECFLAGS='-O2 --sz=--phi-edge-split=0' check-spec |
John Porto | 4ab4fbe | 2016-01-20 13:44:30 -0800 | [diff] [blame] | 756 | # Run spec2k for x86-64 without advanced phi lowering. |
| 757 | +make -f Makefile.standalone \ |
Jim Stichnoth | c8f56a3 | 2016-03-07 09:54:15 -0800 | [diff] [blame] | 758 | SPECFLAGS='-O2 --sz=--phi-edge-split=0' TARGET=x8664 check-spec |
David Sehr | b19d39c | 2016-01-13 14:17:37 -0800 | [diff] [blame] | 759 | # Run cross tests and lit tests to validate filetype=asm output. |
| 760 | +make -f Makefile.standalone \ |
| 761 | FORCEASM=1 check-xtest check-lit |
Jim Stichnoth | 23bee88 | 2015-11-17 06:14:05 -0800 | [diff] [blame] | 762 | # Build spec2k for arm32. |
Jim Stichnoth | 6c4ad84 | 2015-11-16 12:47:57 -0800 | [diff] [blame] | 763 | +make -f Makefile.standalone \ |
Jim Stichnoth | 45f7700 | 2016-04-01 18:26:16 -0700 | [diff] [blame] | 764 | TARGET=arm32 SPECRUN= check-spec |
Jim Stichnoth | 23bee88 | 2015-11-17 06:14:05 -0800 | [diff] [blame] | 765 | # Build spec2k under -Om1/arm32. |
Jim Stichnoth | 6c4ad84 | 2015-11-16 12:47:57 -0800 | [diff] [blame] | 766 | +make -f Makefile.standalone \ |
Jim Stichnoth | 45f7700 | 2016-04-01 18:26:16 -0700 | [diff] [blame] | 767 | TARGET=arm32 SPECFLAGS='-Om1' SPECRUN= check-spec |
John Porto | b819665 | 2016-01-19 06:19:14 -0800 | [diff] [blame] | 768 | # Run a few spec2k tests for arm32 using qemu. Keep the list sorted in |
| 769 | # roughly reverse order of runtime. |
Jim Stichnoth | 6c4ad84 | 2015-11-16 12:47:57 -0800 | [diff] [blame] | 770 | +make -f Makefile.standalone \ |
John Porto | b819665 | 2016-01-19 06:19:14 -0800 | [diff] [blame] | 771 | TARGET=arm32 ALLSPEC='252.eon 254.gap 176.gcc 181.mcf' check-spec |
Jim Stichnoth | 23bee88 | 2015-11-17 06:14:05 -0800 | [diff] [blame] | 772 | # Provide validation of user awesomeness! |
Jim Stichnoth | 6c4ad84 | 2015-11-16 12:47:57 -0800 | [diff] [blame] | 773 | echo Success |
Jim Stichnoth | cc8bc16 | 2016-09-02 06:29:48 -0700 | [diff] [blame] | 774 | endif |
Jim Stichnoth | 6c4ad84 | 2015-11-16 12:47:57 -0800 | [diff] [blame] | 775 | |
Jim Stichnoth | e13d1eb | 2016-03-21 12:49:33 -0700 | [diff] [blame] | 776 | presubmit-lite: exists-nonsfi-x8632 exists-nonsfi-arm32 \ |
| 777 | exists-sbtc exists-spec |
| 778 | # Make sure clang-format gets run. |
| 779 | +make -f Makefile.standalone format |
| 780 | # Verify MINIMAL build, plus proper usage of REQUIRES in lit tests. |
| 781 | +make -f Makefile.standalone \ |
Jim Stichnoth | abe7dd5 | 2016-03-21 14:53:03 -0700 | [diff] [blame] | 782 | MINIMAL=1 check sb-lite |
Jim Stichnoth | e13d1eb | 2016-03-21 12:49:33 -0700 | [diff] [blame] | 783 | # Check that there are no g++ build errors or warnings. |
| 784 | +make -f Makefile.standalone \ |
| 785 | GPLUSPLUS=1 compile_only |
| 786 | # Run lit tests, cross tests, unit tests, and spec2k/x86-32. |
| 787 | +make -f Makefile.standalone \ |
| 788 | check-lit check-unit check-spec |
| 789 | +make -f Makefile.standalone \ |
| 790 | check-xtest-lite |
| 791 | # Run spec2k/x86-64. |
| 792 | +make -f Makefile.standalone \ |
| 793 | TARGET=x8664 check-spec |
| 794 | # Build spec2k under -Om1/x86-32, to check for liveness errors. |
| 795 | +make -f Makefile.standalone \ |
Jim Stichnoth | 45f7700 | 2016-04-01 18:26:16 -0700 | [diff] [blame] | 796 | SPECFLAGS='-Om1' SPECRUN= check-spec |
Jim Stichnoth | e13d1eb | 2016-03-21 12:49:33 -0700 | [diff] [blame] | 797 | # Build spec2k under -Om1/x86-64, to check for liveness errors. |
| 798 | +make -f Makefile.standalone \ |
Jim Stichnoth | 45f7700 | 2016-04-01 18:26:16 -0700 | [diff] [blame] | 799 | SPECFLAGS='-Om1' TARGET=x8664 SPECRUN= check-spec |
Jim Stichnoth | e13d1eb | 2016-03-21 12:49:33 -0700 | [diff] [blame] | 800 | # Run cross tests and lit tests to validate filetype=asm output. |
| 801 | +make -f Makefile.standalone \ |
| 802 | FORCEASM=1 check-lit |
| 803 | +make -f Makefile.standalone \ |
| 804 | FORCEASM=1 check-xtest-lite |
| 805 | # Build spec2k under -Om1/arm32. |
| 806 | +make -f Makefile.standalone \ |
Jim Stichnoth | 45f7700 | 2016-04-01 18:26:16 -0700 | [diff] [blame] | 807 | TARGET=arm32 SPECFLAGS='-Om1' SPECRUN= check-spec |
Jim Stichnoth | e13d1eb | 2016-03-21 12:49:33 -0700 | [diff] [blame] | 808 | # Run a few spec2k tests for arm32 using qemu. Keep the list sorted in |
| 809 | # roughly reverse order of runtime. |
| 810 | +make -f Makefile.standalone \ |
| 811 | TARGET=arm32 ALLSPEC='254.gap 176.gcc 181.mcf' check-spec |
| 812 | # Provide validation of user awesomeness! |
| 813 | echo Success |
| 814 | |
Jim Stichnoth | dd842db | 2015-01-27 12:53:53 -0800 | [diff] [blame] | 815 | FORMAT_BLACKLIST = |
| 816 | # Add one of the following lines for each source file to ignore. |
| 817 | FORMAT_BLACKLIST += ! -name IceParseInstsTest.cpp |
Karl Schimpf | 74cd883 | 2015-06-23 11:05:01 -0700 | [diff] [blame] | 818 | FORMAT_BLACKLIST += ! -name IceParseTypesTest.cpp |
Karl Schimpf | 3e53dc9 | 2015-10-07 13:24:01 -0700 | [diff] [blame] | 819 | FORMAT_BLACKLIST += ! -name assembler_arm.h |
| 820 | FORMAT_BLACKLIST += ! -name assembler_arm.cc |
Eric Holk | 16f8061 | 2016-04-04 17:07:42 -0700 | [diff] [blame] | 821 | FORMAT_BLACKLIST += ! -path "./wasm-install/*" |
Jim Stichnoth | a5b16ab | 2016-05-10 11:20:41 -0700 | [diff] [blame] | 822 | FORMAT_BLACKLIST += ! -path "./pnacl-llvm/*" |
Derek Schuff | bc64313 | 2014-05-22 16:39:25 -0700 | [diff] [blame] | 823 | format: |
Jim Stichnoth | 0a9e126 | 2015-04-21 09:59:21 -0700 | [diff] [blame] | 824 | $(CLANG_FORMAT_PATH)/clang-format -style=LLVM -i \ |
Jim Stichnoth | 2e7de23 | 2015-11-02 08:25:57 -0800 | [diff] [blame] | 825 | `find . -regex '.*\.\(c\|h\|cpp\)' $(FORMAT_BLACKLIST)` |
Jim Stichnoth | 240e0f8 | 2014-07-09 16:53:40 -0700 | [diff] [blame] | 826 | |
Jim Stichnoth | 240e0f8 | 2014-07-09 16:53:40 -0700 | [diff] [blame] | 827 | format-diff: |
Jim Stichnoth | 206833c | 2014-08-07 10:58:05 -0700 | [diff] [blame] | 828 | git diff -U0 `git merge-base HEAD master` | \ |
Jim Stichnoth | 2e7de23 | 2015-11-02 08:25:57 -0800 | [diff] [blame] | 829 | PATH=$(PNACL_BIN_PATH):$(PATH) \ |
| 830 | $(LLVM_SRC_PATH)/../clang/tools/clang-format/clang-format-diff.py \ |
| 831 | -p1 -style=LLVM -i |
Derek Schuff | bc64313 | 2014-05-22 16:39:25 -0700 | [diff] [blame] | 832 | |
Jim Stichnoth | 307e326 | 2015-02-12 16:10:37 -0800 | [diff] [blame] | 833 | bloat: make_symlink |
Jim Stichnoth | fa0cfa5 | 2015-02-26 09:42:36 -0800 | [diff] [blame] | 834 | nm -C -S -l pnacl-sz | \ |
Jim Stichnoth | 2e7de23 | 2015-11-02 08:25:57 -0800 | [diff] [blame] | 835 | bloat/bloat.py --nm-output=/dev/stdin syms > build/pnacl-sz.bloat.json |
Jim Stichnoth | fa0cfa5 | 2015-02-26 09:42:36 -0800 | [diff] [blame] | 836 | @echo See Subzero size breakdown in bloat/pnacl-sz.bloat.html |
Jim Stichnoth | 307e326 | 2015-02-12 16:10:37 -0800 | [diff] [blame] | 837 | |
Jim Stichnoth | c4ed549 | 2016-02-29 09:16:00 -0800 | [diff] [blame] | 838 | bloat-sb: sb_make_symlink |
| 839 | $(foreach nexe,$(NEXES),nm -C -S -l $(nexe) | bloat/bloat.py \ |
| 840 | --nm-output=/dev/stdin syms > build/$(notdir $(nexe)).bloat.json;) |
| 841 | @echo "See Subzero size breakdown in:" |
| 842 | @$(foreach nexe,$(NEXES),echo " bloat/$(notdir $(nexe)).bloat.html";) |
| 843 | |
Andrew Scull | a509e1d | 2015-06-29 11:07:08 -0700 | [diff] [blame] | 844 | docs: |
Reed Kotler | 4cba1cb | 2016-01-07 08:45:13 -0800 | [diff] [blame] | 845 | make -C docs -f Makefile.standalone |
Andrew Scull | a509e1d | 2015-06-29 11:07:08 -0700 | [diff] [blame] | 846 | |
Reed Kotler | 2c3c82e | 2016-01-21 20:33:08 -0800 | [diff] [blame] | 847 | help: |
| 848 | @cat Makefile.standalone-help/help.txt |
| 849 | |
| 850 | help-check-lit: |
| 851 | @cat Makefile.standalone-help/check-lit.txt |
| 852 | |
| 853 | help-check-xtest: |
| 854 | @cat Makefile.standalone-help/check-xtest.txt |
| 855 | |
Derek Schuff | bc64313 | 2014-05-22 16:39:25 -0700 | [diff] [blame] | 856 | clean: |
Jim Stichnoth | c4ed549 | 2016-02-29 09:16:00 -0800 | [diff] [blame] | 857 | rm -rf pnacl-sz *.o $(foreach nexe,$(NEXES),$(notdir $(nexe))) \ |
| 858 | $(OBJDIR) $(SB_OBJDIR) $(SBB_OBJDIR) build/*.bloat.json |
Karl Schimpf | b262c5e | 2014-10-27 14:41:57 -0700 | [diff] [blame] | 859 | |
| 860 | clean-all: clean |
Jim Stichnoth | 96fac39 | 2016-03-11 14:58:23 -0800 | [diff] [blame] | 861 | rm -rf build/ crosstest/Output/ |