Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(914)

Side by Side Diff: Makefile.standalone

Issue 1738633002: Subzero: Provide "make sb" target for sandboxed pnacl-sz. (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Patch Set: Add a couple of builds to "make presubmit" Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
85 ifdef MINIMAL 85 ifdef MINIMAL
86 NOASSERT = 1 86 NOASSERT = 1
87 OBJDIR := $(OBJDIR)+Min 87 OBJDIR := $(OBJDIR)+Min
88 BASE_CXX_DEFINES += -DALLOW_DUMP=0 -DALLOW_LLVM_CL=0 -DALLOW_LLVM_IR=0 \ 88 BASE_CXX_DEFINES += -DALLOW_DUMP=0 -DALLOW_LLVM_CL=0 -DALLOW_LLVM_IR=0 \
89 -DALLOW_LLVM_IR_AS_INPUT=0 -DALLOW_MINIMAL_BUILD=1 89 -DALLOW_LLVM_IR_AS_INPUT=0 -DALLOW_MINIMAL_BUILD=1
90 else 90 else
91 BASE_CXX_DEFINES += -DALLOW_DUMP=1 -DALLOW_LLVM_CL=1 -DALLOW_LLVM_IR=1 \ 91 BASE_CXX_DEFINES += -DALLOW_DUMP=1 -DALLOW_LLVM_CL=1 -DALLOW_LLVM_IR=1 \
92 -DALLOW_LLVM_IR_AS_INPUT=1 -DALLOW_MINIMAL_BUILD=0 92 -DALLOW_LLVM_IR_AS_INPUT=1 -DALLOW_MINIMAL_BUILD=0
93 endif 93 endif
94 94
95 SB_CXX_DEFINES := $(BASE_CXX_DEFINES) -DPNACL_BROWSER_TRANSLATOR=1 95 # TODO(stichnot): Also work up a -DPNACL_BROWSER_TRANSLATOR=1 version of a
96 # sandboxed translator.
97 SB_CXX_DEFINES := $(BASE_CXX_DEFINES) -DPNACL_BROWSER_TRANSLATOR=0
96 CXX_DEFINES := $(BASE_CXX_DEFINES) -DPNACL_BROWSER_TRANSLATOR=0 98 CXX_DEFINES := $(BASE_CXX_DEFINES) -DPNACL_BROWSER_TRANSLATOR=0
97 99
98 ifdef NOASSERT 100 ifdef NOASSERT
99 ASSERTIONS = -DNDEBUG 101 ASSERTIONS = -DNDEBUG
100 else 102 else
101 ASSERTIONS = 103 ASSERTIONS =
102 OBJDIR := $(OBJDIR)+Asserts 104 OBJDIR := $(OBJDIR)+Asserts
103 endif 105 endif
104 106
105 ifdef UBSAN 107 ifdef UBSAN
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
189 else 191 else
190 # LLVM autoconf build 192 # LLVM autoconf build
191 LLVM_LIBS := -lLLVM-3.7svn 193 LLVM_LIBS := -lLLVM-3.7svn
192 GTEST_LIB_PATH ?= -L../../out/llvm_x86_64_linux_work/Release+Asserts/lib 194 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 195 CLANG_FORMAT_PATH ?= ../../out/llvm_x86_64_linux_work/Release+Asserts/bin
194 endif 196 endif
195 197
196 LLVM_LDFLAGS := $(LLVM_LIBS) \ 198 LLVM_LDFLAGS := $(LLVM_LIBS) \
197 `$(PNACL_BIN_PATH)/llvm-config --ldflags` \ 199 `$(PNACL_BIN_PATH)/llvm-config --ldflags` \
198 `$(PNACL_BIN_PATH)/llvm-config --system-libs` 200 `$(PNACL_BIN_PATH)/llvm-config --system-libs`
199 SB_LLVM_LDFLAGS := $(LLVM_LIBS_LIST) \ 201 SB_LLVM_LDFLAGS := -Wl,--start-group $(LLVM_LIBS_LIST) -Wl,--end-group \
200 -L$(SB_LLVM_PATH)/lib 202 -L$(SB_LLVM_PATH)/lib
201 203
202 CCACHE := `command -v ccache` 204 CCACHE := `command -v ccache`
203 CXX := CCACHE_CPP2=yes $(CCACHE) $(CLANG_PATH)/clang++ 205 CXX := CCACHE_CPP2=yes $(CCACHE) $(CLANG_PATH)/clang++
204 SB_CXX := CCACHE_CPP2=yes $(CCACHE) $(PNACL_BIN_PATH)/pnacl-clang++ 206 SB_CXX := CCACHE_CPP2=yes $(CCACHE) $(PNACL_BIN_PATH)/pnacl-clang++
205 SB_TRANSLATE := $(PNACL_BIN_PATH)/pnacl-translate 207 SB_TRANSLATE := $(PNACL_BIN_PATH)/pnacl-translate
208 SB_FINALIZE := $(PNACL_BIN_PATH)/pnacl-finalize --no-strip-syms
206 209
207 # Extra warnings that LLVM's build system adds in addition to -Wall. 210 # Extra warnings that LLVM's build system adds in addition to -Wall.
208 LLVM_EXTRA_WARNINGS := -Wcovered-switch-default 211 LLVM_EXTRA_WARNINGS := -Wcovered-switch-default
209 212
210 # Use g++ to compile, to check for errors/warnings that clang++ might have 213 # Use g++ to compile, to check for errors/warnings that clang++ might have
211 # missed. It's unlikely to link, unless LLVM was also built with g++, so the 214 # missed. It's unlikely to link, unless LLVM was also built with g++, so the
212 # compile_only target should be used. Note: This ifdef section is deliberately 215 # compile_only target should be used. Note: This ifdef section is deliberately
213 # placed here instead of with the other ifdef sections, so that its redefinition 216 # placed here instead of with the other ifdef sections, so that its redefinition
214 # of CXX/STDLIB_FLAGS/LLVM_EXTRA_WARNINGS follows their normal definitions. 217 # of CXX/STDLIB_FLAGS/LLVM_EXTRA_WARNINGS follows their normal definitions.
215 ifdef GPLUSPLUS 218 ifdef GPLUSPLUS
216 CXX := CCACHE_CPP2=yes $(CCACHE) g++ 219 CXX := CCACHE_CPP2=yes $(CCACHE) g++
217 STDLIB_FLAGS := 220 STDLIB_FLAGS :=
218 LLVM_EXTRA_WARNINGS := \ 221 LLVM_EXTRA_WARNINGS := \
219 -Wcast-qual \ 222 -Wcast-qual \
220 -Wno-comment \ 223 -Wno-comment \
221 -Wno-long-long \ 224 -Wno-long-long \
222 -Wno-maybe-uninitialized \ 225 -Wno-maybe-uninitialized \
223 -Wno-missing-field-initializers \ 226 -Wno-missing-field-initializers \
224 -Wno-unused-parameter \ 227 -Wno-unused-parameter \
225 -Wwrite-strings 228 -Wwrite-strings
226 OBJDIR := $(OBJDIR)+Gplusplus 229 OBJDIR := $(OBJDIR)+Gplusplus
227 endif 230 endif
228 231
229 BASE_CXXFLAGS := -std=gnu++11 -Wall -Wextra -Werror -fno-rtti \ 232 BASE_CXXFLAGS := -std=gnu++11 -Wall -Wextra -Werror -fno-rtti \
230 -fno-exceptions $(OPTLEVEL) $(ASSERTIONS) -g -pedantic \ 233 -fno-exceptions $(OPTLEVEL) $(ASSERTIONS) -g -pedantic \
231 $(LLVM_EXTRA_WARNINGS) $(CXX_EXTRA) 234 $(LLVM_EXTRA_WARNINGS) $(CXX_EXTRA)
232 235
233 CXXFLAGS := $(LLVM_CXXFLAGS) $(BASE_CXXFLAGS) $(CXX_DEFINES) $(HOST_FLAGS) \ 236 CXXFLAGS := $(LLVM_CXXFLAGS) $(BASE_CXXFLAGS) $(CXX_DEFINES) $(HOST_FLAGS) \
234 $(STDLIB_FLAGS) 237 $(STDLIB_FLAGS)
235 SB_CXXFLAGS := $(SB_LLVM_CXXFLAGS) $(BASE_CXXFLAGS) $(SB_CXX_DEFINES) 238 SB_CXXFLAGS := $(SB_LLVM_CXXFLAGS) $(BASE_CXXFLAGS) $(SB_CXX_DEFINES) \
239 -Wno-unknown-pragmas -I$(NACL_ROOT)
236 240
237 LDFLAGS := $(HOST_FLAGS) -L$(LIBCXX_INSTALL_PATH)/lib -Wl,--gc-sections \ 241 LDFLAGS := $(HOST_FLAGS) -L$(LIBCXX_INSTALL_PATH)/lib -Wl,--gc-sections \
238 $(LD_EXTRA) $(STDLIB_FLAGS) 242 $(LD_EXTRA) $(STDLIB_FLAGS)
239 # Not specifying -Wl,--gc-sections but instead doing bitcode linking GC w/ LTO. 243 # Not specifying -Wl,--gc-sections but instead doing bitcode linking GC w/ LTO.
240 SB_LDFLAGS := $(LINKOPTLEVEL) $(LD_EXTRA) 244 SB_LDFLAGS := $(LINKOPTLEVEL) $(LD_EXTRA)
241 245
242 # List the target-specific source files first, which generally take longer to 246 # List the target-specific source files first, which generally take longer to
243 # compile, in the hope of improving parallel build time. 247 # compile, in the hope of improving parallel build time.
244 SRCS = \ 248 SRCS = \
245 IceAssemblerARM32.cpp \ 249 IceAssemblerARM32.cpp \
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
321 UNITTEST_OBJS = $(patsubst %.cpp, $(OBJDIR)/unittest/%.o, $(UNITTEST_SRCS)) 325 UNITTEST_OBJS = $(patsubst %.cpp, $(OBJDIR)/unittest/%.o, $(UNITTEST_SRCS))
322 UNITTEST_LIB_OBJS = $(filter-out $(OBJDIR)/main.o,$(OBJS)) 326 UNITTEST_LIB_OBJS = $(filter-out $(OBJDIR)/main.o,$(OBJS))
323 327
324 # Keep all the first target so it's the default. 328 # Keep all the first target so it's the default.
325 all: $(OBJDIR)/pnacl-sz make_symlink runtime 329 all: $(OBJDIR)/pnacl-sz make_symlink runtime
326 330
327 ifdef TSAN 331 ifdef TSAN
328 sb: 332 sb:
329 @echo "Skipping pnacl-sz.*.nexe: TSAN isn't supported under NaCl." 333 @echo "Skipping pnacl-sz.*.nexe: TSAN isn't supported under NaCl."
330 else 334 else
331 sb: $(SB_OBJDIR)/pnacl-sz.x86-32.nexe 335 sb: $(SB_OBJDIR)/pnacl-sz.x8632.nexe \
336 $(SB_OBJDIR)/pnacl-sz.x8664.nexe \
337 sb_make_symlink
332 endif 338 endif
333 339
334 # SHOW_BUILD_ATTS is an executable that is run to show what build 340 # SHOW_BUILD_ATTS is an executable that is run to show what build
335 # attributes were used to build pnacl-sz. 341 # attributes were used to build pnacl-sz.
336 SHOW_BUILD_ATTS = $(OBJDIR)/pnacl-sz --build-atts 342 SHOW_BUILD_ATTS = $(OBJDIR)/pnacl-sz --build-atts
337 343
338 # Creates symbolic link so that testing is easier. Also runs 344 # Creates symbolic link so that testing is easier. Also runs
339 # pnacl-sz to verify that the defines flags have valid values, 345 # pnacl-sz to verify that the defines flags have valid values,
340 # as well as describe the corresponding build attributes. 346 # as well as describe the corresponding build attributes.
341 make_symlink: $(OBJDIR)/pnacl-sz 347 make_symlink: $(OBJDIR)/pnacl-sz
342 rm -rf pnacl-sz 348 rm -rf pnacl-sz
343 ln -s $(OBJDIR)/pnacl-sz 349 ln -s $(OBJDIR)/pnacl-sz
344 @echo "Build Attributes:" 350 @echo "Build Attributes:"
345 @$(SHOW_BUILD_ATTS) 351 @$(SHOW_BUILD_ATTS)
346 352
353 sb_make_symlink: $(SB_OBJDIR)/pnacl-sz.x8632.nexe \
354 $(SB_OBJDIR)/pnacl-sz.x8664.nexe
355 rm -rf pnacl-sz.x8632.nexe pnacl-sz.x8664.nexe
356 ln -s $(SB_OBJDIR)/pnacl-sz.x8632.nexe
357 ln -s $(SB_OBJDIR)/pnacl-sz.x8664.nexe
358
347 .PHONY: all compile_only make_symlink runtime bloat sb docs help \ 359 .PHONY: all compile_only make_symlink runtime bloat sb docs help \
348 help-check-lit help-check-xtest 360 help-check-lit help-check-xtest
349 361
350 compile_only: $(OBJS) 362 compile_only: $(OBJS)
351 363
352 $(OBJDIR)/pnacl-sz: $(OBJS) 364 $(OBJDIR)/pnacl-sz: $(OBJS)
353 $(CXX) $(LDFLAGS) -o $@ $^ $(LLVM_LDFLAGS) \ 365 $(CXX) $(LDFLAGS) -o $@ $^ $(LLVM_LDFLAGS) \
354 -Wl,-rpath=$(abspath $(LIBCXX_INSTALL_PATH)/lib) 366 -Wl,-rpath=$(abspath $(LIBCXX_INSTALL_PATH)/lib)
355 367
356 $(SB_OBJDIR)/pnacl-sz.x86-32.nexe: $(SB_OBJS) 368 $(SB_OBJDIR)/pnacl-sz.nonfinal.pexe: $(SB_OBJS)
357 » $(eval PNACL_SZ_BASE := $(patsubst %.nexe, %, $@)) 369 » $(SB_CXX) $(SB_LDFLAGS) -o $@ $^ $(SB_LLVM_LDFLAGS)
358 » $(SB_CXX) $(SB_LDFLAGS) -o $(PNACL_SZ_BASE).nonfinal.pexe $^ \ 370
359 $(SB_LLVM_LDFLAGS) 371 $(SB_OBJDIR)/pnacl-sz.pexe: $(SB_OBJDIR)/pnacl-sz.nonfinal.pexe
360 » $(SB_TRANSLATE) -arch x86-32 $(PNACL_SZ_BASE).nonfinal.pexe -o $@ \ 372 » $(SB_FINALIZE) $^ -o $@
361 --allow-llvm-bitcode-input 373
374 $(SB_OBJDIR)/pnacl-sz.x8632.nexe: $(SB_OBJDIR)/pnacl-sz.pexe
375 » $(SB_TRANSLATE) -arch x86-32 $^ -o $@
376
John 2016/02/25 02:36:56 Arm32?? Totally optional, and up to you.
Jim Stichnoth 2016/02/25 05:32:20 I thought to do that a little later, when there's
377 $(SB_OBJDIR)/pnacl-sz.x8664.nexe: $(SB_OBJDIR)/pnacl-sz.pexe
378 » $(SB_TRANSLATE) -arch x86-64 $^ -o $@
362 379
363 src/IceRegistersARM32.def: pydir/gen_arm32_reg_tables.py 380 src/IceRegistersARM32.def: pydir/gen_arm32_reg_tables.py
364 python $< > $@ 381 python $< > $@
365 382
366 # TODO(stichnot): Be more precise than "*.h" here and elsewhere. 383 # TODO(stichnot): Be more precise than "*.h" here and elsewhere.
367 $(OBJS): $(OBJDIR)/%.o: src/%.cpp src/*.h src/*.def 384 $(OBJS): $(OBJDIR)/%.o: src/%.cpp src/*.h src/*.def
368 $(CXX) -c $(CXXFLAGS) $< -o $@ 385 $(CXX) -c $(CXXFLAGS) $< -o $@
369 386
370 $(SB_OBJS): $(SB_OBJDIR)/%.o: src/%.cpp src/*.h src/*.def 387 $(SB_OBJS): $(SB_OBJDIR)/%.o: src/%.cpp src/*.h src/*.def
371 $(SB_CXX) -c $(SB_CXXFLAGS) $< -o $@ 388 $(SB_CXX) -c $(SB_CXXFLAGS) $< -o $@
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after
492 509
493 check-spec: $(ALLSPEC:=.spec2k) 510 check-spec: $(ALLSPEC:=.spec2k)
494 511
495 check: check-lit check-unit check-xtest 512 check: check-lit check-unit check-xtest
496 513
497 check-presubmit presubmit: 514 check-presubmit presubmit:
498 # Make sure clang-format gets run. 515 # Make sure clang-format gets run.
499 +make -f Makefile.standalone format 516 +make -f Makefile.standalone format
500 # Verify MINIMAL build, plus proper usage of REQUIRES in lit tests. 517 # Verify MINIMAL build, plus proper usage of REQUIRES in lit tests.
501 +make -f Makefile.standalone \ 518 +make -f Makefile.standalone \
502 MINIMAL=1 check 519 MINIMAL=1 sb check
503 # Check that there are no g++ build errors or warnings. 520 # Check that there are no g++ build errors or warnings.
504 +make -f Makefile.standalone \ 521 +make -f Makefile.standalone \
505 GPLUSPLUS=1 compile_only 522 GPLUSPLUS=1 compile_only
506 # Check the x86 assembler unit tests. 523 # Check the x86 assembler unit tests.
507 +make -f Makefile.standalone \ 524 +make -f Makefile.standalone \
508 DEBUG=1 CHECK_X86_ASM=1 check-unit 525 DEBUG=1 CHECK_X86_ASM=1 check-unit
509 # Run lit tests, cross tests, unit tests, and spec2k/x86-32. 526 # Run lit tests, cross tests, unit tests, and spec2k/x86-32.
510 +make -f Makefile.standalone \ 527 +make -f Makefile.standalone \
511 check check-spec 528 check check-spec sb
512 # Run spec2k/x86-64. 529 # Run spec2k/x86-64.
513 +make -f Makefile.standalone \ 530 +make -f Makefile.standalone \
514 TARGET=x8664 check-spec 531 TARGET=x8664 check-spec
515 # Build spec2k under -Om1/x86-32, to check for liveness errors. 532 # Build spec2k under -Om1/x86-32, to check for liveness errors.
516 +make -f Makefile.standalone \ 533 +make -f Makefile.standalone \
517 SPECFLAGS='-Om1' SPECBUILDONLY=true check-spec 534 SPECFLAGS='-Om1' SPECBUILDONLY=true check-spec
518 # Build spec2k under -Om1/x86-64, to check for liveness errors. 535 # Build spec2k under -Om1/x86-64, to check for liveness errors.
519 +make -f Makefile.standalone \ 536 +make -f Makefile.standalone \
520 SPECFLAGS='-Om1' TARGET=x8664 SPECBUILDONLY=true check-spec 537 SPECFLAGS='-Om1' TARGET=x8664 SPECBUILDONLY=true check-spec
521 # Run spec2k for x86-32 without advanced phi lowering. 538 # Run spec2k for x86-32 without advanced phi lowering.
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
567 help: 584 help:
568 @cat Makefile.standalone-help/help.txt 585 @cat Makefile.standalone-help/help.txt
569 586
570 help-check-lit: 587 help-check-lit:
571 @cat Makefile.standalone-help/check-lit.txt 588 @cat Makefile.standalone-help/check-lit.txt
572 589
573 help-check-xtest: 590 help-check-xtest:
574 @cat Makefile.standalone-help/check-xtest.txt 591 @cat Makefile.standalone-help/check-xtest.txt
575 592
576 clean: 593 clean:
577 » rm -rf pnacl-sz *.o $(OBJDIR) $(SB_OBJDIR) build/pnacl-sz.bloat.json 594 » rm -rf pnacl-sz pnacl-sz.x8632.nexe pnacl-sz.x8664.nexe *.o \
595 $(OBJDIR) $(SB_OBJDIR) build/pnacl-sz.bloat.json
578 596
579 clean-all: clean 597 clean-all: clean
580 rm -rf build/ crosstest/Output/ 598 rm -rf build/ crosstest/Output/
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698