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:
5 # make LLVM_SRC_PATH=<path> LIBCXX_INSTALL_PATH=<path> CLANG_PATH=<path> \
6 # PNACL_BIN_PATH=<path> ...
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
16 # The x86-32-specific sandboxed translator directory.
17 # It holds sandboxed versions of libraries and binaries.
18 SB_LLVM_PATH ?= $(shell readlink -e \
19 ../../out/sandboxed_translators_work/translator-i686/llvm-sb/Release)
21 # NACL_ROOT is the root of the native client repository.
22 NACL_ROOT ?= $(shell python -c "import sys; sys.path.insert(0, 'pydir'); \
23 import utils; print utils.FindBaseNaCl()")
25 # TOOLCHAIN_ROOT is the location of NaCl/PNaCl toolchains and other
27 TOOLCHAIN_ROOT ?= $(shell readlink -e $(NACL_ROOT)/toolchain/linux_x86)
29 # PNACL_TOOLCHAIN_ROOT is the location of the PNaCl toolchain.
30 # This is used as the default root for finding binutils, libcxx, etc.
31 PNACL_TOOLCHAIN_ROOT ?= $(shell readlink -e $(TOOLCHAIN_ROOT)/pnacl_newlib_raw)
33 # The location of PNaCl tools (e.g., binutils objdump, pnacl-clang++, etc.).
34 PNACL_BIN_PATH ?= $(shell readlink -e $(PNACL_TOOLCHAIN_ROOT)/bin)
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
44 # Hack to auto-detect autoconf versus cmake build of LLVM. If the LLVM tools
45 # were dynamically linked with something like libLLVM-3.7svn.so, it is an
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-)
50 # CLANG_PATH is the location of the clang compiler to use for building
52 CLANG_PATH ?= $(shell readlink -e \
53 $(NACL_ROOT)/../third_party/llvm-build/Release+Asserts/bin)
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)
59 STDLIB_FLAGS := -stdlib=libc++ -I$(LIBCXX_INSTALL_PATH)/include/c++/v1
62 ifeq ($(HOST_ARCH),x86_64)
65 ifeq ($(HOST_ARCH),x86)
75 OBJDIR = build/Release
76 OPTLEVEL = -O2 -ffunction-sections -fdata-sections
80 # The list of CXX defines that are dependent on build parameters.
88 OBJDIR := $(OBJDIR)+Min
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
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
97 OBJDIR := $(OBJDIR)+NoDump
98 BASE_CXX_DEFINES += -DALLOW_DUMP=0
100 BASE_CXX_DEFINES += -DALLOW_DUMP=1
103 # Restrict to a single supported target. Current options:
109 OBJDIR := $(OBJDIR)+T_$(SZTARGET)
110 BASE_CXX_DEFINES += -DSZTARGET=$(SZTARGET)
113 BASE_CXX_DEFINES += -DPNACL_LLVM
115 CXX_DEFINES := $(BASE_CXX_DEFINES) -DPNACL_BROWSER_TRANSLATOR=0
118 ASSERTIONS = -DNDEBUG
121 OBJDIR := $(OBJDIR)+Asserts
125 OBJDIR := $(OBJDIR)+UBSan
126 CXX_EXTRA += -fsanitize=undefined -fno-sanitize=vptr \
127 -fno-sanitize=nonnull-attribute
128 LD_EXTRA += -fsanitize=undefined
132 OBJDIR := $(OBJDIR)+UBSan_Trap
133 CXX_EXTRA += -fsanitize=undefined-trap -fsanitize-undefined-trap-on-error \
134 -fno-sanitize=vptr -fno-sanitize=nonnull-attribute
135 LD_EXTRA += -fsanitize=undefined-trap
139 OBJDIR := $(OBJDIR)+TSan
140 CXX_EXTRA += -fsanitize=thread
141 LD_EXTRA += -fsanitize=thread
145 OBJDIR := $(OBJDIR)+ASan
146 CXX_EXTRA += -fsanitize=address
147 LD_EXTRA += -fsanitize=address
151 # TODO(ascull): this has an as yet undiagnosed uninitialized memory access
152 OBJDIR := $(OBJDIR)+MSan
153 CXX_EXTRA += -fsanitize=memory
154 LD_EXTRA += -fsanitize=memory
158 FORCEASM_FLAG = --filetype=asm
159 # With --filetype=asm and --sandbox, the llvm-mc assembler emits the lock and
160 # 16-bit prefixes in the "wrong" order, causing the validator to reject the
161 # resulting nexe. So we just disable those tests for now.
162 FORCEASM_XTEST_EXCLUDES = -e x8632,sandbox,test_sync_atomic
163 FORCEASM_LIT_PARAM = --param=FORCEASM
164 # x86 sandboxing lit tests are disabled because filetype=asm does not
165 # handle bundle_lock pad-to-end correctly.
166 # TODO(jpp): fix this.
167 FORCEASM_LIT_TEST_EXCLUDES = --filter='^(?!.*/x86/sandboxing.ll).*'
170 FORCEASM_XTEST_EXCLUDES =
172 FORCEASM_LIT_TEST_EXCLUDES =
175 ifdef LINUX_MALLOC_PROFILE
176 OBJDIR := $(OBJDIR)+MalProf
177 CXX_EXTRA += -DALLOW_LINUX_MALLOC_PROFILE=1
178 LD_EXTRA += -Wl,--export-dynamic
181 SB_OBJDIR := $(OBJDIR)+Sandboxed
182 SBB_OBJDIR := $(OBJDIR)+SandboxedBrowser
184 V8_DIR = $(NACL_ROOT)/../v8
185 V8_CXXFLAGS := -I$(V8_DIR)
187 $(info -----------------------------------------------)
188 $(info Using LLVM_SRC_PATH = $(LLVM_SRC_PATH))
189 $(info Using SB_LLVM_PATH = $(SB_LLVM_PATH))
190 $(info Using NACL_ROOT = $(NACL_ROOT))
191 $(info Using TOOLCHAIN_ROOT = $(TOOLCHAIN_ROOT))
192 $(info Using PNACL_TOOLCHAIN_ROOT = $(PNACL_TOOLCHAIN_ROOT))
193 $(info Using PNACL_BIN_PATH = $(PNACL_BIN_PATH))
194 $(info Using CLANG_PATH = $(CLANG_PATH))
195 $(info Using LIBCXX_INSTALL_PATH = $(LIBCXX_INSTALL_PATH))
196 $(info Using HOST_ARCH = $(HOST_ARCH))
197 $(info -----------------------------------------------)
199 LLVM_CXXFLAGS := `$(PNACL_BIN_PATH)/llvm-config --cxxflags`
200 SB_LLVM_CXXFLAGS := $(LLVM_CXXFLAGS)
202 # Listing specific libraries that are needed for pnacl-sz
203 # and the unittests, since we build "tools-only" for the
204 # sandboxed_translators (which doesn't include every library
205 # listed by llvm-config).
207 LLVM_LIBS_LIST := -lLLVMIRReader -lLLVMBitReader -lLLVMNaClBitTestUtils \
208 -lLLVMNaClBitReader -lLLVMNaClBitAnalysis -lLLVMNaClBitWriter \
209 -lLLVMAsmParser -lLLVMNaClAnalysis -lLLVMCore -lLLVMSupport
211 ifeq ($(AUTOCONF), 0)
213 LLVM_LIBS := $(LLVM_LIBS_LIST)
214 # For the cmake build, the gtest libs end up in the same place as the LLVM
215 # libs, so no "-L..." arg is needed.
217 CLANG_FORMAT_PATH ?= $(PNACL_BIN_PATH)
219 # LLVM autoconf build
220 LLVM_LIBS := -lLLVM-3.7svn
221 GTEST_LIB_PATH ?= -L../../out/llvm_x86_64_linux_work/Release+Asserts/lib
222 CLANG_FORMAT_PATH ?= ../../out/llvm_x86_64_linux_work/Release+Asserts/bin
225 LLVM_LDFLAGS := $(LLVM_LIBS) \
226 `$(PNACL_BIN_PATH)/llvm-config --ldflags` \
227 `$(PNACL_BIN_PATH)/llvm-config --system-libs`
228 SB_LLVM_LDFLAGS := -Wl,--start-group $(LLVM_LIBS_LIST) -Wl,--end-group \
229 -L$(SB_LLVM_PATH)/lib
231 CCACHE := `command -v ccache`
232 CXX := CCACHE_CPP2=yes $(CCACHE) $(CLANG_PATH)/clang++
233 SB_CXX := CCACHE_CPP2=yes $(CCACHE) $(PNACL_BIN_PATH)/pnacl-clang++
234 SB_TRANSLATE := $(PNACL_BIN_PATH)/pnacl-translate
235 SB_FINALIZE := $(PNACL_BIN_PATH)/pnacl-finalize --no-strip-syms
237 # Extra warnings that LLVM's build system adds in addition to -Wall.
238 LLVM_EXTRA_WARNINGS := -Wcovered-switch-default
240 # Use g++ to compile, to check for errors/warnings that clang++ might have
241 # missed. It's unlikely to link, unless LLVM was also built with g++, so the
242 # compile_only target should be used. Note: This ifdef section is deliberately
243 # placed here instead of with the other ifdef sections, so that its redefinition
244 # of CXX/STDLIB_FLAGS/LLVM_EXTRA_WARNINGS follows their normal definitions.
246 CXX := CCACHE_CPP2=yes $(CCACHE) g++
248 LLVM_EXTRA_WARNINGS := \
252 -Wno-maybe-uninitialized \
253 -Wno-missing-field-initializers \
254 -Wno-unused-parameter \
256 OBJDIR := $(OBJDIR)+Gplusplus
259 BASE_CXXFLAGS := -std=gnu++11 -Wall -Wextra -fno-rtti \
260 -fno-exceptions $(OPTLEVEL) $(ASSERTIONS) -g -pedantic \
261 $(LLVM_EXTRA_WARNINGS) $(CXX_EXTRA) -MP -MD -Werror
264 BASE_CXXFLAGS := $(BASE_CXXFLAGS) $(V8_CXXFLAGS) -DALLOW_WASM=1
265 OBJDIR := $(OBJDIR)+Wasm
267 BASE_CXXFLAGS := $(BASE_CXXFLAGS) -DALLOW_WASM=0
270 # TODO(stichnot,jpp): Restructure static fields in template classes to avoid
271 # needing -Wno-undefined-var-template .
272 CXXFLAGS := $(LLVM_CXXFLAGS) $(BASE_CXXFLAGS) $(CXX_DEFINES) $(HOST_FLAGS) \
273 $(STDLIB_FLAGS) -Wno-undefined-var-template
274 SB_CXXFLAGS := $(SB_LLVM_CXXFLAGS) $(BASE_CXXFLAGS) $(BASE_CXX_DEFINES) \
275 -Wno-unknown-pragmas -I$(NACL_ROOT) -I$(NACL_ROOT)/..
277 LDFLAGS := $(HOST_FLAGS) -L$(LIBCXX_INSTALL_PATH)/lib -Wl,--gc-sections \
278 $(LD_EXTRA) $(STDLIB_FLAGS)
279 # Not specifying -Wl,--gc-sections but instead doing bitcode linking GC w/ LTO.
280 SB_LDFLAGS := $(LINKOPTLEVEL) $(LD_EXTRA)
282 # List the target-specific source files first, which generally take longer to
283 # compile, in the hope of improving parallel build time.
285 IceAssemblerARM32.cpp \
290 IceTargetLowering.cpp \
291 IceTargetLoweringARM32.cpp \
292 IceTargetLoweringMIPS32.cpp \
293 IceTargetLoweringX86.cpp \
294 IceTargetLoweringX8632.cpp \
295 IceTargetLoweringX8664.cpp \
297 IceBrowserCompileServer.cpp \
302 IceCompileServer.cpp \
303 IceELFObjectWriter.cpp \
306 IceGlobalContext.cpp \
311 IceLoopAnalyzer.cpp \
318 IceSwitchLowering.cpp \
323 LinuxMallocProfiling.cpp \
338 OBJS=$(patsubst %.cpp, $(OBJDIR)/%.o, $(SRCS))
339 SB_OBJS=$(patsubst %.cpp, $(SB_OBJDIR)/%.o, $(SRCS))
340 SBB_OBJS=$(patsubst %.cpp, $(SBB_OBJDIR)/%.o, $(SRCS))
344 IceELFSectionTest.cpp \
345 IceParseInstsTest.cpp
347 # The X86 assembler tests take too long to compile. Given how infrequently the
348 # assembler will change, we disable them.
351 $(error Run check-unit with DEBUG=1 lest your machine perish)
353 UNITTEST_SRCS += AssemblerX8632/LowLevel.cpp \
354 AssemblerX8632/DataMov.cpp \
355 AssemblerX8632/Locked.cpp \
356 AssemblerX8632/GPRArith.cpp \
357 AssemblerX8632/XmmArith.cpp \
358 AssemblerX8632/ControlFlow.cpp \
359 AssemblerX8632/Other.cpp \
360 AssemblerX8632/X87.cpp \
361 AssemblerX8664/LowLevel.cpp \
362 AssemblerX8664/DataMov.cpp \
363 AssemblerX8664/Locked.cpp \
364 AssemblerX8664/GPRArith.cpp \
365 AssemblerX8664/XmmArith.cpp \
366 AssemblerX8664/ControlFlow.cpp \
367 AssemblerX8664/Other.cpp
370 UNITTEST_OBJS = $(patsubst %.cpp, $(OBJDIR)/unittest/%.o, $(UNITTEST_SRCS))
371 UNITTEST_LIB_OBJS = $(filter-out $(OBJDIR)/main.o,$(OBJS))
373 NEXES = $(SB_OBJDIR)/pnacl-sz.x8632.nexe \
374 $(SB_OBJDIR)/pnacl-sz.x8664.nexe \
375 $(SBB_OBJDIR)/pnacl_public_x86_32_pnacl_sz_nexe \
376 $(SBB_OBJDIR)/pnacl_public_x86_64_pnacl_sz_nexe
377 NEXES_LITE = $(SB_OBJDIR)/pnacl-sz.x8664.nexe
379 # Keep all the first target so it's the default.
380 all: $(OBJDIR)/pnacl-sz make_symlink runtime
384 @echo "Skipping pnacl-sz.*.nexe: TSAN isn't supported under NaCl."
386 sb: $(NEXES) sb_make_symlink exists-sbtc
387 sb-lite: $(NEXES_LITE) exists-sbtc
390 # SHOW_BUILD_ATTS is an executable that is run to show what build
391 # attributes were used to build pnacl-sz.
392 SHOW_BUILD_ATTS = $(OBJDIR)/pnacl-sz --build-atts
394 # Creates symbolic link so that testing is easier. Also runs
395 # pnacl-sz to verify that the defines flags have valid values,
396 # as well as describe the corresponding build attributes.
397 make_symlink: $(OBJDIR)/pnacl-sz
399 ln -s $(OBJDIR)/pnacl-sz
400 @echo "Build Attributes:"
403 sb_make_symlink: $(NEXES)
404 $(foreach nexe,$(NEXES),rm -rf $(notdir $(nexe)); ln -s $(nexe);)
406 %.pexe : %.nonfinal.pexe
407 $(SB_FINALIZE) -o $@ $<
409 .PHONY: all compile_only make_symlink runtime bloat sb docs help \
410 help-check-lit help-check-xtest exists-nonsfi-x8632 \
411 exists-nonsfi-arm32 exists-sbtc exists-spec
413 compile_only: $(OBJS)
415 V8_LIBDIR=$(V8_DIR)/out/native/lib.target
419 $(V8_LIBDIR)/libv8.so \
420 $(V8_LIBDIR)/libicuuc.so \
421 $(V8_LIBDIR)/libicui18n.so
424 $(OBJDIR)/pnacl-sz: $(OBJS)
425 $(CXX) $(LDFLAGS) -o $@ $^ $(LLVM_LDFLAGS) \
426 -Wl,-rpath=$(abspath $(LIBCXX_INSTALL_PATH)/lib) $(V8_LIBS)
428 $(SB_OBJDIR)/pnacl-sz.nonfinal.pexe: $(SB_OBJS)
429 $(SB_CXX) $(SB_LDFLAGS) -o $@ $^ $(SB_LLVM_LDFLAGS)
431 $(SBB_OBJDIR)/pnacl-sz.nonfinal.pexe: $(SBB_OBJS)
432 $(SB_CXX) $(SB_LDFLAGS) -o $@ $^ $(SB_LLVM_LDFLAGS) \
433 --pnacl-disable-abi-check
435 $(SB_OBJDIR)/pnacl-sz.x8632.nexe: $(SB_OBJDIR)/pnacl-sz.pexe
436 $(SB_TRANSLATE) -arch x86-32 $^ -o $@
438 $(SB_OBJDIR)/pnacl-sz.x8664.nexe: $(SB_OBJDIR)/pnacl-sz.pexe
439 $(SB_TRANSLATE) -arch x86-64 $^ -o $@
441 $(SBB_OBJDIR)/pnacl_public_x86_32_pnacl_sz_nexe: $(SBB_OBJDIR)/pnacl-sz.pexe
442 $(SB_TRANSLATE) -arch x86-32 $^ -o $@
444 $(SBB_OBJDIR)/pnacl_public_x86_64_pnacl_sz_nexe: $(SBB_OBJDIR)/pnacl-sz.pexe
445 $(SB_TRANSLATE) -arch x86-64 $^ -o $@
447 src/IceRegistersARM32.def: pydir/gen_arm32_reg_tables.py
450 -include $(foreach dep,$(SRCS:.cpp=.d),$(OBJDIR)/$(dep))
451 $(OBJS): $(OBJDIR)/%.o: src/%.cpp
452 $(CXX) -c $(CXXFLAGS) $< -o $@
454 -include $(foreach dep,$(SRCS:.cpp=.d),$(SB_OBJDIR)/$(dep))
455 $(SB_OBJS): $(SB_OBJDIR)/%.o: src/%.cpp
456 $(SB_CXX) -c $(SB_CXXFLAGS) -DPNACL_BROWSER_TRANSLATOR=0 $< -o $@
458 -include $(foreach dep,$(SRCS:.cpp=.d),$(SBB_OBJDIR)/$(dep))
459 $(SBB_OBJS): $(SBB_OBJDIR)/%.o: src/%.cpp
460 $(SB_CXX) -c $(SB_CXXFLAGS) -DPNACL_BROWSER_TRANSLATOR=1 $< -o $@
462 $(OBJDIR)/run_unittests: $(UNITTEST_OBJS) $(UNITTEST_LIB_OBJS)
463 $(CXX) $(GTEST_LIB_PATH) $(LDFLAGS) -o $@ $^ $(LLVM_LDFLAGS) \
464 -lgtest -lgtest_main -ldl \
465 -Wl,-rpath=$(abspath $(LIBCXX_INSTALL_PATH)/lib)
467 -include $(foreach dep,$(UNITTEST_SRCS:.cpp=.d),$(OBJDIR)/unittest/$(dep))
468 $(UNITTEST_OBJS): $(OBJDIR)/unittest/%.o: unittest/%.cpp
469 $(CXX) -c $(CXXFLAGS) \
472 -I$(LLVM_SRC_PATH)/utils/unittest/googletest/include \
474 -DGTEST_HAS_RTTI=0 -DGTEST_USE_OWN_TR1_TUPLE \
475 -Wno-expansion-to-defined \
479 $(SB_OBJS): | $(SB_OBJDIR)
480 $(SBB_OBJS): | $(SBB_OBJDIR)
482 $(UNITTEST_OBJS): | $(OBJDIR)/unittest $(OBJDIR)/unittest/AssemblerX8632 \
483 $(OBJDIR)/unittest/AssemblerX8664
492 $(OBJDIR)/unittest: $(OBJDIR)
495 $(OBJDIR)/unittest/AssemblerX8632: $(OBJDIR)/unittest
497 $(OBJDIR)/unittest/AssemblerX8664: $(OBJDIR)/unittest
500 RT_SRC := runtime/szrt.c runtime/szrt_ll.ll runtime/szrt_profiler.c \
501 runtime/szrt_asm_x8632.s runtime/szrt_asm_x8664.s \
502 runtime/szrt_asm_arm32.s
503 RT_OBJ := build/runtime/szrt_native_x8632.o build/runtime/szrt_sb_x8632.o \
504 build/runtime/szrt_nonsfi_x8632.o \
505 build/runtime/szrt_native_x8664.o build/runtime/szrt_sb_x8664.o \
506 build/runtime/szrt_nonsfi_x8664.o \
507 build/runtime/szrt_native_arm32.o build/runtime/szrt_sb_arm32.o \
508 build/runtime/szrt_nonsfi_arm32.o
512 # Use runtime.is.built so that build-runtime.py is invoked only once
513 # even in a parallel build.
514 .INTERMEDIATE: runtime.is.built
515 $(RT_OBJ): runtime.is.built
516 runtime.is.built: $(RT_SRC) pydir/build-runtime.py
517 @echo ================ Building Subzero runtime ================
518 ./pydir/build-runtime.py -v --pnacl-root $(PNACL_TOOLCHAIN_ROOT)
520 check-lit: $(OBJDIR)/pnacl-sz make_symlink
521 PNACL_BIN_PATH=$(PNACL_BIN_PATH) \
522 $(LLVM_SRC_PATH)/utils/lit/lit.py -sv $(CHECK_LIT_TESTS) \
523 $(FORCEASM_LIT_TEST_EXCLUDES) $(FORCEASM_LIT_PARAM)
526 check-xtest check-xtest-lite: $(OBJDIR)/pnacl-sz make_symlink runtime
527 @echo "Crosstests disabled, minimal build"
529 check-xtest: $(OBJDIR)/pnacl-sz make_symlink runtime \
530 exists-nonsfi-x8632 exists-nonsfi-arm32 crosstest/test_arith_ll.ll
531 # Do all native/sse2 tests, but only test_vector_ops for native/sse4.1.
532 # For (slow) sandboxed tests, limit to Om1/sse4.1.
533 # run.py (used to run the sandboxed xtests) does not support
534 # specifying -cpu cortex-a15 to qemu, hence we disable the
536 ./pydir/crosstest_generator.py -v --lit \
537 --toolchain-root $(TOOLCHAIN_ROOT) \
539 $(FORCEASM_XTEST_EXCLUDES) \
540 -i x8632,native,sse2 \
541 -i x8632,native,sse4.1,test_vector_ops \
542 -i x8632,sandbox,sse4.1,Om1 \
543 -i x8632,nonsfi,sse2,O2 \
544 -i x8664,native,sse2 \
545 -i x8664,native,sse4.1,test_vector_ops \
546 -i x8664,sandbox,sse4.1,Om1 \
548 -e arm32,sandbox,hwdiv-arm
549 PNACL_BIN_PATH=$(PNACL_BIN_PATH) \
550 $(LLVM_SRC_PATH)/utils/lit/lit.py -sv $(CHECK_XTEST_TESTS)
551 check-xtest-lite: $(OBJDIR)/pnacl-sz make_symlink runtime \
552 exists-nonsfi-x8632 exists-nonsfi-arm32 crosstest/test_arith_ll.ll
553 # Do all native/sse2/neon tests, which are relatively fast.
554 # Limit to test_global+mem_intrin for sandbox+nonsfi because sandbox and
555 # nonsfi builds are slow, and test_global and mem_intrin are the most
556 # common sources of problems.
557 ./pydir/crosstest_generator.py -v --lit \
558 --toolchain-root $(TOOLCHAIN_ROOT) \
560 $(FORCEASM_XTEST_EXCLUDES) \
561 -i x8632,native,sse2,O2 \
562 -i x8664,native,sse2,O2 \
563 -i arm32,native,neon,O2 \
564 -i x8632,sse2,O2,test_global \
565 -i x8632,sse2,O2,mem_intrin \
566 -i x8664,sse2,O2,test_global \
567 -i x8664,sse2,O2,mem_intrin \
568 -i arm32,neon,O2,test_global \
569 -i arm32,neon,O2,mem_intrin \
571 PNACL_BIN_PATH=$(PNACL_BIN_PATH) \
572 $(LLVM_SRC_PATH)/utils/lit/lit.py -sv $(CHECK_XTEST_TESTS)
573 crosstest/test_arith_ll.ll: pydir/gen_test_arith_ll.py
577 check-unit: $(OBJDIR)/run_unittests
578 $(OBJDIR)/run_unittests
580 # List the spec2k components in roughly reverse order of runtime, to help with
581 # parallel execution speed.
582 ALLSPEC := 253.perlbmk 177.mesa 188.ammp 256.bzip2 164.gzip 179.art 183.equake \
583 175.vpr 176.gcc 181.mcf 186.crafty 197.parser 254.gap 255.vortex \
588 ifeq ($(TARGET),x8632)
590 SETUP=SetupGccX8632Opt
591 SPEC := --filetype=obj
593 ifeq ($(TARGET),x8664)
595 SETUP=SetupGccX8664Opt
596 SPEC := --filetype=obj
598 ifeq ($(TARGET),arm32)
601 SPEC := --filetype=obj
605 %.spec2k: % $(OBJDIR)/pnacl-sz make_symlink runtime
606 ./pydir/szbuild_spec2k.py -v \
607 $(SPECFLAGS) --target=$(TARGETFLAG) $(SPEC) $< $(SPECRUN)
609 check-spec: exists-spec $(ALLSPEC:=.spec2k)
611 check: check-lit check-unit check-xtest
613 NONSFI_LOADER_X8632 = \
614 $(NACL_ROOT)/scons-out/opt-linux-x86-32/obj/src/nonsfi/loader/nonsfi_loader
615 NONSFI_LOADER_ARM32 = \
616 $(NACL_ROOT)/scons-out/opt-linux-arm/obj/src/nonsfi/loader/nonsfi_loader
617 SBTC_LIBFILE = $(SB_LLVM_PATH)/lib/libLLVMSupport.a
618 SPEC_SAMPLE_PEXE = $(NACL_ROOT)/tests/spec2k/176.gcc/gcc.opt.stripped.pexe
621 @if [ ! -f $(NONSFI_LOADER_X8632) ] ; then \
622 echo "Missing file $(NONSFI_LOADER_X8632)"; \
623 echo "Consider running './scons nonsfi_loader'" \
624 "in the native_client directory."; \
629 @if [ ! -f $(NONSFI_LOADER_ARM32) ] ; then \
630 echo "Missing file $(NONSFI_LOADER_ARM32)"; \
631 echo "Consider running './scons platform=arm nonsfi_loader'" \
632 "in the native_client directory."; \
637 @if [ ! -f $(SBTC_LIBFILE) ] ; then \
638 echo "Missing file $(SBTC_LIBFILE)"; \
639 echo "Consider running 'toolchain_build_pnacl.py --build-sbtc'."; \
644 @if [ ! -f $(SPEC_SAMPLE_PEXE) ] ; then \
645 echo "Missing file $(SPEC_SAMPLE_PEXE)"; \
646 echo "Consider running" \
647 "'./run_all.sh BuildBenchmarks 0 SetupPnaclX8632Opt'" \
648 "in the native_client/tests/spec2k directory."; \
652 check-presubmit presubmit: exists-nonsfi-x8632 exists-nonsfi-arm32 \
653 exists-sbtc exists-spec
654 # Make sure clang-format gets run.
655 +make -f Makefile.standalone format
656 # Verify MINIMAL build, plus proper usage of REQUIRES in lit tests.
657 +make -f Makefile.standalone \
659 # Check that there are no g++ build errors or warnings.
660 +make -f Makefile.standalone \
661 GPLUSPLUS=1 compile_only
662 # Check the x86 assembler unit tests.
663 +make -f Makefile.standalone \
664 DEBUG=1 CHECK_X86_ASM=1 check-unit sb
665 # Run lit tests, cross tests, unit tests, and spec2k/x86-32.
666 +make -f Makefile.standalone \
669 +make -f Makefile.standalone \
670 TARGET=x8664 check-spec
671 # Run spec2k/x86-64 with sandboxing.
672 +make -f Makefile.standalone \
673 SPECFLAGS='-O2 --sandbox' TARGET=x8664 check-spec
674 # Build spec2k under -Om1/x86-32, to check for liveness errors.
675 +make -f Makefile.standalone \
676 SPECFLAGS='-Om1' SPECRUN= check-spec
677 # Build spec2k under -Om1/x86-64, to check for liveness errors.
678 +make -f Makefile.standalone \
679 SPECFLAGS='-Om1' TARGET=x8664 SPECRUN= check-spec
680 # Run spec2k for x86-32 without advanced phi lowering.
681 +make -f Makefile.standalone \
682 SPECFLAGS='-O2 --sz=--phi-edge-split=0' check-spec
683 # Run spec2k for x86-64 without advanced phi lowering.
684 +make -f Makefile.standalone \
685 SPECFLAGS='-O2 --sz=--phi-edge-split=0' TARGET=x8664 check-spec
686 # Run cross tests and lit tests to validate filetype=asm output.
687 +make -f Makefile.standalone \
688 FORCEASM=1 check-xtest check-lit
689 # Build spec2k for arm32.
690 +make -f Makefile.standalone \
691 TARGET=arm32 SPECRUN= check-spec
692 # Build spec2k under -Om1/arm32.
693 +make -f Makefile.standalone \
694 TARGET=arm32 SPECFLAGS='-Om1' SPECRUN= check-spec
695 # Run a few spec2k tests for arm32 using qemu. Keep the list sorted in
696 # roughly reverse order of runtime.
697 +make -f Makefile.standalone \
698 TARGET=arm32 ALLSPEC='252.eon 254.gap 176.gcc 181.mcf' check-spec
699 # Provide validation of user awesomeness!
702 presubmit-lite: exists-nonsfi-x8632 exists-nonsfi-arm32 \
703 exists-sbtc exists-spec
704 # Make sure clang-format gets run.
705 +make -f Makefile.standalone format
706 # Verify MINIMAL build, plus proper usage of REQUIRES in lit tests.
707 +make -f Makefile.standalone \
708 MINIMAL=1 check sb-lite
709 # Check that there are no g++ build errors or warnings.
710 +make -f Makefile.standalone \
711 GPLUSPLUS=1 compile_only
712 # Run lit tests, cross tests, unit tests, and spec2k/x86-32.
713 +make -f Makefile.standalone \
714 check-lit check-unit check-spec
715 +make -f Makefile.standalone \
718 +make -f Makefile.standalone \
719 TARGET=x8664 check-spec
720 # Build spec2k under -Om1/x86-32, to check for liveness errors.
721 +make -f Makefile.standalone \
722 SPECFLAGS='-Om1' SPECRUN= check-spec
723 # Build spec2k under -Om1/x86-64, to check for liveness errors.
724 +make -f Makefile.standalone \
725 SPECFLAGS='-Om1' TARGET=x8664 SPECRUN= check-spec
726 # Run cross tests and lit tests to validate filetype=asm output.
727 +make -f Makefile.standalone \
729 +make -f Makefile.standalone \
730 FORCEASM=1 check-xtest-lite
731 # Build spec2k under -Om1/arm32.
732 +make -f Makefile.standalone \
733 TARGET=arm32 SPECFLAGS='-Om1' SPECRUN= check-spec
734 # Run a few spec2k tests for arm32 using qemu. Keep the list sorted in
735 # roughly reverse order of runtime.
736 +make -f Makefile.standalone \
737 TARGET=arm32 ALLSPEC='254.gap 176.gcc 181.mcf' check-spec
738 # Provide validation of user awesomeness!
742 # Add one of the following lines for each source file to ignore.
743 FORMAT_BLACKLIST += ! -name IceParseInstsTest.cpp
744 FORMAT_BLACKLIST += ! -name IceParseTypesTest.cpp
745 FORMAT_BLACKLIST += ! -name assembler_arm.h
746 FORMAT_BLACKLIST += ! -name assembler_arm.cc
747 FORMAT_BLACKLIST += ! -path "./wasm-install/*"
748 FORMAT_BLACKLIST += ! -path "./pnacl-llvm/*"
750 $(CLANG_FORMAT_PATH)/clang-format -style=LLVM -i \
751 `find . -regex '.*\.\(c\|h\|cpp\)' $(FORMAT_BLACKLIST)`
754 git diff -U0 `git merge-base HEAD master` | \
755 PATH=$(PNACL_BIN_PATH):$(PATH) \
756 $(LLVM_SRC_PATH)/../clang/tools/clang-format/clang-format-diff.py \
760 nm -C -S -l pnacl-sz | \
761 bloat/bloat.py --nm-output=/dev/stdin syms > build/pnacl-sz.bloat.json
762 @echo See Subzero size breakdown in bloat/pnacl-sz.bloat.html
764 bloat-sb: sb_make_symlink
765 $(foreach nexe,$(NEXES),nm -C -S -l $(nexe) | bloat/bloat.py \
766 --nm-output=/dev/stdin syms > build/$(notdir $(nexe)).bloat.json;)
767 @echo "See Subzero size breakdown in:"
768 @$(foreach nexe,$(NEXES),echo " bloat/$(notdir $(nexe)).bloat.html";)
771 make -C docs -f Makefile.standalone
774 @cat Makefile.standalone-help/help.txt
777 @cat Makefile.standalone-help/check-lit.txt
780 @cat Makefile.standalone-help/check-xtest.txt
783 rm -rf pnacl-sz *.o $(foreach nexe,$(NEXES),$(notdir $(nexe))) \
784 $(OBJDIR) $(SB_OBJDIR) $(SBB_OBJDIR) build/*.bloat.json
787 rm -rf build/ crosstest/Output/