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> LIBCXX_INSTALL_PATH=<path> CLANG_PATH=<path> \ | 5 # make LLVM_SRC_PATH=<path> LIBCXX_INSTALL_PATH=<path> CLANG_PATH=<path> \ |
6 # PNACL_BIN_PATH=<path> ... | 6 # PNACL_BIN_PATH=<path> ... |
7 # | 7 # |
8 | 8 |
9 # 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 |
10 # directory should contain the configure script, the include/ and lib/ | 10 # directory should contain the configure script, the include/ and lib/ |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
97 endif | 97 endif |
98 | 98 |
99 ifdef TSAN | 99 ifdef TSAN |
100 OBJDIR := $(OBJDIR)+TSan | 100 OBJDIR := $(OBJDIR)+TSan |
101 CXX_EXTRA += -fsanitize=thread | 101 CXX_EXTRA += -fsanitize=thread |
102 LD_EXTRA += -fsanitize=thread | 102 LD_EXTRA += -fsanitize=thread |
103 endif | 103 endif |
104 | 104 |
105 SB_OBJDIR := $(OBJDIR)+Sandboxed | 105 SB_OBJDIR := $(OBJDIR)+Sandboxed |
106 | 106 |
107 ifdef TEXTUAL_BITCODE | |
108 TEXTBC_DEFS = -DINPUT_IS_TEXTUAL_BITCODE | |
Jim Stichnoth
2015/06/21 07:09:34
Do this like ALLOW_DUMP, i.e.
-DINPUT_IS_TEXTUAL
Karl
2015/06/22 19:52:01
Done.
| |
109 OBJDIR := $(OBJDIR)+Tbc | |
110 TEXTBC_LIBS = -LLVMNaClBitTestUtils | |
111 else | |
112 TEXTBC_DEFS = | |
Jim Stichnoth
2015/06/21 07:09:34
and
-DINPUT_IS_TEXTUAL_BITCODE=0
Then in the co
Karl
2015/06/22 19:52:01
Done.
| |
113 TEXTBC_LIBS = | |
114 endif | |
115 | |
116 | |
107 $(info -----------------------------------------------) | 117 $(info -----------------------------------------------) |
108 $(info Using LLVM_SRC_PATH = $(LLVM_SRC_PATH)) | 118 $(info Using LLVM_SRC_PATH = $(LLVM_SRC_PATH)) |
109 $(info Using SB_LLVM_PATH = $(SB_LLVM_PATH)) | 119 $(info Using SB_LLVM_PATH = $(SB_LLVM_PATH)) |
110 $(info Using NACL_ROOT = $(NACL_ROOT)) | 120 $(info Using NACL_ROOT = $(NACL_ROOT)) |
111 $(info Using TOOLCHAIN_ROOT = $(TOOLCHAIN_ROOT)) | 121 $(info Using TOOLCHAIN_ROOT = $(TOOLCHAIN_ROOT)) |
112 $(info Using PNACL_TOOLCHAIN_ROOT = $(PNACL_TOOLCHAIN_ROOT)) | 122 $(info Using PNACL_TOOLCHAIN_ROOT = $(PNACL_TOOLCHAIN_ROOT)) |
113 $(info Using PNACL_BIN_PATH = $(PNACL_BIN_PATH)) | 123 $(info Using PNACL_BIN_PATH = $(PNACL_BIN_PATH)) |
114 $(info Using CLANG_PATH = $(CLANG_PATH)) | 124 $(info Using CLANG_PATH = $(CLANG_PATH)) |
115 $(info Using LIBCXX_INSTALL_PATH = $(LIBCXX_INSTALL_PATH)) | 125 $(info Using LIBCXX_INSTALL_PATH = $(LIBCXX_INSTALL_PATH)) |
116 $(info Using HOST_ARCH = $(HOST_ARCH)) | 126 $(info Using HOST_ARCH = $(HOST_ARCH)) |
117 $(info -----------------------------------------------) | 127 $(info -----------------------------------------------) |
118 | 128 |
119 LLVM_CXXFLAGS := `$(PNACL_BIN_PATH)/llvm-config --cxxflags` | 129 LLVM_CXXFLAGS := `$(PNACL_BIN_PATH)/llvm-config --cxxflags` |
120 SB_LLVM_CXXFLAGS := $(LLVM_CXXFLAGS) | 130 SB_LLVM_CXXFLAGS := $(LLVM_CXXFLAGS) |
121 | 131 |
122 # Listing specific libraries that are needed for pnacl-sz | 132 # Listing specific libraries that are needed for pnacl-sz |
123 # and the unittests, since we build "tools-only" for the | 133 # and the unittests, since we build "tools-only" for the |
124 # sandboxed_translators (which doesn't include every library | 134 # sandboxed_translators (which doesn't include every library |
125 # listed by llvm-config). | 135 # listed by llvm-config). |
126 | 136 |
127 LLVM_LIBS_LIST := -lLLVMIRReader -lLLVMBitReader -lLLVMNaClBitTestUtils \ | 137 LLVM_LIBS_LIST := -lLLVMIRReader -lLLVMBitReader -lLLVMNaClBitTestUtils \ |
128 -lLLVMNaClBitReader -lLLVMNaClBitAnalysis -lLLVMNaClBitWriter \ | 138 -lLLVMNaClBitReader -lLLVMNaClBitAnalysis -lLLVMNaClBitWriter \ |
129 -lLLVMAsmParser -lLLVMNaClAnalysis -lLLVMCore -lLLVMSupport | 139 -lLLVMAsmParser -lLLVMNaClAnalysis -lLLVMCore -lLLVMSupport |
130 | 140 |
131 ifeq ($(AUTOCONF), 0) | 141 ifeq ($(AUTOCONF), 0) |
132 # LLVM cmake build | 142 # LLVM cmake build |
133 LLVM_LIBS := $(LLVM_LIBS_LIST) | 143 LLVM_LIBS := $(LLVM_LIBS_LIST) $(TEXTBC_LIBS) |
134 # For the cmake build, the gtest libs end up in the same place as the LLVM | 144 # For the cmake build, the gtest libs end up in the same place as the LLVM |
135 # libs, so no "-L..." arg is needed. | 145 # libs, so no "-L..." arg is needed. |
136 GTEST_LIB_PATH ?= | 146 GTEST_LIB_PATH ?= |
137 CLANG_FORMAT_PATH ?= $(PNACL_BIN_PATH) | 147 CLANG_FORMAT_PATH ?= $(PNACL_BIN_PATH) |
138 else | 148 else |
139 # LLVM autoconf build | 149 # LLVM autoconf build |
140 LLVM_LIBS := -lLLVM-3.7svn | 150 LLVM_LIBS := -lLLVM-3.7svn |
141 GTEST_LIB_PATH ?= -L../../out/llvm_x86_64_linux_work/Release+Asserts/lib | 151 GTEST_LIB_PATH ?= -L../../out/llvm_x86_64_linux_work/Release+Asserts/lib |
142 CLANG_FORMAT_PATH ?= ../../out/llvm_x86_64_linux_work/Release+Asserts/bin | 152 CLANG_FORMAT_PATH ?= ../../out/llvm_x86_64_linux_work/Release+Asserts/bin |
143 endif | 153 endif |
144 | 154 |
145 LLVM_LDFLAGS := $(LLVM_LIBS) \ | 155 LLVM_LDFLAGS := $(LLVM_LIBS) \ |
146 `$(PNACL_BIN_PATH)/llvm-config --ldflags` \ | 156 `$(PNACL_BIN_PATH)/llvm-config --ldflags` \ |
147 `$(PNACL_BIN_PATH)/llvm-config --system-libs` | 157 `$(PNACL_BIN_PATH)/llvm-config --system-libs` |
148 SB_LLVM_LDFLAGS := $(LLVM_LIBS_LIST) \ | 158 SB_LLVM_LDFLAGS := $(LLVM_LIBS_LIST) \ |
149 -L$(SB_LLVM_PATH)/lib | 159 -L$(SB_LLVM_PATH)/lib |
150 | 160 |
151 CCACHE := `command -v ccache` | 161 CCACHE := `command -v ccache` |
152 CXX := CCACHE_CPP2=yes $(CCACHE) $(CLANG_PATH)/clang++ | 162 CXX := CCACHE_CPP2=yes $(CCACHE) $(CLANG_PATH)/clang++ |
153 SB_CXX := CCACHE_CPP2=yes $(CCACHE) $(PNACL_BIN_PATH)/pnacl-clang++ | 163 SB_CXX := CCACHE_CPP2=yes $(CCACHE) $(PNACL_BIN_PATH)/pnacl-clang++ |
154 SB_TRANSLATE := $(PNACL_BIN_PATH)/pnacl-translate | 164 SB_TRANSLATE := $(PNACL_BIN_PATH)/pnacl-translate |
155 | 165 |
156 BASE_CXXFLAGS := -std=gnu++11 -Wall -Wextra -Werror -fno-rtti \ | 166 BASE_CXXFLAGS := -std=gnu++11 -Wall -Wextra -Werror -fno-rtti \ |
157 -fno-exceptions $(OPTLEVEL) $(ASSERTIONS) -g -pedantic \ | 167 -fno-exceptions $(OPTLEVEL) $(ASSERTIONS) -g -pedantic \ |
158 -Wno-error=unused-parameter $(CXX_EXTRA) | 168 -Wno-error=unused-parameter $(CXX_EXTRA) |
159 | 169 |
160 CXXFLAGS := $(LLVM_CXXFLAGS) $(BASE_CXXFLAGS) $(CXX_DEFINES) $(HOST_FLAGS) \ | 170 CXXFLAGS := $(LLVM_CXXFLAGS) $(BASE_CXXFLAGS) $(CXX_DEFINES) $(HOST_FLAGS) \ |
161 » $(STDLIB_FLAGS) | 171 » $(STDLIB_FLAGS) $(TEXTBC_DEFS) |
162 SB_CXXFLAGS := $(SB_LLVM_CXXFLAGS) $(BASE_CXXFLAGS) $(SB_CXX_DEFINES) | 172 SB_CXXFLAGS := $(SB_LLVM_CXXFLAGS) $(BASE_CXXFLAGS) $(SB_CXX_DEFINES) |
163 | 173 |
164 LDFLAGS := $(HOST_FLAGS) -L$(LIBCXX_INSTALL_PATH)/lib -Wl,--gc-sections \ | 174 LDFLAGS := $(HOST_FLAGS) -L$(LIBCXX_INSTALL_PATH)/lib -Wl,--gc-sections \ |
165 $(LD_EXTRA) $(STDLIB_FLAGS) | 175 $(LD_EXTRA) $(STDLIB_FLAGS) |
166 # Not specifying -Wl,--gc-sections but instead doing bitcode linking GC w/ LTO. | 176 # Not specifying -Wl,--gc-sections but instead doing bitcode linking GC w/ LTO. |
167 SB_LDFLAGS := $(LINKOPTLEVEL) $(LD_EXTRA) | 177 SB_LDFLAGS := $(LINKOPTLEVEL) $(LD_EXTRA) |
168 | 178 |
169 SRCS = \ | 179 SRCS = \ |
170 IceAssembler.cpp \ | 180 IceAssembler.cpp \ |
171 IceAssemblerX8632.cpp \ | 181 IceAssemblerX8632.cpp \ |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
218 # Keep all the first target so it's the default. | 228 # Keep all the first target so it's the default. |
219 all: $(OBJDIR)/pnacl-sz make_symlink runtime | 229 all: $(OBJDIR)/pnacl-sz make_symlink runtime |
220 | 230 |
221 ifdef TSAN | 231 ifdef TSAN |
222 sb: | 232 sb: |
223 @echo "Skipping pnacl-sz.*.nexe: TSAN isn't supported under NaCl." | 233 @echo "Skipping pnacl-sz.*.nexe: TSAN isn't supported under NaCl." |
224 else | 234 else |
225 sb: $(SB_OBJDIR)/pnacl-sz.x86-32.nexe | 235 sb: $(SB_OBJDIR)/pnacl-sz.x86-32.nexe |
226 endif | 236 endif |
227 | 237 |
238 # SHOW_BUILD_ATTS is an executable that is run to show what build | |
239 # attributes were used to the build pnacl-sz. | |
240 ifdef TEXTUAL_BITCODE | |
241 SHOW_BUILD_ATTS = echo "Can't show build attributes when TEXTUAL_BITCODE=1" | |
242 else | |
243 SHOW_BUILD_ATTS = $(OBJDIR)/pnacl-sz --build-atts | |
244 endif | |
245 | |
228 # Creates symbolic link so that testing is easier. Also runs | 246 # Creates symbolic link so that testing is easier. Also runs |
229 # pnacl-sz to verify that the defines flags have valid values, | 247 # pnacl-sz to verify that the defines flags have valid values, |
230 # as well as describe the corresponding build attributes. | 248 # as well as describe the corresponding build attributes. |
231 make_symlink: $(OBJDIR)/pnacl-sz | 249 make_symlink: $(OBJDIR)/pnacl-sz |
232 rm -rf pnacl-sz | 250 rm -rf pnacl-sz |
233 ln -s $(OBJDIR)/pnacl-sz | 251 ln -s $(OBJDIR)/pnacl-sz |
234 @echo "Build Attributes:" | 252 @echo "Build Attributes:" |
235 » @$(OBJDIR)/pnacl-sz --build-atts | 253 » @$(SHOW_BUILD_ATTS) |
236 | 254 |
237 .PHONY: all make_symlink runtime bloat sb | 255 .PHONY: all make_symlink runtime bloat sb |
238 | 256 |
239 $(OBJDIR)/pnacl-sz: $(OBJS) | 257 $(OBJDIR)/pnacl-sz: $(OBJS) |
240 $(CXX) $(LDFLAGS) -o $@ $^ $(LLVM_LDFLAGS) \ | 258 $(CXX) $(LDFLAGS) -o $@ $^ $(LLVM_LDFLAGS) \ |
241 -Wl,-rpath=$(abspath $(LIBCXX_INSTALL_PATH)/lib) | 259 -Wl,-rpath=$(abspath $(LIBCXX_INSTALL_PATH)/lib) |
242 | 260 |
243 $(SB_OBJDIR)/pnacl-sz.x86-32.nexe: $(SB_OBJS) | 261 $(SB_OBJDIR)/pnacl-sz.x86-32.nexe: $(SB_OBJS) |
244 $(eval PNACL_SZ_BASE := $(patsubst %.nexe, %, $@)) | 262 $(eval PNACL_SZ_BASE := $(patsubst %.nexe, %, $@)) |
245 $(SB_CXX) $(SB_LDFLAGS) -o $(PNACL_SZ_BASE).nonfinal.pexe $^ \ | 263 $(SB_CXX) $(SB_LDFLAGS) -o $(PNACL_SZ_BASE).nonfinal.pexe $^ \ |
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
336 bloat: make_symlink | 354 bloat: make_symlink |
337 nm -C -S -l pnacl-sz | \ | 355 nm -C -S -l pnacl-sz | \ |
338 bloat/bloat.py --nm-output=/dev/stdin syms > build/pnacl-sz.bloat.json | 356 bloat/bloat.py --nm-output=/dev/stdin syms > build/pnacl-sz.bloat.json |
339 @echo See Subzero size breakdown in bloat/pnacl-sz.bloat.html | 357 @echo See Subzero size breakdown in bloat/pnacl-sz.bloat.html |
340 | 358 |
341 clean: | 359 clean: |
342 rm -rf pnacl-sz *.o $(OBJDIR) $(SB_OBJDIR) build/pnacl-sz.bloat.json | 360 rm -rf pnacl-sz *.o $(OBJDIR) $(SB_OBJDIR) build/pnacl-sz.bloat.json |
343 | 361 |
344 clean-all: clean | 362 clean-all: clean |
345 rm -rf build/ | 363 rm -rf build/ |
OLD | NEW |