Chromium Code Reviews| 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> LLVM_BIN_PATH=<path> \ |
| 6 # LIBCXX_INSTALL_PATH=<path> CLANG_PATH=<path> \ | 6 # LIBCXX_INSTALL_PATH=<path> CLANG_PATH=<path> \ |
| 7 # BINUTILS_BIN_PATH=<path> ... | 7 # BINUTILS_BIN_PATH=<path> ... |
| 8 # | 8 # |
| 9 | 9 |
| 10 # LLVM_SRC_PATH is the path to the root of the checked out source code. This | 10 # 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/ | 11 # directory should contain the configure script, the include/ and lib/ |
| 12 # directories of LLVM, Clang in tools/clang/, etc. | 12 # directories of LLVM, Clang in tools/clang/, etc. |
| 13 # Alternatively, if you're building vs. a binary download of LLVM, then | 13 # Alternatively, if you're building vs. a binary download of LLVM, then |
| 14 # LLVM_SRC_PATH can point to the main untarred directory. | 14 # LLVM_SRC_PATH can point to the main untarred directory. |
| 15 LLVM_SRC_PATH ?= ../llvm | 15 LLVM_SRC_PATH ?= ../llvm |
| 16 | 16 |
| 17 # LLVM_BIN_PATH is the directory where binaries are placed by the LLVM build | 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, | 18 # process. It should contain the tools like clang, clang-format, llc, |
| 19 # llvm-as, llvm-config, llvm-mc, pnacl-bcdis, and pnacl-freeze. | 19 # llvm-as, llvm-config, llvm-mc, pnacl-bcdis, and pnacl-freeze. |
| 20 # It also contains developer libraries like libLLVMSupport.a. | 20 # It also contains developer libraries like libLLVMSupport.a. |
| 21 # The default reflects a configure + make build. | 21 # The default reflects a configure + make build. |
| 22 LLVM_BIN_PATH ?= $(shell readlink -e \ | 22 LLVM_BIN_PATH ?= $(shell readlink -e \ |
| 23 ../../out/llvm_x86_64_linux_work/Release+Asserts/bin) | 23 ../../out/llvm_x86_64_linux_work/Release+Asserts/bin) |
| 24 | 24 |
| 25 # NACL_ROOT is the root of the native client repository. | |
| 26 NACL_ROOT= $(shell readlink -e ../../../) | |
|
Jim Stichnoth
2015/03/13 04:55:00
Maybe we can do something like this?
python -c "i
jvoung (off chromium)
2015/03/18 15:39:09
Done.
Another similar way would be to outline the
| |
| 27 | |
| 25 # PNACL_TOOLCHAIN_ROOT is the location of the PNaCl toolchain. | 28 # PNACL_TOOLCHAIN_ROOT is the location of the PNaCl toolchain. |
| 26 # This is used as the default root for finding binutils, libcxx, etc. | 29 # This is used as the default root for finding binutils, libcxx, etc. |
| 27 PNACL_TOOLCHAIN_ROOT = $(shell readlink -e \ | 30 PNACL_TOOLCHAIN_ROOT = $(shell readlink -e \ |
| 28 » ../../../toolchain/linux_x86/pnacl_newlib) | 31 » $(NACL_ROOT)/toolchain/linux_x86/pnacl_newlib) |
| 29 | 32 |
| 30 # CLANG_PATH is the location of the clang compiler to use for building | 33 # CLANG_PATH is the location of the clang compiler to use for building |
| 31 # the host binaries. | 34 # the host binaries. |
| 32 CLANG_PATH ?= $(shell readlink -e \ | 35 CLANG_PATH ?= $(shell readlink -e \ |
| 33 » ../../../../third_party/llvm-build/Release+Asserts/bin) | 36 » $(NACL_ROOT)/../third_party/llvm-build/Release+Asserts/bin) |
| 34 | 37 |
| 35 # LIBCXX_INSTALL_PATH is the directory where libc++ is located. It should | 38 # LIBCXX_INSTALL_PATH is the directory where libc++ is located. It should |
| 36 # contain header files and corresponding libraries. This is used for | 39 # contain header files and corresponding libraries. This is used for |
| 37 # building the host binaries in conjuction with clang. | 40 # building the host binaries in conjuction with clang. |
| 38 LIBCXX_INSTALL_PATH ?= $(PNACL_TOOLCHAIN_ROOT) | 41 LIBCXX_INSTALL_PATH ?= $(PNACL_TOOLCHAIN_ROOT) |
| 39 | 42 |
| 40 # The location of binutils tools (e.g., objdump) for testing. | 43 # The location of binutils tools (e.g., objdump) for testing. |
| 41 BINUTILS_BIN_PATH ?= $(shell readlink -e $(PNACL_TOOLCHAIN_ROOT)/bin) | 44 BINUTILS_BIN_PATH ?= $(shell readlink -e $(PNACL_TOOLCHAIN_ROOT)/bin) |
| 42 | 45 |
| 43 HOST_ARCH ?= x86_64 | 46 HOST_ARCH ?= x86_64 |
| (...skipping 16 matching lines...) Expand all Loading... | |
| 60 # The list of CXX defines that are dependent on build parameters. | 63 # The list of CXX defines that are dependent on build parameters. |
| 61 CXX_DEFINES = | 64 CXX_DEFINES = |
| 62 CXX_EXTRA = | 65 CXX_EXTRA = |
| 63 LD_EXTRA = | 66 LD_EXTRA = |
| 64 | 67 |
| 65 ifdef MINIMAL | 68 ifdef MINIMAL |
| 66 NOASSERT = 1 | 69 NOASSERT = 1 |
| 67 OBJDIR := $(OBJDIR)+Min | 70 OBJDIR := $(OBJDIR)+Min |
| 68 CXX_DEFINES += -DALLOW_DUMP=0 -DALLOW_LLVM_CL=0 -DALLOW_LLVM_IR=0 \ | 71 CXX_DEFINES += -DALLOW_DUMP=0 -DALLOW_LLVM_CL=0 -DALLOW_LLVM_IR=0 \ |
| 69 -DALLOW_LLVM_IR_AS_INPUT=0 -DALLOW_DISABLE_IR_GEN=0 \ | 72 -DALLOW_LLVM_IR_AS_INPUT=0 -DALLOW_DISABLE_IR_GEN=0 \ |
| 70 -DALLOW_MINIMAL_BUILD=1 | 73 -DALLOW_MINIMAL_BUILD=1 -DPNACL_BROWSER_TRANSLATOR=0 |
| 71 else | 74 else |
| 72 CXX_DEFINES += -DALLOW_DUMP=1 -DALLOW_LLVM_CL=1 -DALLOW_LLVM_IR=1 \ | 75 CXX_DEFINES += -DALLOW_DUMP=1 -DALLOW_LLVM_CL=1 -DALLOW_LLVM_IR=1 \ |
| 73 -DALLOW_LLVM_IR_AS_INPUT=1 -DALLOW_DISABLE_IR_GEN=1 \ | 76 -DALLOW_LLVM_IR_AS_INPUT=1 -DALLOW_DISABLE_IR_GEN=1 \ |
| 74 -DALLOW_MINIMAL_BUILD=0 | 77 -DALLOW_MINIMAL_BUILD=0 -DPNACL_BROWSER_TRANSLATOR=0 |
| 75 endif | 78 endif |
| 76 | 79 |
| 77 ifdef NOASSERT | 80 ifdef NOASSERT |
| 78 ASSERTIONS = -DNDEBUG | 81 ASSERTIONS = -DNDEBUG |
| 79 else | 82 else |
| 80 ASSERTIONS = | 83 ASSERTIONS = |
| 81 OBJDIR := $(OBJDIR)+Asserts | 84 OBJDIR := $(OBJDIR)+Asserts |
| 82 endif | 85 endif |
| 83 | 86 |
| 84 ifdef TSAN | 87 ifdef TSAN |
| 85 OBJDIR := $(OBJDIR)+TSan | 88 OBJDIR := $(OBJDIR)+TSan |
| 86 CXX_EXTRA += -fsanitize=thread | 89 CXX_EXTRA += -fsanitize=thread |
| 87 LD_EXTRA += -fsanitize=thread | 90 LD_EXTRA += -fsanitize=thread |
| 88 endif | 91 endif |
| 89 | 92 |
| 90 $(info -----------------------------------------------) | 93 $(info -----------------------------------------------) |
| 91 $(info Using LLVM_SRC_PATH = $(LLVM_SRC_PATH)) | 94 $(info Using LLVM_SRC_PATH = $(LLVM_SRC_PATH)) |
| 92 $(info Using LLVM_BIN_PATH = $(LLVM_BIN_PATH)) | 95 $(info Using LLVM_BIN_PATH = $(LLVM_BIN_PATH)) |
| 96 $(info Using NACL_ROOT = $(NACL_ROOT)) | |
| 93 $(info Using PNACL_TOOLCHAIN_ROOT = $(PNACL_TOOLCHAIN_ROOT)) | 97 $(info Using PNACL_TOOLCHAIN_ROOT = $(PNACL_TOOLCHAIN_ROOT)) |
| 94 $(info Using CLANG_PATH = $(CLANG_PATH)) | 98 $(info Using CLANG_PATH = $(CLANG_PATH)) |
| 95 $(info Using LIBCXX_INSTALL_PATH = $(LIBCXX_INSTALL_PATH)) | 99 $(info Using LIBCXX_INSTALL_PATH = $(LIBCXX_INSTALL_PATH)) |
| 96 $(info Using BINUTILS_BIN_PATH = $(BINUTILS_BIN_PATH)) | 100 $(info Using BINUTILS_BIN_PATH = $(BINUTILS_BIN_PATH)) |
| 97 $(info Using HOST_ARCH = $(HOST_ARCH)) | 101 $(info Using HOST_ARCH = $(HOST_ARCH)) |
| 98 $(info -----------------------------------------------) | 102 $(info -----------------------------------------------) |
| 99 | 103 |
| 100 LLVM_CXXFLAGS := `$(LLVM_BIN_PATH)/llvm-config --cxxflags` | 104 LLVM_CXXFLAGS := `$(LLVM_BIN_PATH)/llvm-config --cxxflags` |
| 101 LLVM_LDFLAGS := `$(LLVM_BIN_PATH)/llvm-config --libs` \ | 105 LLVM_LDFLAGS := `$(LLVM_BIN_PATH)/llvm-config --libs` \ |
| 102 `$(LLVM_BIN_PATH)/llvm-config --ldflags` \ | 106 `$(LLVM_BIN_PATH)/llvm-config --ldflags` \ |
| 103 `$(LLVM_BIN_PATH)/llvm-config --system-libs` | 107 `$(LLVM_BIN_PATH)/llvm-config --system-libs` |
| 104 | 108 |
| 109 # TODO(jvoung): Make a standalone build target w/ DPNACL_BROWSER_TRANSLATOR=1 | |
| 110 # with CXX=pnacl-clang++, and the right flags. | |
| 111 | |
| 105 # It's recommended that CXX matches the compiler you used to build LLVM itself. | 112 # It's recommended that CXX matches the compiler you used to build LLVM itself. |
| 106 CCACHE := `command -v ccache` | 113 CCACHE := `command -v ccache` |
| 107 CXX := CCACHE_CPP2=yes $(CCACHE) $(CLANG_PATH)/clang++ | 114 CXX := CCACHE_CPP2=yes $(CCACHE) $(CLANG_PATH)/clang++ |
| 108 | 115 |
| 109 CXXFLAGS := $(LLVM_CXXFLAGS) -std=gnu++11 -Wall -Wextra -Werror -fno-rtti \ | 116 CXXFLAGS := $(LLVM_CXXFLAGS) -std=gnu++11 -Wall -Wextra -Werror -fno-rtti \ |
| 110 -fno-exceptions $(OPTLEVEL) $(ASSERTIONS) $(CXX_DEFINES) -g \ | 117 -fno-exceptions $(OPTLEVEL) $(ASSERTIONS) $(CXX_DEFINES) -g \ |
| 111 $(HOST_FLAGS) -pedantic -Wno-error=unused-parameter \ | 118 $(HOST_FLAGS) -pedantic -Wno-error=unused-parameter \ |
| 112 -I$(LIBCXX_INSTALL_PATH)/include/c++/v1 $(CXX_EXTRA) | 119 -I$(LIBCXX_INSTALL_PATH)/include/c++/v1 $(CXX_EXTRA) |
| 113 LDFLAGS := $(HOST_FLAGS) -L$(LIBCXX_INSTALL_PATH)/lib -Wl,--gc-sections \ | 120 LDFLAGS := $(HOST_FLAGS) -L$(LIBCXX_INSTALL_PATH)/lib -Wl,--gc-sections \ |
| 114 $(LD_EXTRA) | 121 $(LD_EXTRA) |
| 115 | 122 |
| 116 SRCS = \ | 123 SRCS = \ |
| 117 assembler.cpp \ | 124 assembler.cpp \ |
| 118 assembler_ia32.cpp \ | 125 assembler_ia32.cpp \ |
| 126 IceBrowserCompileServer.cpp \ | |
| 119 IceCfg.cpp \ | 127 IceCfg.cpp \ |
| 120 IceCfgNode.cpp \ | 128 IceCfgNode.cpp \ |
| 129 IceCompiler.cpp \ | |
| 130 IceCompileServer.cpp \ | |
| 121 IceELFObjectWriter.cpp \ | 131 IceELFObjectWriter.cpp \ |
| 122 IceELFSection.cpp \ | 132 IceELFSection.cpp \ |
| 123 IceFixups.cpp \ | 133 IceFixups.cpp \ |
| 124 IceGlobalContext.cpp \ | 134 IceGlobalContext.cpp \ |
| 125 IceGlobalInits.cpp \ | 135 IceGlobalInits.cpp \ |
| 126 IceInst.cpp \ | 136 IceInst.cpp \ |
| 127 IceInstX8632.cpp \ | 137 IceInstX8632.cpp \ |
| 128 IceIntrinsics.cpp \ | 138 IceIntrinsics.cpp \ |
| 129 IceLiveness.cpp \ | 139 IceLiveness.cpp \ |
| 130 IceOperand.cpp \ | 140 IceOperand.cpp \ |
| (...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 249 bloat: make_symlink | 259 bloat: make_symlink |
| 250 nm -C -S -l pnacl-sz | \ | 260 nm -C -S -l pnacl-sz | \ |
| 251 bloat/bloat.py --nm-output=/dev/stdin syms > build/pnacl-sz.bloat.json | 261 bloat/bloat.py --nm-output=/dev/stdin syms > build/pnacl-sz.bloat.json |
| 252 @echo See Subzero size breakdown in bloat/pnacl-sz.bloat.html | 262 @echo See Subzero size breakdown in bloat/pnacl-sz.bloat.html |
| 253 | 263 |
| 254 clean: | 264 clean: |
| 255 rm -rf pnacl-sz *.o $(OBJDIR) build/pnacl-sz.bloat.json | 265 rm -rf pnacl-sz *.o $(OBJDIR) build/pnacl-sz.bloat.json |
| 256 | 266 |
| 257 clean-all: clean | 267 clean-all: clean |
| 258 rm -rf build/ | 268 rm -rf build/ |
| OLD | NEW |