OLD | NEW |
---|---|
1 # The following variables will likely need to be modified, depending on where | 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 | 2 # and how you built LLVM & Clang. They can be overridden in a command-line |
3 # invocation of make, like: | 3 # invocation of make, like: |
4 # | 4 # |
5 # make LLVM_SRC_PATH=<path> LLVM_BIN_PATH=<path> \ | 5 # make LLVM_SRC_PATH=<path> LIBCXX_INSTALL_PATH=<path> CLANG_PATH=<path> \ |
6 # LIBCXX_INSTALL_PATH=<path> CLANG_PATH=<path> \ | |
7 # PNACL_BIN_PATH=<path> ... | 6 # PNACL_BIN_PATH=<path> ... |
8 # | 7 # |
9 | 8 |
10 # LLVM_SRC_PATH is the path to the root of the checked out source code. This | 9 # LLVM_SRC_PATH is the path to the root of the checked out source code. This |
11 # directory should contain the configure script, the include/ and lib/ | 10 # directory should contain the configure script, the include/ and lib/ |
12 # directories of LLVM, Clang in tools/clang/, etc. | 11 # directories of LLVM, Clang in tools/clang/, etc. |
13 # Alternatively, if you're building vs. a binary download of LLVM, then | 12 # Alternatively, if you're building vs. a binary download of LLVM, then |
14 # LLVM_SRC_PATH can point to the main untarred directory. | 13 # LLVM_SRC_PATH can point to the main untarred directory. |
15 LLVM_SRC_PATH ?= ../llvm | 14 LLVM_SRC_PATH ?= ../llvm |
16 | 15 |
17 # LLVM_BIN_PATH is the directory where binaries are placed by the LLVM build | |
18 # process. It should contain the tools like clang, clang-format, llc, | |
19 # llvm-as, llvm-config, llvm-mc, pnacl-bcdis, and pnacl-freeze. | |
20 ifdef CMAKE | |
21 # LLVM cmake build | |
22 LLVM_BIN_PATH ?= ../../out/llvm_x86_64_linux_work/bin | |
23 else | |
24 # LLVM autoconf build | |
25 LLVM_BIN_PATH ?= ../../out/llvm_x86_64_linux_work/Release+Asserts/bin | |
26 endif | |
27 | |
28 # The x86-32-specific sandboxed translator directory. | 16 # The x86-32-specific sandboxed translator directory. |
29 # It holds sandboxed versions of libraries and binaries. | 17 # It holds sandboxed versions of libraries and binaries. |
30 SB_LLVM_PATH ?= $(shell readlink -e \ | 18 SB_LLVM_PATH ?= $(shell readlink -e \ |
31 ../../out/sandboxed_translators_work/translator-i686/llvm-sb/Release) | 19 ../../out/sandboxed_translators_work/translator-i686/llvm-sb/Release) |
32 | 20 |
33 # NACL_ROOT is the root of the native client repository. | 21 # NACL_ROOT is the root of the native client repository. |
34 NACL_ROOT ?= $(shell python -c "import sys; sys.path.insert(0, 'pydir'); \ | 22 NACL_ROOT ?= $(shell python -c "import sys; sys.path.insert(0, 'pydir'); \ |
35 import utils; print utils.FindBaseNaCl()") | 23 import utils; print utils.FindBaseNaCl()") |
36 | 24 |
37 # PNACL_TOOLCHAIN_ROOT is the location of the PNaCl toolchain. | 25 # PNACL_TOOLCHAIN_ROOT is the location of the PNaCl toolchain. |
38 # This is used as the default root for finding binutils, libcxx, etc. | 26 # This is used as the default root for finding binutils, libcxx, etc. |
39 PNACL_TOOLCHAIN_ROOT ?= $(shell readlink -e \ | 27 PNACL_TOOLCHAIN_ROOT ?= $(shell readlink -e \ |
40 » $(NACL_ROOT)/toolchain/linux_x86/pnacl_newlib) | 28 » $(NACL_ROOT)/toolchain/linux_x86/pnacl_newlib_raw) |
41 | 29 |
42 # The location of PNaCl tools (e.g., binutils objdump, pnacl-clang++, etc.). | 30 # The location of PNaCl tools (e.g., binutils objdump, pnacl-clang++, etc.). |
43 PNACL_BIN_PATH ?= $(shell readlink -e $(PNACL_TOOLCHAIN_ROOT)/bin) | 31 PNACL_BIN_PATH ?= $(shell readlink -e $(PNACL_TOOLCHAIN_ROOT)/bin) |
44 | 32 |
33 # Hack to auto-detect autoconf versus cmake build of LLVM. If the LLVM tools | |
34 # were dynamically linked with something like libLLVM-3.6svn.so, it is an | |
35 # autoconf build, otherwise it is a cmake build. AUTOCONF is set to 0 for | |
36 # cmake, nonzero for autoconf. | |
37 AUTOCONF ?= $(shell ldd $(PNACL_BIN_PATH)/opt | grep -c libLLVM-) | |
38 | |
45 # CLANG_PATH is the location of the clang compiler to use for building | 39 # CLANG_PATH is the location of the clang compiler to use for building |
46 # the host binaries. | 40 # the host binaries. |
47 CLANG_PATH ?= $(shell readlink -e \ | 41 CLANG_PATH ?= $(shell readlink -e \ |
48 $(NACL_ROOT)/../third_party/llvm-build/Release+Asserts/bin) | 42 $(NACL_ROOT)/../third_party/llvm-build/Release+Asserts/bin) |
49 | 43 |
50 # LIBCXX_INSTALL_PATH is the directory where libc++ is located. It should | 44 # LIBCXX_INSTALL_PATH is the directory where libc++ is located. It should |
51 # contain header files and corresponding libraries. This is used for | 45 # contain header files and corresponding libraries. This is used for |
52 # building the host binaries in conjuction with clang. | 46 # building the host binaries in conjuction with clang. |
53 LIBCXX_INSTALL_PATH ?= $(PNACL_TOOLCHAIN_ROOT) | 47 LIBCXX_INSTALL_PATH ?= $(PNACL_TOOLCHAIN_ROOT) |
54 STDLIB_FLAGS := -stdlib=libc++ -I$(LIBCXX_INSTALL_PATH)/include/c++/v1 | 48 STDLIB_FLAGS := -stdlib=libc++ -I$(LIBCXX_INSTALL_PATH)/include/c++/v1 |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
102 ifdef TSAN | 96 ifdef TSAN |
103 OBJDIR := $(OBJDIR)+TSan | 97 OBJDIR := $(OBJDIR)+TSan |
104 CXX_EXTRA += -fsanitize=thread | 98 CXX_EXTRA += -fsanitize=thread |
105 LD_EXTRA += -fsanitize=thread | 99 LD_EXTRA += -fsanitize=thread |
106 endif | 100 endif |
107 | 101 |
108 SB_OBJDIR := $(OBJDIR)+Sandboxed | 102 SB_OBJDIR := $(OBJDIR)+Sandboxed |
109 | 103 |
110 $(info -----------------------------------------------) | 104 $(info -----------------------------------------------) |
111 $(info Using LLVM_SRC_PATH = $(LLVM_SRC_PATH)) | 105 $(info Using LLVM_SRC_PATH = $(LLVM_SRC_PATH)) |
112 $(info Using LLVM_BIN_PATH = $(LLVM_BIN_PATH)) | |
113 $(info Using SB_LLVM_PATH = $(SB_LLVM_PATH)) | 106 $(info Using SB_LLVM_PATH = $(SB_LLVM_PATH)) |
114 $(info Using NACL_ROOT = $(NACL_ROOT)) | 107 $(info Using NACL_ROOT = $(NACL_ROOT)) |
115 $(info Using PNACL_TOOLCHAIN_ROOT = $(PNACL_TOOLCHAIN_ROOT)) | 108 $(info Using PNACL_TOOLCHAIN_ROOT = $(PNACL_TOOLCHAIN_ROOT)) |
116 $(info Using PNACL_BIN_PATH = $(PNACL_BIN_PATH)) | 109 $(info Using PNACL_BIN_PATH = $(PNACL_BIN_PATH)) |
117 $(info Using CLANG_PATH = $(CLANG_PATH)) | 110 $(info Using CLANG_PATH = $(CLANG_PATH)) |
118 $(info Using LIBCXX_INSTALL_PATH = $(LIBCXX_INSTALL_PATH)) | 111 $(info Using LIBCXX_INSTALL_PATH = $(LIBCXX_INSTALL_PATH)) |
119 $(info Using HOST_ARCH = $(HOST_ARCH)) | 112 $(info Using HOST_ARCH = $(HOST_ARCH)) |
120 $(info -----------------------------------------------) | 113 $(info -----------------------------------------------) |
121 | 114 |
122 LLVM_CXXFLAGS := `$(LLVM_BIN_PATH)/llvm-config --cxxflags` | 115 LLVM_CXXFLAGS := `$(PNACL_BIN_PATH)/llvm-config --cxxflags` |
123 SB_LLVM_CXXFLAGS := $(LLVM_CXXFLAGS) | 116 SB_LLVM_CXXFLAGS := $(LLVM_CXXFLAGS) |
124 | 117 |
125 # Listing specific libraries that are needed for pnacl-sz | 118 # Listing specific libraries that are needed for pnacl-sz |
126 # and the unittests, since we build "tools-only" for the | 119 # and the unittests, since we build "tools-only" for the |
127 # sandboxed_translators (which doesn't include every library | 120 # sandboxed_translators (which doesn't include every library |
128 # listed by llvm-config). | 121 # listed by llvm-config). |
129 LLVM_LIBS := -lLLVMIRReader -lLLVMBitReader -lLLVMNaClBitTestUtils \ | 122 |
130 » -lLLVMNaClBitReader -lLLVMNaClBitAnalysis -lLLVMNaClBitWriter \ | 123 ifeq ($(AUTOCONF), 0) |
131 » -lLLVMAsmParser -lLLVMNaClAnalysis -lLLVMCore -lLLVMSupport | 124 # LLVM cmake build |
125 LLVM_LIBS := -lLLVMIRReader -lLLVMBitReader -lLLVMNaClBitTestUtils \ | |
126 -lLLVMNaClBitReader -lLLVMNaClBitAnalysis -lLLVMNaClBitWriter \ | |
127 -lLLVMAsmParser -lLLVMNaClAnalysis -lLLVMCore -lLLVMSupport | |
128 GTEST_LIB_PATH ?= | |
jvoung (off chromium)
2015/04/17 22:22:57
Add a comment that gtest libs will be found in the
Jim Stichnoth
2015/04/17 23:06:22
Done.
I think LIBCXX will be in yet a different p
| |
129 CLANG_FORMAT_PATH ?= $(PNACL_BIN_PATH) | |
130 else | |
131 # LLVM autoconf build | |
132 LLVM_LIBS := -lLLVM-3.6svn | |
133 GTEST_LIB_PATH ?= -L../../out/llvm_x86_64_linux_work/Release+Asserts/lib | |
134 CLANG_FORMAT_PATH ?= ../../out/llvm_x86_64_linux_work/Release+Asserts/bin | |
135 endif | |
136 | |
132 LLVM_LDFLAGS := $(LLVM_LIBS) \ | 137 LLVM_LDFLAGS := $(LLVM_LIBS) \ |
133 `$(LLVM_BIN_PATH)/llvm-config --ldflags` \ | 138 `$(PNACL_BIN_PATH)/llvm-config --ldflags` \ |
134 `$(LLVM_BIN_PATH)/llvm-config --system-libs` | 139 `$(PNACL_BIN_PATH)/llvm-config --system-libs` |
135 SB_LLVM_LDFLAGS := $(LLVM_LIBS) \ | 140 SB_LLVM_LDFLAGS := $(LLVM_LIBS) \ |
jvoung (off chromium)
2015/04/17 22:22:57
I think for SB_LLVM_LDFLAGS, we only have the stat
Jim Stichnoth
2015/04/17 23:06:22
Oops, I guess I didn't check the "sb" target under
| |
136 -L$(SB_LLVM_PATH)/lib | 141 -L$(SB_LLVM_PATH)/lib |
137 | 142 |
138 CCACHE := `command -v ccache` | 143 CCACHE := `command -v ccache` |
139 CXX := CCACHE_CPP2=yes $(CCACHE) $(CLANG_PATH)/clang++ | 144 CXX := CCACHE_CPP2=yes $(CCACHE) $(CLANG_PATH)/clang++ |
140 SB_CXX := CCACHE_CPP2=yes $(CCACHE) $(PNACL_BIN_PATH)/pnacl-clang++ | 145 SB_CXX := CCACHE_CPP2=yes $(CCACHE) $(PNACL_BIN_PATH)/pnacl-clang++ |
141 SB_TRANSLATE := $(PNACL_BIN_PATH)/pnacl-translate | 146 SB_TRANSLATE := $(PNACL_BIN_PATH)/pnacl-translate |
142 | 147 |
143 BASE_CXXFLAGS := -std=gnu++11 -Wall -Wextra -Werror -fno-rtti \ | 148 BASE_CXXFLAGS := -std=gnu++11 -Wall -Wextra -Werror -fno-rtti \ |
144 -fno-exceptions $(OPTLEVEL) $(ASSERTIONS) -g -pedantic \ | 149 -fno-exceptions $(OPTLEVEL) $(ASSERTIONS) -g -pedantic \ |
145 -Wno-error=unused-parameter $(CXX_EXTRA) | 150 -Wno-error=unused-parameter $(CXX_EXTRA) |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
232 --allow-llvm-bitcode-input | 237 --allow-llvm-bitcode-input |
233 | 238 |
234 # TODO(stichnot): Be more precise than "*.h" here and elsewhere. | 239 # TODO(stichnot): Be more precise than "*.h" here and elsewhere. |
235 $(OBJS): $(OBJDIR)/%.o: src/%.cpp src/*.h src/*.def | 240 $(OBJS): $(OBJDIR)/%.o: src/%.cpp src/*.h src/*.def |
236 $(CXX) -c $(CXXFLAGS) $< -o $@ | 241 $(CXX) -c $(CXXFLAGS) $< -o $@ |
237 | 242 |
238 $(SB_OBJS): $(SB_OBJDIR)/%.o: src/%.cpp src/*.h src/*.def | 243 $(SB_OBJS): $(SB_OBJDIR)/%.o: src/%.cpp src/*.h src/*.def |
239 $(SB_CXX) -c $(SB_CXXFLAGS) $< -o $@ | 244 $(SB_CXX) -c $(SB_CXXFLAGS) $< -o $@ |
240 | 245 |
241 $(OBJDIR)/run_unittests: $(UNITTEST_OBJS) $(UNITTEST_LIB_OBJS) | 246 $(OBJDIR)/run_unittests: $(UNITTEST_OBJS) $(UNITTEST_LIB_OBJS) |
242 » $(CXX) $(LDFLAGS) -o $@ $^ $(LLVM_LDFLAGS) -lgtest -lgtest_main -ldl \ | 247 » $(CXX) $(LDFLAGS) -o $@ $^ $(LLVM_LDFLAGS) \ |
248 $(GTEST_LIB_PATH) -lgtest -lgtest_main -ldl \ | |
243 -Wl,-rpath=$(abspath $(LIBCXX_INSTALL_PATH)/lib) | 249 -Wl,-rpath=$(abspath $(LIBCXX_INSTALL_PATH)/lib) |
244 | 250 |
245 $(UNITTEST_OBJS): $(OBJDIR)/unittest/%.o: unittest/%.cpp \ | 251 $(UNITTEST_OBJS): $(OBJDIR)/unittest/%.o: unittest/%.cpp \ |
246 unittest/*.h src/*.h src/*.def | 252 unittest/*.h src/*.h src/*.def |
247 $(CXX) -c $(CXXFLAGS) \ | 253 $(CXX) -c $(CXXFLAGS) \ |
248 -Isrc/ \ | 254 -Isrc/ \ |
249 -I$(LLVM_SRC_PATH)/utils/unittest/googletest/include \ | 255 -I$(LLVM_SRC_PATH)/utils/unittest/googletest/include \ |
250 -DGTEST_HAS_RTTI=0 -DGTEST_USE_OWN_TR1_TUPLE \ | 256 -DGTEST_HAS_RTTI=0 -DGTEST_USE_OWN_TR1_TUPLE \ |
251 $< -o $@ | 257 $< -o $@ |
252 | 258 |
(...skipping 17 matching lines...) Expand all Loading... | |
270 | 276 |
271 # Use runtime.is.built so that build-runtime.py is invoked only once | 277 # Use runtime.is.built so that build-runtime.py is invoked only once |
272 # even in a parallel build. | 278 # even in a parallel build. |
273 .INTERMEDIATE: runtime.is.built | 279 .INTERMEDIATE: runtime.is.built |
274 $(RT_OBJ): runtime.is.built | 280 $(RT_OBJ): runtime.is.built |
275 runtime.is.built: $(RT_SRC) | 281 runtime.is.built: $(RT_SRC) |
276 @echo ================ Building Subzero runtime ================ | 282 @echo ================ Building Subzero runtime ================ |
277 ./pydir/build-runtime.py -v --pnacl-root $(PNACL_TOOLCHAIN_ROOT) | 283 ./pydir/build-runtime.py -v --pnacl-root $(PNACL_TOOLCHAIN_ROOT) |
278 | 284 |
279 check-lit: $(OBJDIR)/pnacl-sz make_symlink | 285 check-lit: $(OBJDIR)/pnacl-sz make_symlink |
280 » LLVM_BIN_PATH=$(LLVM_BIN_PATH) \ | 286 » PNACL_BIN_PATH=$(PNACL_BIN_PATH) \ |
281 » BINUTILS_BIN_PATH=$(PNACL_BIN_PATH) \ | |
282 $(LLVM_SRC_PATH)/utils/lit/lit.py -sv tests_lit | 287 $(LLVM_SRC_PATH)/utils/lit/lit.py -sv tests_lit |
283 | 288 |
284 ifdef MINIMAL | 289 ifdef MINIMAL |
285 check-xtest: $(OBJDIR)/pnacl-sz make_symlink runtime | 290 check-xtest: $(OBJDIR)/pnacl-sz make_symlink runtime |
286 @echo "Crosstests disabled, minimal build" | 291 @echo "Crosstests disabled, minimal build" |
287 else | 292 else |
288 check-xtest: $(OBJDIR)/pnacl-sz make_symlink runtime | 293 check-xtest: $(OBJDIR)/pnacl-sz make_symlink runtime |
289 # Do all native/sse2 tests, but only test_vector_ops for native/sse4.1. | 294 # Do all native/sse2 tests, but only test_vector_ops for native/sse4.1. |
290 # For (slow) sandboxed tests, limit to Om1/sse4.1. | 295 # For (slow) sandboxed tests, limit to Om1/sse4.1. |
291 ./pydir/crosstest_generator.py -v --lit \ | 296 ./pydir/crosstest_generator.py -v --lit \ |
292 -i native,sse2 -i native,sse4.1,test_vector_ops \ | 297 -i native,sse2 -i native,sse4.1,test_vector_ops \ |
293 -i sandbox,sse4.1,Om1 | 298 -i sandbox,sse4.1,Om1 |
294 » LLVM_BIN_PATH=$(LLVM_BIN_PATH) \ | 299 » PNACL_BIN_PATH=$(PNACL_BIN_PATH) \ |
295 $(LLVM_SRC_PATH)/utils/lit/lit.py -sv crosstest/Output | 300 $(LLVM_SRC_PATH)/utils/lit/lit.py -sv crosstest/Output |
296 endif | 301 endif |
297 | 302 |
298 check-unit: $(OBJDIR)/run_unittests | 303 check-unit: $(OBJDIR)/run_unittests |
299 $(OBJDIR)/run_unittests | 304 $(OBJDIR)/run_unittests |
300 | 305 |
301 check: check-lit check-unit check-xtest | 306 check: check-lit check-unit check-xtest |
302 | 307 |
303 FORMAT_BLACKLIST = | 308 FORMAT_BLACKLIST = |
304 # Add one of the following lines for each source file to ignore. | 309 # Add one of the following lines for each source file to ignore. |
305 FORMAT_BLACKLIST += ! -name IceParseInstsTest.cpp | 310 FORMAT_BLACKLIST += ! -name IceParseInstsTest.cpp |
306 format: | 311 format: |
307 » $(LLVM_BIN_PATH)/clang-format -style=LLVM -i \ | 312 » $(CLANG_FORMAT_PATH)/clang-format -style=LLVM -i \ |
308 `find . -regex '.*\.\(c\|h\|cpp\)' $(FORMAT_BLACKLIST)` | 313 `find . -regex '.*\.\(c\|h\|cpp\)' $(FORMAT_BLACKLIST)` |
309 | 314 |
310 format-diff: | 315 format-diff: |
311 git diff -U0 `git merge-base HEAD master` | \ | 316 git diff -U0 `git merge-base HEAD master` | \ |
312 » PATH=$(LLVM_BIN_PATH):$(PATH) \ | 317 » PATH=$(PNACL_BIN_PATH):$(PATH) \ |
313 $(LLVM_SRC_PATH)/../clang/tools/clang-format/clang-format-diff.py \ | 318 $(LLVM_SRC_PATH)/../clang/tools/clang-format/clang-format-diff.py \ |
314 -p1 -style=LLVM -i | 319 -p1 -style=LLVM -i |
315 | 320 |
316 bloat: make_symlink | 321 bloat: make_symlink |
317 nm -C -S -l pnacl-sz | \ | 322 nm -C -S -l pnacl-sz | \ |
318 bloat/bloat.py --nm-output=/dev/stdin syms > build/pnacl-sz.bloat.json | 323 bloat/bloat.py --nm-output=/dev/stdin syms > build/pnacl-sz.bloat.json |
319 @echo See Subzero size breakdown in bloat/pnacl-sz.bloat.html | 324 @echo See Subzero size breakdown in bloat/pnacl-sz.bloat.html |
320 | 325 |
321 clean: | 326 clean: |
322 rm -rf pnacl-sz *.o $(OBJDIR) $(SB_OBJDIR) build/pnacl-sz.bloat.json | 327 rm -rf pnacl-sz *.o $(OBJDIR) $(SB_OBJDIR) build/pnacl-sz.bloat.json |
323 | 328 |
324 clean-all: clean | 329 clean-all: clean |
325 rm -rf build/ | 330 rm -rf build/ |
OLD | NEW |