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 | |
Jim Stichnoth | 0a9e126 | 2015-04-21 09:59:21 -0700 | [diff] [blame] | 36 | # 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] | 37 | # 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] | 38 | # autoconf build, otherwise it is a cmake build. AUTOCONF is set to 0 for |
| 39 | # cmake, nonzero for autoconf. |
| 40 | AUTOCONF ?= $(shell ldd $(PNACL_BIN_PATH)/opt | grep -c libLLVM-) |
| 41 | |
Jan Voung | 68a0633 | 2015-03-05 14:33:38 -0800 | [diff] [blame] | 42 | # CLANG_PATH is the location of the clang compiler to use for building |
| 43 | # the host binaries. |
Karl Schimpf | 8fcefc3 | 2014-09-15 12:56:50 -0700 | [diff] [blame] | 44 | CLANG_PATH ?= $(shell readlink -e \ |
Jim Stichnoth | 2e7de23 | 2015-11-02 08:25:57 -0800 | [diff] [blame] | 45 | $(NACL_ROOT)/../third_party/llvm-build/Release+Asserts/bin) |
Karl Schimpf | 8fcefc3 | 2014-09-15 12:56:50 -0700 | [diff] [blame] | 46 | |
Jan Voung | 68a0633 | 2015-03-05 14:33:38 -0800 | [diff] [blame] | 47 | # LIBCXX_INSTALL_PATH is the directory where libc++ is located. It should |
| 48 | # contain header files and corresponding libraries. This is used for |
| 49 | # building the host binaries in conjuction with clang. |
| 50 | LIBCXX_INSTALL_PATH ?= $(PNACL_TOOLCHAIN_ROOT) |
Karl Schimpf | 9d92854 | 2015-04-16 15:08:05 -0700 | [diff] [blame] | 51 | STDLIB_FLAGS := -stdlib=libc++ -I$(LIBCXX_INSTALL_PATH)/include/c++/v1 |
Jan Voung | 68a0633 | 2015-03-05 14:33:38 -0800 | [diff] [blame] | 52 | |
Jan Voung | 4c127ba | 2014-09-19 13:11:36 -0700 | [diff] [blame] | 53 | HOST_ARCH ?= x86_64 |
Jan Voung | 839c4ce | 2014-07-28 15:19:43 -0700 | [diff] [blame] | 54 | ifeq ($(HOST_ARCH),x86_64) |
Jim Stichnoth | 6c6adf1 | 2015-04-07 14:22:25 -0700 | [diff] [blame] | 55 | HOST_FLAGS = -m64 |
Jan Voung | 839c4ce | 2014-07-28 15:19:43 -0700 | [diff] [blame] | 56 | else |
| 57 | ifeq ($(HOST_ARCH),x86) |
Jim Stichnoth | 6c6adf1 | 2015-04-07 14:22:25 -0700 | [diff] [blame] | 58 | HOST_FLAGS = -m32 |
Jan Voung | 839c4ce | 2014-07-28 15:19:43 -0700 | [diff] [blame] | 59 | endif |
| 60 | endif |
| 61 | |
Jim Stichnoth | fddef24 | 2014-09-26 18:53:41 -0700 | [diff] [blame] | 62 | ifdef DEBUG |
| 63 | OBJDIR = build/Debug |
| 64 | OPTLEVEL = -O0 |
Jan Voung | 44c3a80 | 2015-03-27 16:29:08 -0700 | [diff] [blame] | 65 | LINKOPTLEVEL = -O0 |
Jim Stichnoth | fddef24 | 2014-09-26 18:53:41 -0700 | [diff] [blame] | 66 | else |
| 67 | OBJDIR = build/Release |
Jim Stichnoth | a49e9d9 | 2014-12-07 14:25:34 -0800 | [diff] [blame] | 68 | OPTLEVEL = -O2 -ffunction-sections -fdata-sections |
Jan Voung | 44c3a80 | 2015-03-27 16:29:08 -0700 | [diff] [blame] | 69 | LINKOPTLEVEL = -O2 |
Jim Stichnoth | fddef24 | 2014-09-26 18:53:41 -0700 | [diff] [blame] | 70 | endif |
| 71 | |
Karl Schimpf | b262c5e | 2014-10-27 14:41:57 -0700 | [diff] [blame] | 72 | # The list of CXX defines that are dependent on build parameters. |
Jan Voung | 44c3a80 | 2015-03-27 16:29:08 -0700 | [diff] [blame] | 73 | BASE_CXX_DEFINES = |
Jim Stichnoth | fa4efea | 2015-01-27 05:06:03 -0800 | [diff] [blame] | 74 | CXX_EXTRA = |
| 75 | LD_EXTRA = |
Karl Schimpf | b262c5e | 2014-10-27 14:41:57 -0700 | [diff] [blame] | 76 | |
| 77 | ifdef MINIMAL |
Jim Stichnoth | e3c02c2 | 2014-12-05 14:16:07 -0800 | [diff] [blame] | 78 | NOASSERT = 1 |
Karl Schimpf | b262c5e | 2014-10-27 14:41:57 -0700 | [diff] [blame] | 79 | OBJDIR := $(OBJDIR)+Min |
Jan Voung | 44c3a80 | 2015-03-27 16:29:08 -0700 | [diff] [blame] | 80 | BASE_CXX_DEFINES += -DALLOW_DUMP=0 -DALLOW_LLVM_CL=0 -DALLOW_LLVM_IR=0 \ |
Jim Stichnoth | 0d4fc92 | 2015-12-13 21:36:33 -0800 | [diff] [blame] | 81 | -DALLOW_LLVM_IR_AS_INPUT=0 -DALLOW_MINIMAL_BUILD=1 |
Karl Schimpf | b262c5e | 2014-10-27 14:41:57 -0700 | [diff] [blame] | 82 | else |
Jan Voung | 44c3a80 | 2015-03-27 16:29:08 -0700 | [diff] [blame] | 83 | BASE_CXX_DEFINES += -DALLOW_DUMP=1 -DALLOW_LLVM_CL=1 -DALLOW_LLVM_IR=1 \ |
Jim Stichnoth | 0d4fc92 | 2015-12-13 21:36:33 -0800 | [diff] [blame] | 84 | -DALLOW_LLVM_IR_AS_INPUT=1 -DALLOW_MINIMAL_BUILD=0 |
Karl Schimpf | b262c5e | 2014-10-27 14:41:57 -0700 | [diff] [blame] | 85 | endif |
| 86 | |
Jan Voung | 44c3a80 | 2015-03-27 16:29:08 -0700 | [diff] [blame] | 87 | SB_CXX_DEFINES := $(BASE_CXX_DEFINES) -DPNACL_BROWSER_TRANSLATOR=1 |
| 88 | CXX_DEFINES := $(BASE_CXX_DEFINES) -DPNACL_BROWSER_TRANSLATOR=0 |
| 89 | |
Jim Stichnoth | 9c234e2 | 2014-10-01 09:28:21 -0700 | [diff] [blame] | 90 | ifdef NOASSERT |
| 91 | ASSERTIONS = -DNDEBUG |
| 92 | else |
| 93 | ASSERTIONS = |
| 94 | OBJDIR := $(OBJDIR)+Asserts |
| 95 | endif |
| 96 | |
Jim Stichnoth | fc22f77 | 2015-11-22 06:06:34 -0800 | [diff] [blame] | 97 | # Use g++ to compile, to check for errors/warnings that clang++ might have |
| 98 | # missed. It's unlikely to link, unless LLVM was also built with g++, so the |
| 99 | # compile_only target should be used. |
| 100 | ifdef GPLUSPLUS |
| 101 | CXX = CCACHE_CPP2=yes $(CCACHE) g++ |
| 102 | STDLIB_FLAGS = |
| 103 | LLVM_EXTRA_WARNINGS="-Wno-unknown-pragmas -Wno-unused-parameter \ |
| 104 | -Wno-comment -Wno-enum-compare -Wno-strict-aliasing" |
| 105 | OBJDIR := $(OBJDIR)+Gplusplus |
| 106 | endif |
| 107 | |
Andrew Scull | 6ef7949 | 2015-09-09 15:50:42 -0700 | [diff] [blame] | 108 | ifdef UBSAN |
| 109 | OBJDIR := $(OBJDIR)+UBSan |
Jim Stichnoth | 2e7de23 | 2015-11-02 08:25:57 -0800 | [diff] [blame] | 110 | CXX_EXTRA += -fsanitize=undefined -fno-sanitize=vptr \ |
| 111 | -fno-sanitize=nonnull-attribute |
Andrew Scull | 6ef7949 | 2015-09-09 15:50:42 -0700 | [diff] [blame] | 112 | LD_EXTRA += -fsanitize=undefined |
| 113 | endif |
| 114 | |
| 115 | ifdef UBSAN_TRAP |
| 116 | OBJDIR := $(OBJDIR)+UBSan_Trap |
Jim Stichnoth | 2e7de23 | 2015-11-02 08:25:57 -0800 | [diff] [blame] | 117 | CXX_EXTRA += -fsanitize=undefined-trap -fsanitize-undefined-trap-on-error \ |
| 118 | -fno-sanitize=vptr -fno-sanitize=nonnull-attribute |
Andrew Scull | 6ef7949 | 2015-09-09 15:50:42 -0700 | [diff] [blame] | 119 | LD_EXTRA += -fsanitize=undefined-trap |
| 120 | endif |
| 121 | |
Jim Stichnoth | fa4efea | 2015-01-27 05:06:03 -0800 | [diff] [blame] | 122 | ifdef TSAN |
| 123 | OBJDIR := $(OBJDIR)+TSan |
| 124 | CXX_EXTRA += -fsanitize=thread |
| 125 | LD_EXTRA += -fsanitize=thread |
| 126 | endif |
| 127 | |
Andrew Scull | 86df4e9 | 2015-07-30 13:54:44 -0700 | [diff] [blame] | 128 | ifdef ASAN |
| 129 | OBJDIR := $(OBJDIR)+ASan |
| 130 | CXX_EXTRA += -fsanitize=address |
| 131 | LD_EXTRA += -fsanitize=address |
| 132 | endif |
| 133 | |
Andrew Scull | 6ef7949 | 2015-09-09 15:50:42 -0700 | [diff] [blame] | 134 | ifdef MSAN |
Andrew Scull | 00741a0 | 2015-09-16 19:04:09 -0700 | [diff] [blame] | 135 | # TODO(ascull): this has an as yet undiagnosed uninitialized memory access |
Andrew Scull | 6ef7949 | 2015-09-09 15:50:42 -0700 | [diff] [blame] | 136 | OBJDIR := $(OBJDIR)+MSan |
| 137 | CXX_EXTRA += -fsanitize=memory |
| 138 | LD_EXTRA += -fsanitize=memory |
| 139 | endif |
| 140 | |
Jan Voung | 44c3a80 | 2015-03-27 16:29:08 -0700 | [diff] [blame] | 141 | SB_OBJDIR := $(OBJDIR)+Sandboxed |
| 142 | |
Derek Schuff | bc64313 | 2014-05-22 16:39:25 -0700 | [diff] [blame] | 143 | $(info -----------------------------------------------) |
| 144 | $(info Using LLVM_SRC_PATH = $(LLVM_SRC_PATH)) |
Jan Voung | 44c3a80 | 2015-03-27 16:29:08 -0700 | [diff] [blame] | 145 | $(info Using SB_LLVM_PATH = $(SB_LLVM_PATH)) |
| 146 | $(info Using NACL_ROOT = $(NACL_ROOT)) |
Jan Voung | 8e32fed | 2015-06-17 10:16:23 -0700 | [diff] [blame] | 147 | $(info Using TOOLCHAIN_ROOT = $(TOOLCHAIN_ROOT)) |
Jan Voung | 68a0633 | 2015-03-05 14:33:38 -0800 | [diff] [blame] | 148 | $(info Using PNACL_TOOLCHAIN_ROOT = $(PNACL_TOOLCHAIN_ROOT)) |
Jan Voung | 44c3a80 | 2015-03-27 16:29:08 -0700 | [diff] [blame] | 149 | $(info Using PNACL_BIN_PATH = $(PNACL_BIN_PATH)) |
Karl Schimpf | 8fcefc3 | 2014-09-15 12:56:50 -0700 | [diff] [blame] | 150 | $(info Using CLANG_PATH = $(CLANG_PATH)) |
Jan Voung | 68a0633 | 2015-03-05 14:33:38 -0800 | [diff] [blame] | 151 | $(info Using LIBCXX_INSTALL_PATH = $(LIBCXX_INSTALL_PATH)) |
Jan Voung | 839c4ce | 2014-07-28 15:19:43 -0700 | [diff] [blame] | 152 | $(info Using HOST_ARCH = $(HOST_ARCH)) |
Derek Schuff | bc64313 | 2014-05-22 16:39:25 -0700 | [diff] [blame] | 153 | $(info -----------------------------------------------) |
| 154 | |
Jim Stichnoth | 0a9e126 | 2015-04-21 09:59:21 -0700 | [diff] [blame] | 155 | LLVM_CXXFLAGS := `$(PNACL_BIN_PATH)/llvm-config --cxxflags` |
Jan Voung | 44c3a80 | 2015-03-27 16:29:08 -0700 | [diff] [blame] | 156 | SB_LLVM_CXXFLAGS := $(LLVM_CXXFLAGS) |
| 157 | |
| 158 | # Listing specific libraries that are needed for pnacl-sz |
| 159 | # and the unittests, since we build "tools-only" for the |
| 160 | # sandboxed_translators (which doesn't include every library |
| 161 | # listed by llvm-config). |
Jim Stichnoth | 0a9e126 | 2015-04-21 09:59:21 -0700 | [diff] [blame] | 162 | |
| 163 | LLVM_LIBS_LIST := -lLLVMIRReader -lLLVMBitReader -lLLVMNaClBitTestUtils \ |
| 164 | -lLLVMNaClBitReader -lLLVMNaClBitAnalysis -lLLVMNaClBitWriter \ |
| 165 | -lLLVMAsmParser -lLLVMNaClAnalysis -lLLVMCore -lLLVMSupport |
| 166 | |
| 167 | ifeq ($(AUTOCONF), 0) |
| 168 | # LLVM cmake build |
Karl Schimpf | 28f3f73 | 2015-06-24 09:32:40 -0700 | [diff] [blame] | 169 | LLVM_LIBS := $(LLVM_LIBS_LIST) |
Jim Stichnoth | 0a9e126 | 2015-04-21 09:59:21 -0700 | [diff] [blame] | 170 | # For the cmake build, the gtest libs end up in the same place as the LLVM |
| 171 | # libs, so no "-L..." arg is needed. |
| 172 | GTEST_LIB_PATH ?= |
| 173 | CLANG_FORMAT_PATH ?= $(PNACL_BIN_PATH) |
| 174 | else |
| 175 | # LLVM autoconf build |
Jim Stichnoth | e5b58fb | 2015-06-01 15:17:20 -0700 | [diff] [blame] | 176 | LLVM_LIBS := -lLLVM-3.7svn |
Jim Stichnoth | 0a9e126 | 2015-04-21 09:59:21 -0700 | [diff] [blame] | 177 | GTEST_LIB_PATH ?= -L../../out/llvm_x86_64_linux_work/Release+Asserts/lib |
| 178 | CLANG_FORMAT_PATH ?= ../../out/llvm_x86_64_linux_work/Release+Asserts/bin |
| 179 | endif |
| 180 | |
Jan Voung | 44c3a80 | 2015-03-27 16:29:08 -0700 | [diff] [blame] | 181 | LLVM_LDFLAGS := $(LLVM_LIBS) \ |
Jim Stichnoth | 0a9e126 | 2015-04-21 09:59:21 -0700 | [diff] [blame] | 182 | `$(PNACL_BIN_PATH)/llvm-config --ldflags` \ |
| 183 | `$(PNACL_BIN_PATH)/llvm-config --system-libs` |
| 184 | SB_LLVM_LDFLAGS := $(LLVM_LIBS_LIST) \ |
Jan Voung | 44c3a80 | 2015-03-27 16:29:08 -0700 | [diff] [blame] | 185 | -L$(SB_LLVM_PATH)/lib |
Derek Schuff | bc64313 | 2014-05-22 16:39:25 -0700 | [diff] [blame] | 186 | |
Jim Stichnoth | 5e06f9f | 2014-09-17 08:41:21 -0700 | [diff] [blame] | 187 | CCACHE := `command -v ccache` |
| 188 | CXX := CCACHE_CPP2=yes $(CCACHE) $(CLANG_PATH)/clang++ |
Jan Voung | 44c3a80 | 2015-03-27 16:29:08 -0700 | [diff] [blame] | 189 | SB_CXX := CCACHE_CPP2=yes $(CCACHE) $(PNACL_BIN_PATH)/pnacl-clang++ |
| 190 | SB_TRANSLATE := $(PNACL_BIN_PATH)/pnacl-translate |
Jan Voung | 839c4ce | 2014-07-28 15:19:43 -0700 | [diff] [blame] | 191 | |
Jan Voung | c2648c2 | 2015-07-30 21:29:14 -0700 | [diff] [blame] | 192 | # Extra warnings that LLVM's build system adds in addition to -Wall. |
| 193 | LLVM_EXTRA_WARNINGS := -Wcovered-switch-default |
| 194 | |
Jan Voung | 44c3a80 | 2015-03-27 16:29:08 -0700 | [diff] [blame] | 195 | BASE_CXXFLAGS := -std=gnu++11 -Wall -Wextra -Werror -fno-rtti \ |
Jim Stichnoth | 2e7de23 | 2015-11-02 08:25:57 -0800 | [diff] [blame] | 196 | -fno-exceptions $(OPTLEVEL) $(ASSERTIONS) -g -pedantic \ |
| 197 | $(LLVM_EXTRA_WARNINGS) $(CXX_EXTRA) |
Jan Voung | 44c3a80 | 2015-03-27 16:29:08 -0700 | [diff] [blame] | 198 | |
| 199 | CXXFLAGS := $(LLVM_CXXFLAGS) $(BASE_CXXFLAGS) $(CXX_DEFINES) $(HOST_FLAGS) \ |
Jim Stichnoth | 2e7de23 | 2015-11-02 08:25:57 -0800 | [diff] [blame] | 200 | $(STDLIB_FLAGS) |
Jan Voung | 44c3a80 | 2015-03-27 16:29:08 -0700 | [diff] [blame] | 201 | SB_CXXFLAGS := $(SB_LLVM_CXXFLAGS) $(BASE_CXXFLAGS) $(SB_CXX_DEFINES) |
| 202 | |
Jim Stichnoth | fa4efea | 2015-01-27 05:06:03 -0800 | [diff] [blame] | 203 | LDFLAGS := $(HOST_FLAGS) -L$(LIBCXX_INSTALL_PATH)/lib -Wl,--gc-sections \ |
Jim Stichnoth | 2e7de23 | 2015-11-02 08:25:57 -0800 | [diff] [blame] | 204 | $(LD_EXTRA) $(STDLIB_FLAGS) |
Jan Voung | 44c3a80 | 2015-03-27 16:29:08 -0700 | [diff] [blame] | 205 | # Not specifying -Wl,--gc-sections but instead doing bitcode linking GC w/ LTO. |
| 206 | SB_LDFLAGS := $(LINKOPTLEVEL) $(LD_EXTRA) |
Derek Schuff | bc64313 | 2014-05-22 16:39:25 -0700 | [diff] [blame] | 207 | |
Jim Stichnoth | c59288b | 2015-11-09 11:38:40 -0800 | [diff] [blame] | 208 | # List the target-specific source files first, which generally take longer to |
| 209 | # compile, in the hope of improving parallel build time. |
Karl Schimpf | ab06df3 | 2014-10-29 14:58:25 -0700 | [diff] [blame] | 210 | SRCS = \ |
Jim Stichnoth | 2e7de23 | 2015-11-02 08:25:57 -0800 | [diff] [blame] | 211 | IceAssemblerARM32.cpp \ |
Jim Stichnoth | c59288b | 2015-11-09 11:38:40 -0800 | [diff] [blame] | 212 | IceInstARM32.cpp \ |
| 213 | IceInstMIPS32.cpp \ |
| 214 | IceInstX8632.cpp \ |
| 215 | IceInstX8664.cpp \ |
| 216 | IceTargetLowering.cpp \ |
| 217 | IceTargetLoweringARM32.cpp \ |
| 218 | IceTargetLoweringMIPS32.cpp \ |
| 219 | IceTargetLoweringX8632.cpp \ |
| 220 | IceTargetLoweringX8664.cpp \ |
| 221 | IceAssembler.cpp \ |
Jim Stichnoth | 2e7de23 | 2015-11-02 08:25:57 -0800 | [diff] [blame] | 222 | IceBrowserCompileServer.cpp \ |
| 223 | IceCfg.cpp \ |
| 224 | IceCfgNode.cpp \ |
| 225 | IceClFlags.cpp \ |
| 226 | IceCompiler.cpp \ |
| 227 | IceCompileServer.cpp \ |
| 228 | IceELFObjectWriter.cpp \ |
| 229 | IceELFSection.cpp \ |
| 230 | IceFixups.cpp \ |
| 231 | IceGlobalContext.cpp \ |
| 232 | IceGlobalInits.cpp \ |
| 233 | IceInst.cpp \ |
Jim Stichnoth | 2e7de23 | 2015-11-02 08:25:57 -0800 | [diff] [blame] | 234 | IceIntrinsics.cpp \ |
| 235 | IceLiveness.cpp \ |
| 236 | IceLoopAnalyzer.cpp \ |
| 237 | IceOperand.cpp \ |
| 238 | IceRegAlloc.cpp \ |
| 239 | IceRNG.cpp \ |
| 240 | IceSwitchLowering.cpp \ |
Jim Stichnoth | 2e7de23 | 2015-11-02 08:25:57 -0800 | [diff] [blame] | 241 | IceThreading.cpp \ |
| 242 | IceTimerTree.cpp \ |
| 243 | IceTranslator.cpp \ |
| 244 | IceTypes.cpp \ |
| 245 | main.cpp \ |
| 246 | PNaClTranslator.cpp |
Derek Schuff | bc64313 | 2014-05-22 16:39:25 -0700 | [diff] [blame] | 247 | |
Karl Schimpf | ab06df3 | 2014-10-29 14:58:25 -0700 | [diff] [blame] | 248 | ifndef MINIMAL |
Jim Stichnoth | 2e7de23 | 2015-11-02 08:25:57 -0800 | [diff] [blame] | 249 | SRCS += \ |
| 250 | IceConverter.cpp \ |
| 251 | IceTypeConverter.cpp |
Karl Schimpf | ab06df3 | 2014-10-29 14:58:25 -0700 | [diff] [blame] | 252 | endif |
| 253 | |
Jim Stichnoth | fddef24 | 2014-09-26 18:53:41 -0700 | [diff] [blame] | 254 | OBJS=$(patsubst %.cpp, $(OBJDIR)/%.o, $(SRCS)) |
Jan Voung | 44c3a80 | 2015-03-27 16:29:08 -0700 | [diff] [blame] | 255 | SB_OBJS=$(patsubst %.cpp, $(SB_OBJDIR)/%.o, $(SRCS)) |
Derek Schuff | bc64313 | 2014-05-22 16:39:25 -0700 | [diff] [blame] | 256 | |
Jan Voung | 08c3bcd | 2014-12-01 17:55:16 -0800 | [diff] [blame] | 257 | UNITTEST_SRCS = \ |
Jim Stichnoth | 2e7de23 | 2015-11-02 08:25:57 -0800 | [diff] [blame] | 258 | BitcodeMunge.cpp \ |
| 259 | IceELFSectionTest.cpp \ |
| 260 | IceParseInstsTest.cpp |
John Porto | 59f2d92 | 2015-07-31 13:45:48 -0700 | [diff] [blame] | 261 | |
| 262 | # The X86 assembler tests take too long to compile. Given how infrequently the |
| 263 | # assembler will change, we disable them. |
| 264 | ifdef CHECK_X86_ASM |
Jim Stichnoth | 2e7de23 | 2015-11-02 08:25:57 -0800 | [diff] [blame] | 265 | ifndef DEBUG |
| 266 | $(error Run check-unit with DEBUG=1 lest your machine perish) |
| 267 | endif |
John Porto | 59f2d92 | 2015-07-31 13:45:48 -0700 | [diff] [blame] | 268 | UNITTEST_SRCS += AssemblerX8632/LowLevel.cpp \ |
Jim Stichnoth | 2e7de23 | 2015-11-02 08:25:57 -0800 | [diff] [blame] | 269 | AssemblerX8632/DataMov.cpp \ |
| 270 | AssemblerX8632/Locked.cpp \ |
| 271 | AssemblerX8632/GPRArith.cpp \ |
| 272 | AssemblerX8632/XmmArith.cpp \ |
| 273 | AssemblerX8632/ControlFlow.cpp \ |
| 274 | AssemblerX8632/Other.cpp \ |
| 275 | AssemblerX8632/X87.cpp \ |
| 276 | AssemblerX8664/LowLevel.cpp \ |
| 277 | AssemblerX8664/DataMov.cpp \ |
| 278 | AssemblerX8664/Locked.cpp \ |
| 279 | AssemblerX8664/GPRArith.cpp \ |
| 280 | AssemblerX8664/XmmArith.cpp \ |
| 281 | AssemblerX8664/ControlFlow.cpp \ |
| 282 | AssemblerX8664/Other.cpp |
John Porto | 59f2d92 | 2015-07-31 13:45:48 -0700 | [diff] [blame] | 283 | endif |
Jan Voung | 08c3bcd | 2014-12-01 17:55:16 -0800 | [diff] [blame] | 284 | |
| 285 | UNITTEST_OBJS = $(patsubst %.cpp, $(OBJDIR)/unittest/%.o, $(UNITTEST_SRCS)) |
Jim Stichnoth | fa0cfa5 | 2015-02-26 09:42:36 -0800 | [diff] [blame] | 286 | UNITTEST_LIB_OBJS = $(filter-out $(OBJDIR)/main.o,$(OBJS)) |
Jan Voung | 08c3bcd | 2014-12-01 17:55:16 -0800 | [diff] [blame] | 287 | |
Derek Schuff | bc64313 | 2014-05-22 16:39:25 -0700 | [diff] [blame] | 288 | # Keep all the first target so it's the default. |
Jim Stichnoth | fa0cfa5 | 2015-02-26 09:42:36 -0800 | [diff] [blame] | 289 | all: $(OBJDIR)/pnacl-sz make_symlink runtime |
Derek Schuff | bc64313 | 2014-05-22 16:39:25 -0700 | [diff] [blame] | 290 | |
Jan Voung | 44c3a80 | 2015-03-27 16:29:08 -0700 | [diff] [blame] | 291 | ifdef TSAN |
| 292 | sb: |
| 293 | @echo "Skipping pnacl-sz.*.nexe: TSAN isn't supported under NaCl." |
| 294 | else |
| 295 | sb: $(SB_OBJDIR)/pnacl-sz.x86-32.nexe |
| 296 | endif |
| 297 | |
Karl Schimpf | 6f9ba11 | 2015-06-22 13:20:23 -0700 | [diff] [blame] | 298 | # SHOW_BUILD_ATTS is an executable that is run to show what build |
| 299 | # attributes were used to build pnacl-sz. |
Karl Schimpf | cb6e95a | 2015-07-23 09:10:03 -0700 | [diff] [blame] | 300 | SHOW_BUILD_ATTS = $(OBJDIR)/pnacl-sz --build-atts |
Karl Schimpf | 6f9ba11 | 2015-06-22 13:20:23 -0700 | [diff] [blame] | 301 | |
Karl Schimpf | 6af6336 | 2014-10-29 14:55:00 -0700 | [diff] [blame] | 302 | # Creates symbolic link so that testing is easier. Also runs |
Jim Stichnoth | fa0cfa5 | 2015-02-26 09:42:36 -0800 | [diff] [blame] | 303 | # pnacl-sz to verify that the defines flags have valid values, |
Karl Schimpf | 6af6336 | 2014-10-29 14:55:00 -0700 | [diff] [blame] | 304 | # as well as describe the corresponding build attributes. |
Jim Stichnoth | fa0cfa5 | 2015-02-26 09:42:36 -0800 | [diff] [blame] | 305 | make_symlink: $(OBJDIR)/pnacl-sz |
| 306 | rm -rf pnacl-sz |
| 307 | ln -s $(OBJDIR)/pnacl-sz |
Karl Schimpf | 6af6336 | 2014-10-29 14:55:00 -0700 | [diff] [blame] | 308 | @echo "Build Attributes:" |
Karl Schimpf | 6f9ba11 | 2015-06-22 13:20:23 -0700 | [diff] [blame] | 309 | @$(SHOW_BUILD_ATTS) |
Derek Schuff | bc64313 | 2014-05-22 16:39:25 -0700 | [diff] [blame] | 310 | |
Jim Stichnoth | 23bee88 | 2015-11-17 06:14:05 -0800 | [diff] [blame] | 311 | .PHONY: all compile_only make_symlink runtime bloat sb docs |
| 312 | |
| 313 | compile_only: $(OBJS) |
Jim Stichnoth | fddef24 | 2014-09-26 18:53:41 -0700 | [diff] [blame] | 314 | |
Jim Stichnoth | fa0cfa5 | 2015-02-26 09:42:36 -0800 | [diff] [blame] | 315 | $(OBJDIR)/pnacl-sz: $(OBJS) |
Jim Stichnoth | 3324642 | 2014-11-24 14:36:23 -0800 | [diff] [blame] | 316 | $(CXX) $(LDFLAGS) -o $@ $^ $(LLVM_LDFLAGS) \ |
Jim Stichnoth | 2e7de23 | 2015-11-02 08:25:57 -0800 | [diff] [blame] | 317 | -Wl,-rpath=$(abspath $(LIBCXX_INSTALL_PATH)/lib) |
Derek Schuff | bc64313 | 2014-05-22 16:39:25 -0700 | [diff] [blame] | 318 | |
Jan Voung | 44c3a80 | 2015-03-27 16:29:08 -0700 | [diff] [blame] | 319 | $(SB_OBJDIR)/pnacl-sz.x86-32.nexe: $(SB_OBJS) |
| 320 | $(eval PNACL_SZ_BASE := $(patsubst %.nexe, %, $@)) |
| 321 | $(SB_CXX) $(SB_LDFLAGS) -o $(PNACL_SZ_BASE).nonfinal.pexe $^ \ |
Jim Stichnoth | 2e7de23 | 2015-11-02 08:25:57 -0800 | [diff] [blame] | 322 | $(SB_LLVM_LDFLAGS) |
Jan Voung | 44c3a80 | 2015-03-27 16:29:08 -0700 | [diff] [blame] | 323 | $(SB_TRANSLATE) -arch x86-32 $(PNACL_SZ_BASE).nonfinal.pexe -o $@ \ |
Jim Stichnoth | 2e7de23 | 2015-11-02 08:25:57 -0800 | [diff] [blame] | 324 | --allow-llvm-bitcode-input |
Jan Voung | 44c3a80 | 2015-03-27 16:29:08 -0700 | [diff] [blame] | 325 | |
John Porto | 2187c84 | 2015-12-16 07:48:25 -0800 | [diff] [blame] | 326 | src/IceRegistersARM32.def: pydir/gen_arm32_reg_tables.py |
| 327 | python $< > $@ |
| 328 | |
Jim Stichnoth | dd842db | 2015-01-27 12:53:53 -0800 | [diff] [blame] | 329 | # TODO(stichnot): Be more precise than "*.h" here and elsewhere. |
Jim Stichnoth | fddef24 | 2014-09-26 18:53:41 -0700 | [diff] [blame] | 330 | $(OBJS): $(OBJDIR)/%.o: src/%.cpp src/*.h src/*.def |
Derek Schuff | bc64313 | 2014-05-22 16:39:25 -0700 | [diff] [blame] | 331 | $(CXX) -c $(CXXFLAGS) $< -o $@ |
| 332 | |
Jan Voung | 44c3a80 | 2015-03-27 16:29:08 -0700 | [diff] [blame] | 333 | $(SB_OBJS): $(SB_OBJDIR)/%.o: src/%.cpp src/*.h src/*.def |
| 334 | $(SB_CXX) -c $(SB_CXXFLAGS) $< -o $@ |
| 335 | |
Jan Voung | 08c3bcd | 2014-12-01 17:55:16 -0800 | [diff] [blame] | 336 | $(OBJDIR)/run_unittests: $(UNITTEST_OBJS) $(UNITTEST_LIB_OBJS) |
Jim Stichnoth | e7e9b02 | 2015-04-21 15:05:22 -0700 | [diff] [blame] | 337 | $(CXX) $(GTEST_LIB_PATH) $(LDFLAGS) -o $@ $^ $(LLVM_LDFLAGS) \ |
Jim Stichnoth | 2e7de23 | 2015-11-02 08:25:57 -0800 | [diff] [blame] | 338 | -lgtest -lgtest_main -ldl \ |
| 339 | -Wl,-rpath=$(abspath $(LIBCXX_INSTALL_PATH)/lib) |
Jan Voung | 08c3bcd | 2014-12-01 17:55:16 -0800 | [diff] [blame] | 340 | |
Jim Stichnoth | 2e7de23 | 2015-11-02 08:25:57 -0800 | [diff] [blame] | 341 | $(UNITTEST_OBJS): $(OBJDIR)/unittest/%.o: unittest/%.cpp unittest/*.h \ |
| 342 | src/*.h src/*.def |
Jan Voung | 08c3bcd | 2014-12-01 17:55:16 -0800 | [diff] [blame] | 343 | $(CXX) -c $(CXXFLAGS) \ |
Jim Stichnoth | 2e7de23 | 2015-11-02 08:25:57 -0800 | [diff] [blame] | 344 | -Isrc/ \ |
| 345 | -Iunittest/ \ |
| 346 | -I$(LLVM_SRC_PATH)/utils/unittest/googletest/include \ |
| 347 | -I$(LLVM_SRC_PATH) \ |
| 348 | -DGTEST_HAS_RTTI=0 -DGTEST_USE_OWN_TR1_TUPLE \ |
| 349 | $< -o $@ |
Jan Voung | 08c3bcd | 2014-12-01 17:55:16 -0800 | [diff] [blame] | 350 | |
Jim Stichnoth | fddef24 | 2014-09-26 18:53:41 -0700 | [diff] [blame] | 351 | $(OBJS): | $(OBJDIR) |
Jan Voung | 44c3a80 | 2015-03-27 16:29:08 -0700 | [diff] [blame] | 352 | $(SB_OBJS): | $(SB_OBJDIR) |
Derek Schuff | bc64313 | 2014-05-22 16:39:25 -0700 | [diff] [blame] | 353 | |
Jim Stichnoth | 2e7de23 | 2015-11-02 08:25:57 -0800 | [diff] [blame] | 354 | $(UNITTEST_OBJS): | $(OBJDIR)/unittest $(OBJDIR)/unittest/AssemblerX8632 \ |
| 355 | $(OBJDIR)/unittest/AssemblerX8664 |
Jan Voung | 08c3bcd | 2014-12-01 17:55:16 -0800 | [diff] [blame] | 356 | |
Jim Stichnoth | fddef24 | 2014-09-26 18:53:41 -0700 | [diff] [blame] | 357 | $(OBJDIR): |
Derek Schuff | bc64313 | 2014-05-22 16:39:25 -0700 | [diff] [blame] | 358 | @mkdir -p $@ |
Jan Voung | 44c3a80 | 2015-03-27 16:29:08 -0700 | [diff] [blame] | 359 | $(SB_OBJDIR): |
| 360 | @mkdir -p $@ |
Derek Schuff | bc64313 | 2014-05-22 16:39:25 -0700 | [diff] [blame] | 361 | |
Jan Voung | 08c3bcd | 2014-12-01 17:55:16 -0800 | [diff] [blame] | 362 | $(OBJDIR)/unittest: $(OBJDIR) |
| 363 | @mkdir -p $@ |
| 364 | |
John Porto | 2fea26c | 2015-07-28 16:28:07 -0700 | [diff] [blame] | 365 | $(OBJDIR)/unittest/AssemblerX8632: $(OBJDIR)/unittest |
| 366 | @mkdir -p $@ |
| 367 | $(OBJDIR)/unittest/AssemblerX8664: $(OBJDIR)/unittest |
| 368 | @mkdir -p $@ |
| 369 | |
Jim Stichnoth | 8ff4b28 | 2016-01-04 15:39:06 -0800 | [diff] [blame^] | 370 | RT_SRC := runtime/szrt.c runtime/szrt_ll.ll runtime/szrt_profiler.c \ |
| 371 | runtime/szrt_asm_x8632.s runtime/szrt_asm_x8664.s \ |
| 372 | runtime/szrt_asm_arm32.s |
Jan Voung | 050deaa | 2015-06-12 15:12:05 -0700 | [diff] [blame] | 373 | 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^] | 374 | build/runtime/szrt_nonsfi_x8632.o \ |
Jim Stichnoth | 2e7de23 | 2015-11-02 08:25:57 -0800 | [diff] [blame] | 375 | build/runtime/szrt_native_x8664.o build/runtime/szrt_sb_x8664.o \ |
Jim Stichnoth | 8ff4b28 | 2016-01-04 15:39:06 -0800 | [diff] [blame^] | 376 | build/runtime/szrt_nonsfi_x8664.o \ |
| 377 | build/runtime/szrt_native_arm32.o build/runtime/szrt_sb_arm32.o \ |
| 378 | build/runtime/szrt_nonsfi_arm32.o |
Jim Stichnoth | 9738a9e | 2015-02-23 16:39:06 -0800 | [diff] [blame] | 379 | |
| 380 | runtime: $(RT_OBJ) |
| 381 | |
| 382 | # Use runtime.is.built so that build-runtime.py is invoked only once |
| 383 | # even in a parallel build. |
| 384 | .INTERMEDIATE: runtime.is.built |
| 385 | $(RT_OBJ): runtime.is.built |
John Porto | f8b4cc8 | 2015-06-09 18:06:19 -0700 | [diff] [blame] | 386 | runtime.is.built: $(RT_SRC) pydir/build-runtime.py |
Jim Stichnoth | 9738a9e | 2015-02-23 16:39:06 -0800 | [diff] [blame] | 387 | @echo ================ Building Subzero runtime ================ |
Jan Voung | 68a0633 | 2015-03-05 14:33:38 -0800 | [diff] [blame] | 388 | ./pydir/build-runtime.py -v --pnacl-root $(PNACL_TOOLCHAIN_ROOT) |
Jim Stichnoth | 9738a9e | 2015-02-23 16:39:06 -0800 | [diff] [blame] | 389 | |
Jim Stichnoth | fa0cfa5 | 2015-02-26 09:42:36 -0800 | [diff] [blame] | 390 | check-lit: $(OBJDIR)/pnacl-sz make_symlink |
Jim Stichnoth | 0a9e126 | 2015-04-21 09:59:21 -0700 | [diff] [blame] | 391 | PNACL_BIN_PATH=$(PNACL_BIN_PATH) \ |
Derek Schuff | bc64313 | 2014-05-22 16:39:25 -0700 | [diff] [blame] | 392 | $(LLVM_SRC_PATH)/utils/lit/lit.py -sv tests_lit |
Jim Stichnoth | ac9c943 | 2014-08-26 14:07:13 -0700 | [diff] [blame] | 393 | |
Karl Schimpf | ab06df3 | 2014-10-29 14:58:25 -0700 | [diff] [blame] | 394 | ifdef MINIMAL |
Jim Stichnoth | c925822 | 2015-03-13 11:59:49 -0700 | [diff] [blame] | 395 | check-xtest: $(OBJDIR)/pnacl-sz make_symlink runtime |
| 396 | @echo "Crosstests disabled, minimal build" |
Karl Schimpf | ab06df3 | 2014-10-29 14:58:25 -0700 | [diff] [blame] | 397 | else |
Jim Stichnoth | c925822 | 2015-03-13 11:59:49 -0700 | [diff] [blame] | 398 | check-xtest: $(OBJDIR)/pnacl-sz make_symlink runtime |
Jim Stichnoth | dc7c597 | 2015-03-10 11:17:15 -0700 | [diff] [blame] | 399 | # Do all native/sse2 tests, but only test_vector_ops for native/sse4.1. |
| 400 | # For (slow) sandboxed tests, limit to Om1/sse4.1. |
John Porto | 1d23542 | 2015-08-12 12:37:53 -0700 | [diff] [blame] | 401 | # TODO(jpp): implement x8664 sandbox, then enable xtests. |
John Porto | ba6a67c | 2015-09-25 15:19:45 -0700 | [diff] [blame] | 402 | # TODO(jpp): reenable the x86-64 tests. |
Jim Stichnoth | dc7c597 | 2015-03-10 11:17:15 -0700 | [diff] [blame] | 403 | ./pydir/crosstest_generator.py -v --lit \ |
Jim Stichnoth | 2e7de23 | 2015-11-02 08:25:57 -0800 | [diff] [blame] | 404 | --toolchain-root $(TOOLCHAIN_ROOT) \ |
| 405 | -i x8632,native,sse2 \ |
| 406 | -i x8632,native,sse4.1,test_vector_ops \ |
| 407 | -i x8632,sandbox,sse4.1,Om1 \ |
Jim Stichnoth | 8ff4b28 | 2016-01-04 15:39:06 -0800 | [diff] [blame^] | 408 | -i x8632,nonsfi,sse2,O2 -e x8632,nonsfi,test_select \ |
John Porto | 008f4ce | 2015-12-24 13:22:18 -0800 | [diff] [blame] | 409 | -i x8664,native,sse2 \ |
| 410 | -i x8664,native,sse4.1,test_vector_ops \ |
John Porto | 3c275ce | 2015-12-22 08:14:00 -0800 | [diff] [blame] | 411 | -e x8664,sandbox,sse4.1,Om1 \ |
John Porto | 52b5157 | 2015-12-05 14:16:25 -0800 | [diff] [blame] | 412 | -i arm32,neon \ |
Jim Stichnoth | 8ff4b28 | 2016-01-04 15:39:06 -0800 | [diff] [blame^] | 413 | -e arm32,nonsfi \ |
John Porto | 52b5157 | 2015-12-05 14:16:25 -0800 | [diff] [blame] | 414 | -e arm32,neon,test_vector_ops \ |
| 415 | -e arm32,neon,test_select |
Jim Stichnoth | 0a9e126 | 2015-04-21 09:59:21 -0700 | [diff] [blame] | 416 | PNACL_BIN_PATH=$(PNACL_BIN_PATH) \ |
Jim Stichnoth | dc7c597 | 2015-03-10 11:17:15 -0700 | [diff] [blame] | 417 | $(LLVM_SRC_PATH)/utils/lit/lit.py -sv crosstest/Output |
Karl Schimpf | ab06df3 | 2014-10-29 14:58:25 -0700 | [diff] [blame] | 418 | endif |
Derek Schuff | bc64313 | 2014-05-22 16:39:25 -0700 | [diff] [blame] | 419 | |
Jim Stichnoth | c925822 | 2015-03-13 11:59:49 -0700 | [diff] [blame] | 420 | check-unit: $(OBJDIR)/run_unittests |
| 421 | $(OBJDIR)/run_unittests |
| 422 | |
Jim Stichnoth | c59288b | 2015-11-09 11:38:40 -0800 | [diff] [blame] | 423 | # List the spec2k components in roughly reverse order of runtime, to help with |
| 424 | # parallel execution speed. |
| 425 | ALLSPEC := 253.perlbmk 177.mesa 188.ammp 256.bzip2 164.gzip 179.art 183.equake \ |
| 426 | 175.vpr 176.gcc 181.mcf 186.crafty 197.parser 254.gap 255.vortex \ |
| 427 | 300.twolf 252.eon |
Jim Stichnoth | 2e7de23 | 2015-11-02 08:25:57 -0800 | [diff] [blame] | 428 | .PHONY: $(ALLSPEC) |
| 429 | |
| 430 | TARGET := x8632 |
| 431 | ifeq ($(TARGET),x8632) |
| 432 | TARGETFLAG=x8632 |
| 433 | SETUP=SetupGccX8632Opt |
| 434 | SPEC := -O2 --filetype=obj |
| 435 | endif |
John Porto | 3c275ce | 2015-12-22 08:14:00 -0800 | [diff] [blame] | 436 | ifeq ($(TARGET),x8664) |
| 437 | TARGETFLAG=x8664 |
| 438 | SETUP=SetupGccX8664Opt |
| 439 | SPEC := -O2 --filetype=obj |
| 440 | endif |
Jim Stichnoth | 2e7de23 | 2015-11-02 08:25:57 -0800 | [diff] [blame] | 441 | ifeq ($(TARGET),arm32) |
| 442 | TARGETFLAG=arm32 |
| 443 | SETUP=SetupGccArmOpt |
| 444 | SPEC := -O2 --filetype=asm |
| 445 | endif |
Jim Stichnoth | 6c4ad84 | 2015-11-16 12:47:57 -0800 | [diff] [blame] | 446 | SPECFLAGS := |
| 447 | SPECBUILDONLY := false |
Jim Stichnoth | c59288b | 2015-11-09 11:38:40 -0800 | [diff] [blame] | 448 | %.spec2k: % $(OBJDIR)/pnacl-sz make_symlink runtime |
Jim Stichnoth | 6c4ad84 | 2015-11-16 12:47:57 -0800 | [diff] [blame] | 449 | ./pydir/szbuild_spec2k.py -v --force \ |
| 450 | $(SPECFLAGS) --target=$(TARGETFLAG) $(SPEC) $< |
| 451 | $(SPECBUILDONLY) || ( cd ../../../tests/spec2k; \ |
Jim Stichnoth | 2e7de23 | 2015-11-02 08:25:57 -0800 | [diff] [blame] | 452 | ./run_all.sh RunTimedBenchmarks $(SETUP) train $< ) |
| 453 | |
Jim Stichnoth | c59288b | 2015-11-09 11:38:40 -0800 | [diff] [blame] | 454 | check-spec: $(ALLSPEC:=.spec2k) |
Jim Stichnoth | 2e7de23 | 2015-11-02 08:25:57 -0800 | [diff] [blame] | 455 | |
Jim Stichnoth | c925822 | 2015-03-13 11:59:49 -0700 | [diff] [blame] | 456 | check: check-lit check-unit check-xtest |
| 457 | |
Jim Stichnoth | 23bee88 | 2015-11-17 06:14:05 -0800 | [diff] [blame] | 458 | check-presubmit presubmit: |
| 459 | # Make sure clang-format gets run. |
Jim Stichnoth | 6c4ad84 | 2015-11-16 12:47:57 -0800 | [diff] [blame] | 460 | +make -f Makefile.standalone format |
Jim Stichnoth | 23bee88 | 2015-11-17 06:14:05 -0800 | [diff] [blame] | 461 | # Verify MINIMAL build, plus proper usage of REQUIRES in lit tests. |
Jim Stichnoth | 6c4ad84 | 2015-11-16 12:47:57 -0800 | [diff] [blame] | 462 | +make -f Makefile.standalone \ |
| 463 | MINIMAL=1 check |
Jim Stichnoth | fc22f77 | 2015-11-22 06:06:34 -0800 | [diff] [blame] | 464 | # Check that there are no g++ build errors or warnings. |
| 465 | +make -f Makefile.standalone \ |
| 466 | GPLUSPLUS=1 compile_only |
Jim Stichnoth | 23bee88 | 2015-11-17 06:14:05 -0800 | [diff] [blame] | 467 | # Check the x86 assembler unit tests. |
Jim Stichnoth | 6c4ad84 | 2015-11-16 12:47:57 -0800 | [diff] [blame] | 468 | +make -f Makefile.standalone \ |
| 469 | DEBUG=1 CHECK_X86_ASM=1 check-unit |
Jim Stichnoth | 23bee88 | 2015-11-17 06:14:05 -0800 | [diff] [blame] | 470 | # Run spec2k for x86-32. |
Jim Stichnoth | 6c4ad84 | 2015-11-16 12:47:57 -0800 | [diff] [blame] | 471 | +make -f Makefile.standalone \ |
| 472 | check check-spec |
Jim Stichnoth | 23bee88 | 2015-11-17 06:14:05 -0800 | [diff] [blame] | 473 | # Build spec2k under -Om1/x86-32, to check for liveness errors. |
Jim Stichnoth | 6c4ad84 | 2015-11-16 12:47:57 -0800 | [diff] [blame] | 474 | +make -f Makefile.standalone \ |
| 475 | SPECFLAGS='-Om1' SPECBUILDONLY=true check-spec |
Jim Stichnoth | 23bee88 | 2015-11-17 06:14:05 -0800 | [diff] [blame] | 476 | # Run spec2k for x86-32 without advanced phi lowering. |
Jim Stichnoth | 6c4ad84 | 2015-11-16 12:47:57 -0800 | [diff] [blame] | 477 | +make -f Makefile.standalone \ |
| 478 | SPECFLAGS='--sz=--phi-edge-split=0' check-spec |
Jim Stichnoth | 23bee88 | 2015-11-17 06:14:05 -0800 | [diff] [blame] | 479 | # Build spec2k for arm32. |
Jim Stichnoth | 6c4ad84 | 2015-11-16 12:47:57 -0800 | [diff] [blame] | 480 | +make -f Makefile.standalone \ |
| 481 | TARGET=arm32 SPECBUILDONLY=true check-spec |
Jim Stichnoth | 23bee88 | 2015-11-17 06:14:05 -0800 | [diff] [blame] | 482 | # Build spec2k under -Om1/arm32. |
Jim Stichnoth | 6c4ad84 | 2015-11-16 12:47:57 -0800 | [diff] [blame] | 483 | +make -f Makefile.standalone \ |
| 484 | TARGET=arm32 SPECFLAGS='-Om1' SPECBUILDONLY=true check-spec |
Jim Stichnoth | 23bee88 | 2015-11-17 06:14:05 -0800 | [diff] [blame] | 485 | # Run a few spec2k tests for arm32 using qemu. |
Jim Stichnoth | 6c4ad84 | 2015-11-16 12:47:57 -0800 | [diff] [blame] | 486 | +make -f Makefile.standalone \ |
| 487 | TARGET=arm32 ALLSPEC='176.gcc 181.mcf 254.gap' check-spec |
Jim Stichnoth | 23bee88 | 2015-11-17 06:14:05 -0800 | [diff] [blame] | 488 | # Provide validation of user awesomeness! |
Jim Stichnoth | 6c4ad84 | 2015-11-16 12:47:57 -0800 | [diff] [blame] | 489 | echo Success |
| 490 | |
Jim Stichnoth | dd842db | 2015-01-27 12:53:53 -0800 | [diff] [blame] | 491 | FORMAT_BLACKLIST = |
| 492 | # Add one of the following lines for each source file to ignore. |
| 493 | FORMAT_BLACKLIST += ! -name IceParseInstsTest.cpp |
Karl Schimpf | 74cd883 | 2015-06-23 11:05:01 -0700 | [diff] [blame] | 494 | FORMAT_BLACKLIST += ! -name IceParseTypesTest.cpp |
Karl Schimpf | 3e53dc9 | 2015-10-07 13:24:01 -0700 | [diff] [blame] | 495 | FORMAT_BLACKLIST += ! -name assembler_arm.h |
| 496 | FORMAT_BLACKLIST += ! -name assembler_arm.cc |
Derek Schuff | bc64313 | 2014-05-22 16:39:25 -0700 | [diff] [blame] | 497 | format: |
Jim Stichnoth | 0a9e126 | 2015-04-21 09:59:21 -0700 | [diff] [blame] | 498 | $(CLANG_FORMAT_PATH)/clang-format -style=LLVM -i \ |
Jim Stichnoth | 2e7de23 | 2015-11-02 08:25:57 -0800 | [diff] [blame] | 499 | `find . -regex '.*\.\(c\|h\|cpp\)' $(FORMAT_BLACKLIST)` |
Jim Stichnoth | 240e0f8 | 2014-07-09 16:53:40 -0700 | [diff] [blame] | 500 | |
Jim Stichnoth | 240e0f8 | 2014-07-09 16:53:40 -0700 | [diff] [blame] | 501 | format-diff: |
Jim Stichnoth | 206833c | 2014-08-07 10:58:05 -0700 | [diff] [blame] | 502 | git diff -U0 `git merge-base HEAD master` | \ |
Jim Stichnoth | 2e7de23 | 2015-11-02 08:25:57 -0800 | [diff] [blame] | 503 | PATH=$(PNACL_BIN_PATH):$(PATH) \ |
| 504 | $(LLVM_SRC_PATH)/../clang/tools/clang-format/clang-format-diff.py \ |
| 505 | -p1 -style=LLVM -i |
Derek Schuff | bc64313 | 2014-05-22 16:39:25 -0700 | [diff] [blame] | 506 | |
Jim Stichnoth | 307e326 | 2015-02-12 16:10:37 -0800 | [diff] [blame] | 507 | bloat: make_symlink |
Jim Stichnoth | fa0cfa5 | 2015-02-26 09:42:36 -0800 | [diff] [blame] | 508 | nm -C -S -l pnacl-sz | \ |
Jim Stichnoth | 2e7de23 | 2015-11-02 08:25:57 -0800 | [diff] [blame] | 509 | 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] | 510 | @echo See Subzero size breakdown in bloat/pnacl-sz.bloat.html |
Jim Stichnoth | 307e326 | 2015-02-12 16:10:37 -0800 | [diff] [blame] | 511 | |
Andrew Scull | a509e1d | 2015-06-29 11:07:08 -0700 | [diff] [blame] | 512 | docs: |
| 513 | doxygen Doxyfile |
| 514 | @echo See file://`pwd`/docs/html/index.html |
| 515 | |
Derek Schuff | bc64313 | 2014-05-22 16:39:25 -0700 | [diff] [blame] | 516 | clean: |
Jan Voung | 44c3a80 | 2015-03-27 16:29:08 -0700 | [diff] [blame] | 517 | rm -rf pnacl-sz *.o $(OBJDIR) $(SB_OBJDIR) build/pnacl-sz.bloat.json |
Karl Schimpf | b262c5e | 2014-10-27 14:41:57 -0700 | [diff] [blame] | 518 | |
| 519 | clean-all: clean |
Andrew Scull | a509e1d | 2015-06-29 11:07:08 -0700 | [diff] [blame] | 520 | rm -rf build/ docs/ |