blob: b101f4ad58df212efed09a2355a66852fd3a9cd5 [file] [log] [blame]
Derek Schuffbc643132014-05-22 16:39:25 -07001# 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 Stichnoth0a9e1262015-04-21 09:59:21 -07005# make LLVM_SRC_PATH=<path> LIBCXX_INSTALL_PATH=<path> CLANG_PATH=<path> \
Jan Voung44c3a802015-03-27 16:29:08 -07006# PNACL_BIN_PATH=<path> ...
Derek Schuffbc643132014-05-22 16:39:25 -07007#
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.
14LLVM_SRC_PATH ?= ../llvm
15
Jan Voung44c3a802015-03-27 16:29:08 -070016# The x86-32-specific sandboxed translator directory.
17# It holds sandboxed versions of libraries and binaries.
18SB_LLVM_PATH ?= $(shell readlink -e \
Jim Stichnoth2e7de232015-11-02 08:25:57 -080019 ../../out/sandboxed_translators_work/translator-i686/llvm-sb/Release)
Jan Voung44c3a802015-03-27 16:29:08 -070020
21# NACL_ROOT is the root of the native client repository.
22NACL_ROOT ?= $(shell python -c "import sys; sys.path.insert(0, 'pydir'); \
Jim Stichnoth2e7de232015-11-02 08:25:57 -080023 import utils; print utils.FindBaseNaCl()")
Jan Voung44c3a802015-03-27 16:29:08 -070024
Jan Voung8e32fed2015-06-17 10:16:23 -070025# TOOLCHAIN_ROOT is the location of NaCl/PNaCl toolchains and other
26# tools like qemu.
27TOOLCHAIN_ROOT ?= $(shell readlink -e $(NACL_ROOT)/toolchain/linux_x86)
28
Jan Voung68a06332015-03-05 14:33:38 -080029# PNACL_TOOLCHAIN_ROOT is the location of the PNaCl toolchain.
30# This is used as the default root for finding binutils, libcxx, etc.
Jan Voung8e32fed2015-06-17 10:16:23 -070031PNACL_TOOLCHAIN_ROOT ?= $(shell readlink -e $(TOOLCHAIN_ROOT)/pnacl_newlib_raw)
Jan Voung44c3a802015-03-27 16:29:08 -070032
33# The location of PNaCl tools (e.g., binutils objdump, pnacl-clang++, etc.).
34PNACL_BIN_PATH ?= $(shell readlink -e $(PNACL_TOOLCHAIN_ROOT)/bin)
Karl Schimpf8fcefc32014-09-15 12:56:50 -070035
Reed Kotler2c3c82e2016-01-21 20:33:08 -080036# 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
41CHECK_LIT_TESTS ?= tests_lit
42CHECK_XTEST_TESTS ?= crosstest/Output
43
Jim Stichnoth0a9e1262015-04-21 09:59:21 -070044# Hack to auto-detect autoconf versus cmake build of LLVM. If the LLVM tools
Jim Stichnothe5b58fb2015-06-01 15:17:20 -070045# were dynamically linked with something like libLLVM-3.7svn.so, it is an
Jim Stichnoth0a9e1262015-04-21 09:59:21 -070046# autoconf build, otherwise it is a cmake build. AUTOCONF is set to 0 for
47# cmake, nonzero for autoconf.
48AUTOCONF ?= $(shell ldd $(PNACL_BIN_PATH)/opt | grep -c libLLVM-)
49
Jan Voung68a06332015-03-05 14:33:38 -080050# CLANG_PATH is the location of the clang compiler to use for building
51# the host binaries.
Karl Schimpf8fcefc32014-09-15 12:56:50 -070052CLANG_PATH ?= $(shell readlink -e \
Jim Stichnoth2e7de232015-11-02 08:25:57 -080053 $(NACL_ROOT)/../third_party/llvm-build/Release+Asserts/bin)
Karl Schimpf8fcefc32014-09-15 12:56:50 -070054
Jan Voung68a06332015-03-05 14:33:38 -080055# 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.
58LIBCXX_INSTALL_PATH ?= $(PNACL_TOOLCHAIN_ROOT)
Karl Schimpf9d928542015-04-16 15:08:05 -070059STDLIB_FLAGS := -stdlib=libc++ -I$(LIBCXX_INSTALL_PATH)/include/c++/v1
Jan Voung68a06332015-03-05 14:33:38 -080060
Jan Voung4c127ba2014-09-19 13:11:36 -070061HOST_ARCH ?= x86_64
Jan Voung839c4ce2014-07-28 15:19:43 -070062ifeq ($(HOST_ARCH),x86_64)
Jim Stichnoth6c6adf12015-04-07 14:22:25 -070063 HOST_FLAGS = -m64
Jan Voung839c4ce2014-07-28 15:19:43 -070064else
65 ifeq ($(HOST_ARCH),x86)
Jim Stichnoth6c6adf12015-04-07 14:22:25 -070066 HOST_FLAGS = -m32
Jan Voung839c4ce2014-07-28 15:19:43 -070067 endif
68endif
69
Jim Stichnothfddef242014-09-26 18:53:41 -070070ifdef DEBUG
71 OBJDIR = build/Debug
72 OPTLEVEL = -O0
Jan Voung44c3a802015-03-27 16:29:08 -070073 LINKOPTLEVEL = -O0
Jim Stichnothfddef242014-09-26 18:53:41 -070074else
75 OBJDIR = build/Release
Jim Stichnotha49e9d92014-12-07 14:25:34 -080076 OPTLEVEL = -O2 -ffunction-sections -fdata-sections
Jan Voung44c3a802015-03-27 16:29:08 -070077 LINKOPTLEVEL = -O2
Jim Stichnothfddef242014-09-26 18:53:41 -070078endif
79
Karl Schimpfb262c5e2014-10-27 14:41:57 -070080# The list of CXX defines that are dependent on build parameters.
Jan Voung44c3a802015-03-27 16:29:08 -070081BASE_CXX_DEFINES =
Jim Stichnothfa4efea2015-01-27 05:06:03 -080082CXX_EXTRA =
83LD_EXTRA =
Karl Schimpfb262c5e2014-10-27 14:41:57 -070084
85ifdef MINIMAL
Jim Stichnothe3c02c22014-12-05 14:16:07 -080086 NOASSERT = 1
Karl Schimpfb262c5e2014-10-27 14:41:57 -070087 OBJDIR := $(OBJDIR)+Min
Jan Voung44c3a802015-03-27 16:29:08 -070088 BASE_CXX_DEFINES += -DALLOW_DUMP=0 -DALLOW_LLVM_CL=0 -DALLOW_LLVM_IR=0 \
Jim Stichnoth0d4fc922015-12-13 21:36:33 -080089 -DALLOW_LLVM_IR_AS_INPUT=0 -DALLOW_MINIMAL_BUILD=1
Karl Schimpfb262c5e2014-10-27 14:41:57 -070090else
Jan Voung44c3a802015-03-27 16:29:08 -070091 BASE_CXX_DEFINES += -DALLOW_DUMP=1 -DALLOW_LLVM_CL=1 -DALLOW_LLVM_IR=1 \
Jim Stichnoth0d4fc922015-12-13 21:36:33 -080092 -DALLOW_LLVM_IR_AS_INPUT=1 -DALLOW_MINIMAL_BUILD=0
Karl Schimpfb262c5e2014-10-27 14:41:57 -070093endif
94
Jan Voung44c3a802015-03-27 16:29:08 -070095CXX_DEFINES := $(BASE_CXX_DEFINES) -DPNACL_BROWSER_TRANSLATOR=0
96
Jim Stichnoth9c234e22014-10-01 09:28:21 -070097ifdef NOASSERT
98 ASSERTIONS = -DNDEBUG
99else
100 ASSERTIONS =
101 OBJDIR := $(OBJDIR)+Asserts
102endif
103
Andrew Scull6ef79492015-09-09 15:50:42 -0700104ifdef UBSAN
105 OBJDIR := $(OBJDIR)+UBSan
Jim Stichnoth2e7de232015-11-02 08:25:57 -0800106 CXX_EXTRA += -fsanitize=undefined -fno-sanitize=vptr \
107 -fno-sanitize=nonnull-attribute
Andrew Scull6ef79492015-09-09 15:50:42 -0700108 LD_EXTRA += -fsanitize=undefined
109endif
110
111ifdef UBSAN_TRAP
112 OBJDIR := $(OBJDIR)+UBSan_Trap
Jim Stichnoth2e7de232015-11-02 08:25:57 -0800113 CXX_EXTRA += -fsanitize=undefined-trap -fsanitize-undefined-trap-on-error \
114 -fno-sanitize=vptr -fno-sanitize=nonnull-attribute
Andrew Scull6ef79492015-09-09 15:50:42 -0700115 LD_EXTRA += -fsanitize=undefined-trap
116endif
117
Jim Stichnothfa4efea2015-01-27 05:06:03 -0800118ifdef TSAN
119 OBJDIR := $(OBJDIR)+TSan
120 CXX_EXTRA += -fsanitize=thread
121 LD_EXTRA += -fsanitize=thread
122endif
123
Andrew Scull86df4e92015-07-30 13:54:44 -0700124ifdef ASAN
125 OBJDIR := $(OBJDIR)+ASan
126 CXX_EXTRA += -fsanitize=address
127 LD_EXTRA += -fsanitize=address
128endif
129
Andrew Scull6ef79492015-09-09 15:50:42 -0700130ifdef MSAN
Andrew Scull00741a02015-09-16 19:04:09 -0700131 # TODO(ascull): this has an as yet undiagnosed uninitialized memory access
Andrew Scull6ef79492015-09-09 15:50:42 -0700132 OBJDIR := $(OBJDIR)+MSan
133 CXX_EXTRA += -fsanitize=memory
134 LD_EXTRA += -fsanitize=memory
135endif
136
David Sehrb19d39c2016-01-13 14:17:37 -0800137ifdef FORCEASM
138 FORCEASM_FLAG = --filetype=asm
139 # With --filetype=asm and --sandbox, the llvm-mc assembler emits the lock and
140 # 16-bit prefixes in the "wrong" order, causing the validator to reject the
141 # resulting nexe. So we just disable those tests for now.
142 FORCEASM_XTEST_EXCLUDES = -e x8632,sandbox,test_sync_atomic
143 FORCEASM_LIT_PARAM = --param=FORCEASM
John Porto27fddcc2016-02-02 15:06:09 -0800144 # x86 sandboxing lit tests are disabled because filetype=asm does not
145 # handle bundle_lock pad-to-end correctly.
John Porto56958cb2016-01-14 09:18:18 -0800146 # TODO(jpp): fix this.
147 FORCEASM_LIT_TEST_EXCLUDES = --filter='^(?!.*/x86/sandboxing.ll).*'
David Sehrb19d39c2016-01-13 14:17:37 -0800148else
149 FORCEASM_FLAG =
150 FORCEASM_XTEST_EXCLUDES =
151 FORCEASM_LIT_PARAM =
John Porto56958cb2016-01-14 09:18:18 -0800152 FORCEASM_LIT_TEST_EXCLUDES =
David Sehrb19d39c2016-01-13 14:17:37 -0800153endif
154
Jan Voung44c3a802015-03-27 16:29:08 -0700155SB_OBJDIR := $(OBJDIR)+Sandboxed
Jim Stichnothc4ed5492016-02-29 09:16:00 -0800156SBB_OBJDIR := $(OBJDIR)+SandboxedBrowser
Jan Voung44c3a802015-03-27 16:29:08 -0700157
Derek Schuffbc643132014-05-22 16:39:25 -0700158$(info -----------------------------------------------)
159$(info Using LLVM_SRC_PATH = $(LLVM_SRC_PATH))
Jan Voung44c3a802015-03-27 16:29:08 -0700160$(info Using SB_LLVM_PATH = $(SB_LLVM_PATH))
161$(info Using NACL_ROOT = $(NACL_ROOT))
Jan Voung8e32fed2015-06-17 10:16:23 -0700162$(info Using TOOLCHAIN_ROOT = $(TOOLCHAIN_ROOT))
Jan Voung68a06332015-03-05 14:33:38 -0800163$(info Using PNACL_TOOLCHAIN_ROOT = $(PNACL_TOOLCHAIN_ROOT))
Jan Voung44c3a802015-03-27 16:29:08 -0700164$(info Using PNACL_BIN_PATH = $(PNACL_BIN_PATH))
Karl Schimpf8fcefc32014-09-15 12:56:50 -0700165$(info Using CLANG_PATH = $(CLANG_PATH))
Jan Voung68a06332015-03-05 14:33:38 -0800166$(info Using LIBCXX_INSTALL_PATH = $(LIBCXX_INSTALL_PATH))
Jan Voung839c4ce2014-07-28 15:19:43 -0700167$(info Using HOST_ARCH = $(HOST_ARCH))
Derek Schuffbc643132014-05-22 16:39:25 -0700168$(info -----------------------------------------------)
169
Jim Stichnoth0a9e1262015-04-21 09:59:21 -0700170LLVM_CXXFLAGS := `$(PNACL_BIN_PATH)/llvm-config --cxxflags`
Jan Voung44c3a802015-03-27 16:29:08 -0700171SB_LLVM_CXXFLAGS := $(LLVM_CXXFLAGS)
172
173# Listing specific libraries that are needed for pnacl-sz
174# and the unittests, since we build "tools-only" for the
175# sandboxed_translators (which doesn't include every library
176# listed by llvm-config).
Jim Stichnoth0a9e1262015-04-21 09:59:21 -0700177
178LLVM_LIBS_LIST := -lLLVMIRReader -lLLVMBitReader -lLLVMNaClBitTestUtils \
179 -lLLVMNaClBitReader -lLLVMNaClBitAnalysis -lLLVMNaClBitWriter \
180 -lLLVMAsmParser -lLLVMNaClAnalysis -lLLVMCore -lLLVMSupport
181
182ifeq ($(AUTOCONF), 0)
183 # LLVM cmake build
Karl Schimpf28f3f732015-06-24 09:32:40 -0700184 LLVM_LIBS := $(LLVM_LIBS_LIST)
Jim Stichnoth0a9e1262015-04-21 09:59:21 -0700185 # For the cmake build, the gtest libs end up in the same place as the LLVM
186 # libs, so no "-L..." arg is needed.
187 GTEST_LIB_PATH ?=
188 CLANG_FORMAT_PATH ?= $(PNACL_BIN_PATH)
189else
190 # LLVM autoconf build
Jim Stichnothe5b58fb2015-06-01 15:17:20 -0700191 LLVM_LIBS := -lLLVM-3.7svn
Jim Stichnoth0a9e1262015-04-21 09:59:21 -0700192 GTEST_LIB_PATH ?= -L../../out/llvm_x86_64_linux_work/Release+Asserts/lib
193 CLANG_FORMAT_PATH ?= ../../out/llvm_x86_64_linux_work/Release+Asserts/bin
194endif
195
Jan Voung44c3a802015-03-27 16:29:08 -0700196LLVM_LDFLAGS := $(LLVM_LIBS) \
Jim Stichnoth0a9e1262015-04-21 09:59:21 -0700197 `$(PNACL_BIN_PATH)/llvm-config --ldflags` \
198 `$(PNACL_BIN_PATH)/llvm-config --system-libs`
Jim Stichnoth7a20a402016-02-24 21:32:53 -0800199SB_LLVM_LDFLAGS := -Wl,--start-group $(LLVM_LIBS_LIST) -Wl,--end-group \
Jan Voung44c3a802015-03-27 16:29:08 -0700200 -L$(SB_LLVM_PATH)/lib
Derek Schuffbc643132014-05-22 16:39:25 -0700201
Jim Stichnoth5e06f9f2014-09-17 08:41:21 -0700202CCACHE := `command -v ccache`
203CXX := CCACHE_CPP2=yes $(CCACHE) $(CLANG_PATH)/clang++
Jan Voung44c3a802015-03-27 16:29:08 -0700204SB_CXX := CCACHE_CPP2=yes $(CCACHE) $(PNACL_BIN_PATH)/pnacl-clang++
205SB_TRANSLATE := $(PNACL_BIN_PATH)/pnacl-translate
Jim Stichnoth7a20a402016-02-24 21:32:53 -0800206SB_FINALIZE := $(PNACL_BIN_PATH)/pnacl-finalize --no-strip-syms
Jan Voung839c4ce2014-07-28 15:19:43 -0700207
Jan Voungc2648c22015-07-30 21:29:14 -0700208# Extra warnings that LLVM's build system adds in addition to -Wall.
209LLVM_EXTRA_WARNINGS := -Wcovered-switch-default
210
Jim Stichnothcaeaa272016-01-10 12:53:44 -0800211# Use g++ to compile, to check for errors/warnings that clang++ might have
212# missed. It's unlikely to link, unless LLVM was also built with g++, so the
213# compile_only target should be used. Note: This ifdef section is deliberately
214# placed here instead of with the other ifdef sections, so that its redefinition
215# of CXX/STDLIB_FLAGS/LLVM_EXTRA_WARNINGS follows their normal definitions.
216ifdef GPLUSPLUS
217 CXX := CCACHE_CPP2=yes $(CCACHE) g++
218 STDLIB_FLAGS :=
Jim Stichnothb0051df2016-01-13 11:39:15 -0800219 LLVM_EXTRA_WARNINGS := \
220 -Wcast-qual \
221 -Wno-comment \
222 -Wno-long-long \
223 -Wno-maybe-uninitialized \
224 -Wno-missing-field-initializers \
225 -Wno-unused-parameter \
226 -Wwrite-strings
Jim Stichnothcaeaa272016-01-10 12:53:44 -0800227 OBJDIR := $(OBJDIR)+Gplusplus
228endif
229
Jan Voung44c3a802015-03-27 16:29:08 -0700230BASE_CXXFLAGS := -std=gnu++11 -Wall -Wextra -Werror -fno-rtti \
Jim Stichnoth2e7de232015-11-02 08:25:57 -0800231 -fno-exceptions $(OPTLEVEL) $(ASSERTIONS) -g -pedantic \
232 $(LLVM_EXTRA_WARNINGS) $(CXX_EXTRA)
Jan Voung44c3a802015-03-27 16:29:08 -0700233
234CXXFLAGS := $(LLVM_CXXFLAGS) $(BASE_CXXFLAGS) $(CXX_DEFINES) $(HOST_FLAGS) \
Jim Stichnoth2e7de232015-11-02 08:25:57 -0800235 $(STDLIB_FLAGS)
Jim Stichnothc4ed5492016-02-29 09:16:00 -0800236SB_CXXFLAGS := $(SB_LLVM_CXXFLAGS) $(BASE_CXXFLAGS) $(BASE_CXX_DEFINES) \
237 -Wno-unknown-pragmas -I$(NACL_ROOT) -I$(NACL_ROOT)/..
Jan Voung44c3a802015-03-27 16:29:08 -0700238
Jim Stichnothfa4efea2015-01-27 05:06:03 -0800239LDFLAGS := $(HOST_FLAGS) -L$(LIBCXX_INSTALL_PATH)/lib -Wl,--gc-sections \
Jim Stichnoth2e7de232015-11-02 08:25:57 -0800240 $(LD_EXTRA) $(STDLIB_FLAGS)
Jan Voung44c3a802015-03-27 16:29:08 -0700241# Not specifying -Wl,--gc-sections but instead doing bitcode linking GC w/ LTO.
242SB_LDFLAGS := $(LINKOPTLEVEL) $(LD_EXTRA)
Derek Schuffbc643132014-05-22 16:39:25 -0700243
Jim Stichnothc59288b2015-11-09 11:38:40 -0800244# List the target-specific source files first, which generally take longer to
245# compile, in the hope of improving parallel build time.
Karl Schimpfab06df32014-10-29 14:58:25 -0700246SRCS = \
Jim Stichnoth2e7de232015-11-02 08:25:57 -0800247 IceAssemblerARM32.cpp \
Jim Stichnothc59288b2015-11-09 11:38:40 -0800248 IceInstARM32.cpp \
249 IceInstMIPS32.cpp \
250 IceInstX8632.cpp \
251 IceInstX8664.cpp \
252 IceTargetLowering.cpp \
253 IceTargetLoweringARM32.cpp \
254 IceTargetLoweringMIPS32.cpp \
David Sehr6b80cf12016-01-21 23:16:58 -0800255 IceTargetLoweringX86.cpp \
Jim Stichnothc59288b2015-11-09 11:38:40 -0800256 IceTargetLoweringX8632.cpp \
257 IceTargetLoweringX8664.cpp \
258 IceAssembler.cpp \
Jim Stichnoth2e7de232015-11-02 08:25:57 -0800259 IceBrowserCompileServer.cpp \
260 IceCfg.cpp \
261 IceCfgNode.cpp \
262 IceClFlags.cpp \
263 IceCompiler.cpp \
264 IceCompileServer.cpp \
265 IceELFObjectWriter.cpp \
266 IceELFSection.cpp \
267 IceFixups.cpp \
268 IceGlobalContext.cpp \
269 IceGlobalInits.cpp \
270 IceInst.cpp \
Jim Stichnoth2e7de232015-11-02 08:25:57 -0800271 IceIntrinsics.cpp \
272 IceLiveness.cpp \
273 IceLoopAnalyzer.cpp \
Jim Stichnoth98ba0062016-03-07 09:26:22 -0800274 IceMangling.cpp \
John Portoe82b5602016-02-24 15:58:55 -0800275 IceMemory.cpp \
Jim Stichnoth2e7de232015-11-02 08:25:57 -0800276 IceOperand.cpp \
277 IceRegAlloc.cpp \
278 IceRNG.cpp \
279 IceSwitchLowering.cpp \
Jim Stichnoth2e7de232015-11-02 08:25:57 -0800280 IceThreading.cpp \
281 IceTimerTree.cpp \
282 IceTranslator.cpp \
283 IceTypes.cpp \
284 main.cpp \
285 PNaClTranslator.cpp
Derek Schuffbc643132014-05-22 16:39:25 -0700286
Karl Schimpfab06df32014-10-29 14:58:25 -0700287ifndef MINIMAL
Jim Stichnoth2e7de232015-11-02 08:25:57 -0800288 SRCS += \
289 IceConverter.cpp \
290 IceTypeConverter.cpp
Karl Schimpfab06df32014-10-29 14:58:25 -0700291endif
292
Jim Stichnothfddef242014-09-26 18:53:41 -0700293OBJS=$(patsubst %.cpp, $(OBJDIR)/%.o, $(SRCS))
Jan Voung44c3a802015-03-27 16:29:08 -0700294SB_OBJS=$(patsubst %.cpp, $(SB_OBJDIR)/%.o, $(SRCS))
Jim Stichnothc4ed5492016-02-29 09:16:00 -0800295SBB_OBJS=$(patsubst %.cpp, $(SBB_OBJDIR)/%.o, $(SRCS))
Derek Schuffbc643132014-05-22 16:39:25 -0700296
Jan Voung08c3bcd2014-12-01 17:55:16 -0800297UNITTEST_SRCS = \
Jim Stichnoth2e7de232015-11-02 08:25:57 -0800298 BitcodeMunge.cpp \
299 IceELFSectionTest.cpp \
300 IceParseInstsTest.cpp
John Porto59f2d922015-07-31 13:45:48 -0700301
302# The X86 assembler tests take too long to compile. Given how infrequently the
303# assembler will change, we disable them.
304ifdef CHECK_X86_ASM
Jim Stichnoth2e7de232015-11-02 08:25:57 -0800305 ifndef DEBUG
306 $(error Run check-unit with DEBUG=1 lest your machine perish)
307 endif
John Porto59f2d922015-07-31 13:45:48 -0700308 UNITTEST_SRCS += AssemblerX8632/LowLevel.cpp \
Jim Stichnoth2e7de232015-11-02 08:25:57 -0800309 AssemblerX8632/DataMov.cpp \
310 AssemblerX8632/Locked.cpp \
311 AssemblerX8632/GPRArith.cpp \
312 AssemblerX8632/XmmArith.cpp \
313 AssemblerX8632/ControlFlow.cpp \
314 AssemblerX8632/Other.cpp \
315 AssemblerX8632/X87.cpp \
316 AssemblerX8664/LowLevel.cpp \
317 AssemblerX8664/DataMov.cpp \
318 AssemblerX8664/Locked.cpp \
319 AssemblerX8664/GPRArith.cpp \
320 AssemblerX8664/XmmArith.cpp \
321 AssemblerX8664/ControlFlow.cpp \
322 AssemblerX8664/Other.cpp
John Porto59f2d922015-07-31 13:45:48 -0700323endif
Jan Voung08c3bcd2014-12-01 17:55:16 -0800324
325UNITTEST_OBJS = $(patsubst %.cpp, $(OBJDIR)/unittest/%.o, $(UNITTEST_SRCS))
Jim Stichnothfa0cfa52015-02-26 09:42:36 -0800326UNITTEST_LIB_OBJS = $(filter-out $(OBJDIR)/main.o,$(OBJS))
Jan Voung08c3bcd2014-12-01 17:55:16 -0800327
Jim Stichnothc4ed5492016-02-29 09:16:00 -0800328NEXES = $(SB_OBJDIR)/pnacl-sz.x8632.nexe \
329 $(SB_OBJDIR)/pnacl-sz.x8664.nexe \
330 $(SBB_OBJDIR)/pnacl_public_x86_32_pnacl_sz_nexe \
331 $(SBB_OBJDIR)/pnacl_public_x86_64_pnacl_sz_nexe
332
Derek Schuffbc643132014-05-22 16:39:25 -0700333# Keep all the first target so it's the default.
Jim Stichnothfa0cfa52015-02-26 09:42:36 -0800334all: $(OBJDIR)/pnacl-sz make_symlink runtime
Derek Schuffbc643132014-05-22 16:39:25 -0700335
Jan Voung44c3a802015-03-27 16:29:08 -0700336ifdef TSAN
337sb:
338 @echo "Skipping pnacl-sz.*.nexe: TSAN isn't supported under NaCl."
339else
Jim Stichnothc4ed5492016-02-29 09:16:00 -0800340sb: $(NEXES) sb_make_symlink
Jan Voung44c3a802015-03-27 16:29:08 -0700341endif
342
Karl Schimpf6f9ba112015-06-22 13:20:23 -0700343# SHOW_BUILD_ATTS is an executable that is run to show what build
344# attributes were used to build pnacl-sz.
Karl Schimpfcb6e95a2015-07-23 09:10:03 -0700345SHOW_BUILD_ATTS = $(OBJDIR)/pnacl-sz --build-atts
Karl Schimpf6f9ba112015-06-22 13:20:23 -0700346
Karl Schimpf6af63362014-10-29 14:55:00 -0700347# Creates symbolic link so that testing is easier. Also runs
Jim Stichnothfa0cfa52015-02-26 09:42:36 -0800348# pnacl-sz to verify that the defines flags have valid values,
Karl Schimpf6af63362014-10-29 14:55:00 -0700349# as well as describe the corresponding build attributes.
Jim Stichnothfa0cfa52015-02-26 09:42:36 -0800350make_symlink: $(OBJDIR)/pnacl-sz
351 rm -rf pnacl-sz
352 ln -s $(OBJDIR)/pnacl-sz
Karl Schimpf6af63362014-10-29 14:55:00 -0700353 @echo "Build Attributes:"
Karl Schimpf6f9ba112015-06-22 13:20:23 -0700354 @$(SHOW_BUILD_ATTS)
Derek Schuffbc643132014-05-22 16:39:25 -0700355
Jim Stichnothc4ed5492016-02-29 09:16:00 -0800356sb_make_symlink: $(NEXES)
357 $(foreach nexe,$(NEXES),rm -rf $(notdir $(nexe)); ln -s $(nexe);)
358
359%.pexe : %.nonfinal.pexe
360 $(SB_FINALIZE) -o $@ $<
Jim Stichnoth7a20a402016-02-24 21:32:53 -0800361
Reed Kotler2c3c82e2016-01-21 20:33:08 -0800362.PHONY: all compile_only make_symlink runtime bloat sb docs help \
363 help-check-lit help-check-xtest
Jim Stichnoth23bee882015-11-17 06:14:05 -0800364
365compile_only: $(OBJS)
Jim Stichnothfddef242014-09-26 18:53:41 -0700366
Jim Stichnothfa0cfa52015-02-26 09:42:36 -0800367$(OBJDIR)/pnacl-sz: $(OBJS)
Jim Stichnoth33246422014-11-24 14:36:23 -0800368 $(CXX) $(LDFLAGS) -o $@ $^ $(LLVM_LDFLAGS) \
Jim Stichnoth2e7de232015-11-02 08:25:57 -0800369 -Wl,-rpath=$(abspath $(LIBCXX_INSTALL_PATH)/lib)
Derek Schuffbc643132014-05-22 16:39:25 -0700370
Jim Stichnoth7a20a402016-02-24 21:32:53 -0800371$(SB_OBJDIR)/pnacl-sz.nonfinal.pexe: $(SB_OBJS)
372 $(SB_CXX) $(SB_LDFLAGS) -o $@ $^ $(SB_LLVM_LDFLAGS)
373
Jim Stichnothc4ed5492016-02-29 09:16:00 -0800374$(SBB_OBJDIR)/pnacl-sz.nonfinal.pexe: $(SBB_OBJS)
375 $(SB_CXX) $(SB_LDFLAGS) -o $@ $^ $(SB_LLVM_LDFLAGS) \
376 --pnacl-disable-abi-check
Jim Stichnoth7a20a402016-02-24 21:32:53 -0800377
378$(SB_OBJDIR)/pnacl-sz.x8632.nexe: $(SB_OBJDIR)/pnacl-sz.pexe
379 $(SB_TRANSLATE) -arch x86-32 $^ -o $@
380
381$(SB_OBJDIR)/pnacl-sz.x8664.nexe: $(SB_OBJDIR)/pnacl-sz.pexe
382 $(SB_TRANSLATE) -arch x86-64 $^ -o $@
Jan Voung44c3a802015-03-27 16:29:08 -0700383
Jim Stichnothc4ed5492016-02-29 09:16:00 -0800384$(SBB_OBJDIR)/pnacl_public_x86_32_pnacl_sz_nexe: $(SBB_OBJDIR)/pnacl-sz.pexe
385 $(SB_TRANSLATE) -arch x86-32 $^ -o $@
386
387$(SBB_OBJDIR)/pnacl_public_x86_64_pnacl_sz_nexe: $(SBB_OBJDIR)/pnacl-sz.pexe
388 $(SB_TRANSLATE) -arch x86-64 $^ -o $@
389
John Porto2187c842015-12-16 07:48:25 -0800390src/IceRegistersARM32.def: pydir/gen_arm32_reg_tables.py
391 python $< > $@
392
Jim Stichnothdd842db2015-01-27 12:53:53 -0800393# TODO(stichnot): Be more precise than "*.h" here and elsewhere.
Jim Stichnothfddef242014-09-26 18:53:41 -0700394$(OBJS): $(OBJDIR)/%.o: src/%.cpp src/*.h src/*.def
Derek Schuffbc643132014-05-22 16:39:25 -0700395 $(CXX) -c $(CXXFLAGS) $< -o $@
396
Jan Voung44c3a802015-03-27 16:29:08 -0700397$(SB_OBJS): $(SB_OBJDIR)/%.o: src/%.cpp src/*.h src/*.def
Jim Stichnothc4ed5492016-02-29 09:16:00 -0800398 $(SB_CXX) -c $(SB_CXXFLAGS) -DPNACL_BROWSER_TRANSLATOR=0 $< -o $@
399
400$(SBB_OBJS): $(SBB_OBJDIR)/%.o: src/%.cpp src/*.h src/*.def
401 $(SB_CXX) -c $(SB_CXXFLAGS) -DPNACL_BROWSER_TRANSLATOR=1 $< -o $@
Jan Voung44c3a802015-03-27 16:29:08 -0700402
Jan Voung08c3bcd2014-12-01 17:55:16 -0800403$(OBJDIR)/run_unittests: $(UNITTEST_OBJS) $(UNITTEST_LIB_OBJS)
Jim Stichnothe7e9b022015-04-21 15:05:22 -0700404 $(CXX) $(GTEST_LIB_PATH) $(LDFLAGS) -o $@ $^ $(LLVM_LDFLAGS) \
Jim Stichnoth2e7de232015-11-02 08:25:57 -0800405 -lgtest -lgtest_main -ldl \
406 -Wl,-rpath=$(abspath $(LIBCXX_INSTALL_PATH)/lib)
Jan Voung08c3bcd2014-12-01 17:55:16 -0800407
Jim Stichnoth2e7de232015-11-02 08:25:57 -0800408$(UNITTEST_OBJS): $(OBJDIR)/unittest/%.o: unittest/%.cpp unittest/*.h \
409 src/*.h src/*.def
Jan Voung08c3bcd2014-12-01 17:55:16 -0800410 $(CXX) -c $(CXXFLAGS) \
Jim Stichnoth2e7de232015-11-02 08:25:57 -0800411 -Isrc/ \
412 -Iunittest/ \
413 -I$(LLVM_SRC_PATH)/utils/unittest/googletest/include \
414 -I$(LLVM_SRC_PATH) \
415 -DGTEST_HAS_RTTI=0 -DGTEST_USE_OWN_TR1_TUPLE \
416 $< -o $@
Jan Voung08c3bcd2014-12-01 17:55:16 -0800417
Jim Stichnothfddef242014-09-26 18:53:41 -0700418$(OBJS): | $(OBJDIR)
Jan Voung44c3a802015-03-27 16:29:08 -0700419$(SB_OBJS): | $(SB_OBJDIR)
Jim Stichnothc4ed5492016-02-29 09:16:00 -0800420$(SBB_OBJS): | $(SBB_OBJDIR)
Derek Schuffbc643132014-05-22 16:39:25 -0700421
Jim Stichnoth2e7de232015-11-02 08:25:57 -0800422$(UNITTEST_OBJS): | $(OBJDIR)/unittest $(OBJDIR)/unittest/AssemblerX8632 \
423 $(OBJDIR)/unittest/AssemblerX8664
Jan Voung08c3bcd2014-12-01 17:55:16 -0800424
Jim Stichnothfddef242014-09-26 18:53:41 -0700425$(OBJDIR):
Derek Schuffbc643132014-05-22 16:39:25 -0700426 @mkdir -p $@
Jan Voung44c3a802015-03-27 16:29:08 -0700427$(SB_OBJDIR):
428 @mkdir -p $@
Jim Stichnothc4ed5492016-02-29 09:16:00 -0800429$(SBB_OBJDIR):
430 @mkdir -p $@
Derek Schuffbc643132014-05-22 16:39:25 -0700431
Jan Voung08c3bcd2014-12-01 17:55:16 -0800432$(OBJDIR)/unittest: $(OBJDIR)
433 @mkdir -p $@
434
John Porto2fea26c2015-07-28 16:28:07 -0700435$(OBJDIR)/unittest/AssemblerX8632: $(OBJDIR)/unittest
436 @mkdir -p $@
437$(OBJDIR)/unittest/AssemblerX8664: $(OBJDIR)/unittest
438 @mkdir -p $@
439
Jim Stichnoth8ff4b282016-01-04 15:39:06 -0800440RT_SRC := runtime/szrt.c runtime/szrt_ll.ll runtime/szrt_profiler.c \
441 runtime/szrt_asm_x8632.s runtime/szrt_asm_x8664.s \
442 runtime/szrt_asm_arm32.s
Jan Voung050deaa2015-06-12 15:12:05 -0700443RT_OBJ := build/runtime/szrt_native_x8632.o build/runtime/szrt_sb_x8632.o \
Jim Stichnoth8ff4b282016-01-04 15:39:06 -0800444 build/runtime/szrt_nonsfi_x8632.o \
Jim Stichnoth2e7de232015-11-02 08:25:57 -0800445 build/runtime/szrt_native_x8664.o build/runtime/szrt_sb_x8664.o \
Jim Stichnoth8ff4b282016-01-04 15:39:06 -0800446 build/runtime/szrt_nonsfi_x8664.o \
447 build/runtime/szrt_native_arm32.o build/runtime/szrt_sb_arm32.o \
448 build/runtime/szrt_nonsfi_arm32.o
Jim Stichnoth9738a9e2015-02-23 16:39:06 -0800449
450runtime: $(RT_OBJ)
451
452# Use runtime.is.built so that build-runtime.py is invoked only once
453# even in a parallel build.
454.INTERMEDIATE: runtime.is.built
455$(RT_OBJ): runtime.is.built
John Portof8b4cc82015-06-09 18:06:19 -0700456runtime.is.built: $(RT_SRC) pydir/build-runtime.py
Jim Stichnoth9738a9e2015-02-23 16:39:06 -0800457 @echo ================ Building Subzero runtime ================
Jan Voung68a06332015-03-05 14:33:38 -0800458 ./pydir/build-runtime.py -v --pnacl-root $(PNACL_TOOLCHAIN_ROOT)
Jim Stichnoth9738a9e2015-02-23 16:39:06 -0800459
Jim Stichnothfa0cfa52015-02-26 09:42:36 -0800460check-lit: $(OBJDIR)/pnacl-sz make_symlink
Jim Stichnoth0a9e1262015-04-21 09:59:21 -0700461 PNACL_BIN_PATH=$(PNACL_BIN_PATH) \
Reed Kotler2c3c82e2016-01-21 20:33:08 -0800462 $(LLVM_SRC_PATH)/utils/lit/lit.py -sv $(CHECK_LIT_TESTS) \
John Porto56958cb2016-01-14 09:18:18 -0800463 $(FORCEASM_LIT_TEST_EXCLUDES) $(FORCEASM_LIT_PARAM)
Jim Stichnothac9c9432014-08-26 14:07:13 -0700464
Karl Schimpfab06df32014-10-29 14:58:25 -0700465ifdef MINIMAL
Jim Stichnothc9258222015-03-13 11:59:49 -0700466check-xtest: $(OBJDIR)/pnacl-sz make_symlink runtime
467 @echo "Crosstests disabled, minimal build"
Karl Schimpfab06df32014-10-29 14:58:25 -0700468else
Jim Stichnothc9258222015-03-13 11:59:49 -0700469check-xtest: $(OBJDIR)/pnacl-sz make_symlink runtime
Jim Stichnothdc7c5972015-03-10 11:17:15 -0700470 # Do all native/sse2 tests, but only test_vector_ops for native/sse4.1.
471 # For (slow) sandboxed tests, limit to Om1/sse4.1.
John Porto94e97f62016-02-18 08:02:10 -0800472 # run.py (used to run the sandboxed xtests) does not support
473 # specifying -cpu cortex-a15 to qemu, hence we disable the
474 # hwdiv-arm tests.
Jim Stichnothdc7c5972015-03-10 11:17:15 -0700475 ./pydir/crosstest_generator.py -v --lit \
Jim Stichnoth2e7de232015-11-02 08:25:57 -0800476 --toolchain-root $(TOOLCHAIN_ROOT) \
David Sehrb19d39c2016-01-13 14:17:37 -0800477 $(FORCEASM_FLAG) \
478 $(FORCEASM_XTEST_EXCLUDES) \
Jim Stichnoth2e7de232015-11-02 08:25:57 -0800479 -i x8632,native,sse2 \
480 -i x8632,native,sse4.1,test_vector_ops \
481 -i x8632,sandbox,sse4.1,Om1 \
Jim Stichnoth57a8aab2016-01-06 09:34:36 -0800482 -i x8632,nonsfi,sse2,O2 \
John Porto008f4ce2015-12-24 13:22:18 -0800483 -i x8664,native,sse2 \
484 -i x8664,native,sse4.1,test_vector_ops \
John Porto56958cb2016-01-14 09:18:18 -0800485 -i x8664,sandbox,sse4.1,Om1 \
John Porto94e97f62016-02-18 08:02:10 -0800486 -i arm32 \
John Portoe82b5602016-02-24 15:58:55 -0800487 -e arm32,sandbox,hwdiv-arm
Jim Stichnoth0a9e1262015-04-21 09:59:21 -0700488 PNACL_BIN_PATH=$(PNACL_BIN_PATH) \
Reed Kotler2c3c82e2016-01-21 20:33:08 -0800489 $(LLVM_SRC_PATH)/utils/lit/lit.py -sv $(CHECK_XTEST_TESTS)
Karl Schimpfab06df32014-10-29 14:58:25 -0700490endif
Derek Schuffbc643132014-05-22 16:39:25 -0700491
Jim Stichnothc9258222015-03-13 11:59:49 -0700492check-unit: $(OBJDIR)/run_unittests
493 $(OBJDIR)/run_unittests
494
Jim Stichnothc59288b2015-11-09 11:38:40 -0800495# List the spec2k components in roughly reverse order of runtime, to help with
496# parallel execution speed.
497ALLSPEC := 253.perlbmk 177.mesa 188.ammp 256.bzip2 164.gzip 179.art 183.equake \
498 175.vpr 176.gcc 181.mcf 186.crafty 197.parser 254.gap 255.vortex \
499 300.twolf 252.eon
Jim Stichnoth2e7de232015-11-02 08:25:57 -0800500.PHONY: $(ALLSPEC)
501
502TARGET := x8632
503ifeq ($(TARGET),x8632)
504 TARGETFLAG=x8632
505 SETUP=SetupGccX8632Opt
Jim Stichnothc8f56a32016-03-07 09:54:15 -0800506 SPEC := --filetype=obj
Jim Stichnoth2e7de232015-11-02 08:25:57 -0800507endif
John Porto3c275ce2015-12-22 08:14:00 -0800508ifeq ($(TARGET),x8664)
509 TARGETFLAG=x8664
510 SETUP=SetupGccX8664Opt
Jim Stichnothc8f56a32016-03-07 09:54:15 -0800511 SPEC := --filetype=obj
John Porto3c275ce2015-12-22 08:14:00 -0800512endif
Jim Stichnoth2e7de232015-11-02 08:25:57 -0800513ifeq ($(TARGET),arm32)
514 TARGETFLAG=arm32
515 SETUP=SetupGccArmOpt
Jim Stichnothc8f56a32016-03-07 09:54:15 -0800516 SPEC := --filetype=obj
Jim Stichnoth2e7de232015-11-02 08:25:57 -0800517endif
Jim Stichnothc8f56a32016-03-07 09:54:15 -0800518SPECFLAGS := -O2
Jim Stichnoth6c4ad842015-11-16 12:47:57 -0800519SPECBUILDONLY := false
Jim Stichnothc59288b2015-11-09 11:38:40 -0800520%.spec2k: % $(OBJDIR)/pnacl-sz make_symlink runtime
Jim Stichnothbc3bd502016-01-20 15:01:39 -0800521 ./pydir/szbuild_spec2k.py -v \
Jim Stichnoth6c4ad842015-11-16 12:47:57 -0800522 $(SPECFLAGS) --target=$(TARGETFLAG) $(SPEC) $<
523 $(SPECBUILDONLY) || ( cd ../../../tests/spec2k; \
Jim Stichnoth2e7de232015-11-02 08:25:57 -0800524 ./run_all.sh RunTimedBenchmarks $(SETUP) train $< )
525
Jim Stichnothc59288b2015-11-09 11:38:40 -0800526check-spec: $(ALLSPEC:=.spec2k)
Jim Stichnoth2e7de232015-11-02 08:25:57 -0800527
Jim Stichnothc9258222015-03-13 11:59:49 -0700528check: check-lit check-unit check-xtest
529
Jim Stichnoth23bee882015-11-17 06:14:05 -0800530check-presubmit presubmit:
531# Make sure clang-format gets run.
Jim Stichnoth6c4ad842015-11-16 12:47:57 -0800532 +make -f Makefile.standalone format
Jim Stichnoth23bee882015-11-17 06:14:05 -0800533# Verify MINIMAL build, plus proper usage of REQUIRES in lit tests.
Jim Stichnoth6c4ad842015-11-16 12:47:57 -0800534 +make -f Makefile.standalone \
Jim Stichnothc4ed5492016-02-29 09:16:00 -0800535 MINIMAL=1 check
Jim Stichnothfc22f772015-11-22 06:06:34 -0800536# Check that there are no g++ build errors or warnings.
537 +make -f Makefile.standalone \
538 GPLUSPLUS=1 compile_only
Jim Stichnoth23bee882015-11-17 06:14:05 -0800539# Check the x86 assembler unit tests.
Jim Stichnoth6c4ad842015-11-16 12:47:57 -0800540 +make -f Makefile.standalone \
Jim Stichnothc4ed5492016-02-29 09:16:00 -0800541 DEBUG=1 CHECK_X86_ASM=1 check-unit sb
David Sehrb19d39c2016-01-13 14:17:37 -0800542# Run lit tests, cross tests, unit tests, and spec2k/x86-32.
Jim Stichnoth6c4ad842015-11-16 12:47:57 -0800543 +make -f Makefile.standalone \
Jim Stichnoth98ba0062016-03-07 09:26:22 -0800544 check check-spec
John Porto4ab4fbe2016-01-20 13:44:30 -0800545# Run spec2k/x86-64.
546 +make -f Makefile.standalone \
547 TARGET=x8664 check-spec
Jim Stichnoth23bee882015-11-17 06:14:05 -0800548# Build spec2k under -Om1/x86-32, to check for liveness errors.
Jim Stichnoth6c4ad842015-11-16 12:47:57 -0800549 +make -f Makefile.standalone \
550 SPECFLAGS='-Om1' SPECBUILDONLY=true check-spec
John Porto4ab4fbe2016-01-20 13:44:30 -0800551# Build spec2k under -Om1/x86-64, to check for liveness errors.
552 +make -f Makefile.standalone \
553 SPECFLAGS='-Om1' TARGET=x8664 SPECBUILDONLY=true check-spec
Jim Stichnoth23bee882015-11-17 06:14:05 -0800554# Run spec2k for x86-32 without advanced phi lowering.
Jim Stichnoth6c4ad842015-11-16 12:47:57 -0800555 +make -f Makefile.standalone \
Jim Stichnothc8f56a32016-03-07 09:54:15 -0800556 SPECFLAGS='-O2 --sz=--phi-edge-split=0' check-spec
John Porto4ab4fbe2016-01-20 13:44:30 -0800557# Run spec2k for x86-64 without advanced phi lowering.
558 +make -f Makefile.standalone \
Jim Stichnothc8f56a32016-03-07 09:54:15 -0800559 SPECFLAGS='-O2 --sz=--phi-edge-split=0' TARGET=x8664 check-spec
David Sehrb19d39c2016-01-13 14:17:37 -0800560# Run cross tests and lit tests to validate filetype=asm output.
561 +make -f Makefile.standalone \
562 FORCEASM=1 check-xtest check-lit
Jim Stichnoth23bee882015-11-17 06:14:05 -0800563# Build spec2k for arm32.
Jim Stichnoth6c4ad842015-11-16 12:47:57 -0800564 +make -f Makefile.standalone \
565 TARGET=arm32 SPECBUILDONLY=true check-spec
Jim Stichnoth23bee882015-11-17 06:14:05 -0800566# Build spec2k under -Om1/arm32.
Jim Stichnoth6c4ad842015-11-16 12:47:57 -0800567 +make -f Makefile.standalone \
568 TARGET=arm32 SPECFLAGS='-Om1' SPECBUILDONLY=true check-spec
John Portob8196652016-01-19 06:19:14 -0800569# Run a few spec2k tests for arm32 using qemu. Keep the list sorted in
570# roughly reverse order of runtime.
Jim Stichnoth6c4ad842015-11-16 12:47:57 -0800571 +make -f Makefile.standalone \
John Portob8196652016-01-19 06:19:14 -0800572 TARGET=arm32 ALLSPEC='252.eon 254.gap 176.gcc 181.mcf' check-spec
Jim Stichnoth23bee882015-11-17 06:14:05 -0800573# Provide validation of user awesomeness!
Jim Stichnoth6c4ad842015-11-16 12:47:57 -0800574 echo Success
575
Jim Stichnothdd842db2015-01-27 12:53:53 -0800576FORMAT_BLACKLIST =
577# Add one of the following lines for each source file to ignore.
578FORMAT_BLACKLIST += ! -name IceParseInstsTest.cpp
Karl Schimpf74cd8832015-06-23 11:05:01 -0700579FORMAT_BLACKLIST += ! -name IceParseTypesTest.cpp
Karl Schimpf3e53dc92015-10-07 13:24:01 -0700580FORMAT_BLACKLIST += ! -name assembler_arm.h
581FORMAT_BLACKLIST += ! -name assembler_arm.cc
Derek Schuffbc643132014-05-22 16:39:25 -0700582format:
Jim Stichnoth0a9e1262015-04-21 09:59:21 -0700583 $(CLANG_FORMAT_PATH)/clang-format -style=LLVM -i \
Jim Stichnoth2e7de232015-11-02 08:25:57 -0800584 `find . -regex '.*\.\(c\|h\|cpp\)' $(FORMAT_BLACKLIST)`
Jim Stichnoth240e0f82014-07-09 16:53:40 -0700585
Jim Stichnoth240e0f82014-07-09 16:53:40 -0700586format-diff:
Jim Stichnoth206833c2014-08-07 10:58:05 -0700587 git diff -U0 `git merge-base HEAD master` | \
Jim Stichnoth2e7de232015-11-02 08:25:57 -0800588 PATH=$(PNACL_BIN_PATH):$(PATH) \
589 $(LLVM_SRC_PATH)/../clang/tools/clang-format/clang-format-diff.py \
590 -p1 -style=LLVM -i
Derek Schuffbc643132014-05-22 16:39:25 -0700591
Jim Stichnoth307e3262015-02-12 16:10:37 -0800592bloat: make_symlink
Jim Stichnothfa0cfa52015-02-26 09:42:36 -0800593 nm -C -S -l pnacl-sz | \
Jim Stichnoth2e7de232015-11-02 08:25:57 -0800594 bloat/bloat.py --nm-output=/dev/stdin syms > build/pnacl-sz.bloat.json
Jim Stichnothfa0cfa52015-02-26 09:42:36 -0800595 @echo See Subzero size breakdown in bloat/pnacl-sz.bloat.html
Jim Stichnoth307e3262015-02-12 16:10:37 -0800596
Jim Stichnothc4ed5492016-02-29 09:16:00 -0800597bloat-sb: sb_make_symlink
598 $(foreach nexe,$(NEXES),nm -C -S -l $(nexe) | bloat/bloat.py \
599 --nm-output=/dev/stdin syms > build/$(notdir $(nexe)).bloat.json;)
600 @echo "See Subzero size breakdown in:"
601 @$(foreach nexe,$(NEXES),echo " bloat/$(notdir $(nexe)).bloat.html";)
602
Andrew Sculla509e1d2015-06-29 11:07:08 -0700603docs:
Reed Kotler4cba1cb2016-01-07 08:45:13 -0800604 make -C docs -f Makefile.standalone
Andrew Sculla509e1d2015-06-29 11:07:08 -0700605
Reed Kotler2c3c82e2016-01-21 20:33:08 -0800606help:
607 @cat Makefile.standalone-help/help.txt
608
609help-check-lit:
610 @cat Makefile.standalone-help/check-lit.txt
611
612help-check-xtest:
613 @cat Makefile.standalone-help/check-xtest.txt
614
Derek Schuffbc643132014-05-22 16:39:25 -0700615clean:
Jim Stichnothc4ed5492016-02-29 09:16:00 -0800616 rm -rf pnacl-sz *.o $(foreach nexe,$(NEXES),$(notdir $(nexe))) \
617 $(OBJDIR) $(SB_OBJDIR) $(SBB_OBJDIR) build/*.bloat.json
Karl Schimpfb262c5e2014-10-27 14:41:57 -0700618
619clean-all: clean
Reed Kotler4cba1cb2016-01-07 08:45:13 -0800620 rm -rf build/ crosstest/Output/