blob: 65e459a9e105de539a6766fd60fde4cdf596ef4a [file] [log] [blame]
Jim Stichnothf7c9a142014-04-29 10:52:43 -07001
Derek Schuffbc643132014-05-22 16:39:25 -07002ifndef SUBZERO_LEVEL
3# Top-level, not included from a subdir
4SUBZERO_LEVEL := .
5DIRS := src
6PARALLEL_DIRS :=
7endif
Jim Stichnothf7c9a142014-04-29 10:52:43 -07008
Derek Schuffbc643132014-05-22 16:39:25 -07009# Set LLVM source root level.
10LEVEL := $(SUBZERO_LEVEL)/../..
Jim Stichnothf7c9a142014-04-29 10:52:43 -070011
Derek Schuffbc643132014-05-22 16:39:25 -070012# Include LLVM common makefile.
13include $(LEVEL)/Makefile.common
Karl Schimpfb262c5e2014-10-27 14:41:57 -070014
Jan Vounge837e1a2015-03-02 14:21:54 -080015# -O3 seems to trigger the following PNaCl ABI transform bug
16# on method pointers, so override that with -O2:
17# https://code.google.com/p/nativeclient/issues/detail?id=3857
18CXX.Flags += -O2
19# Newlib paired with libc++ requires gnu.
20CXX.Flags += -std=gnu++11
Karl Schimpfb262c5e2014-10-27 14:41:57 -070021
Jan Vounge837e1a2015-03-02 14:21:54 -080022ifeq ($(PNACL_BROWSER_TRANSLATOR),1)
23 CPP.Defines += -DALLOW_DUMP=0 -DALLOW_LLVM_CL=0 -DALLOW_LLVM_IR=0 \
Jim Stichnoth1670ece2016-03-12 10:04:08 -080024 -DALLOW_TIMERS=0 -DALLOW_LLVM_IR_AS_INPUT=0 -DALLOW_MINIMAL_BUILD=1 \
John Porto681f90f2016-04-05 06:20:50 -070025 -DALLOW_WASM=0 -DPNACL_BROWSER_TRANSLATOR=1
Jan Vounge837e1a2015-03-02 14:21:54 -080026else
27 CPP.Defines += -DALLOW_DUMP=1 -DALLOW_LLVM_CL=1 -DALLOW_LLVM_IR=1 \
Jim Stichnoth1670ece2016-03-12 10:04:08 -080028 -DALLOW_TIMERS=1 -DALLOW_LLVM_IR_AS_INPUT=1 -DALLOW_MINIMAL_BUILD=0 \
John Porto681f90f2016-04-05 06:20:50 -070029 -DALLOW_WASM=0 -DPNACL_BROWSER_TRANSLATOR=0
Jim Stichnoth7146e992016-05-02 12:06:22 -070030 CXX.Flags += -Wno-undefined-var-template
Jan Vounge837e1a2015-03-02 14:21:54 -080031endif
Jim Stichnothf5fdd232016-05-09 12:24:36 -070032
33CPP.Defines += -DPNACL_LLVM
Jim Stichnothca7a3672016-09-14 11:07:30 -070034# SUBZERO_SRC_ROOT should already be set, but if not, set to cwd.
35SUBZERO_SRC_ROOT ?= .
36SZ_COMMIT_COUNT := $(shell git -C $(SUBZERO_SRC_ROOT) rev-list --count HEAD)
37SZ_GIT_HASH := $(shell git -C $(SUBZERO_SRC_ROOT) rev-parse HEAD)
Jim Stichnoth6b0ee2a2016-08-17 16:20:21 -070038CPP.Defines += -DSUBZERO_REVISION=$(SZ_COMMIT_COUNT)_$(SZ_GIT_HASH)