blob: 7f1f02011c6cc7b26d2d9299cdb1bcc9c7d1bd1a (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
|
ifeq ($(shell uname -s), Darwin)
HOST_PLATFORM = osx
else
HOST_PLATFORM = linux
endif
PLATFORM ?= $(HOST_PLATFORM)
ifeq ($(PLATFORM),android)
CONFIGURE_PLATFORM = android
CONFIGURE_SUBPLATFORM = $(firstword $(SUBPLATFORM) arm-v7)
CONFIGURE_INPUT = platform/android/scripts/configure.sh
PLATFORM_OUTPUT = ./build/android-$(CONFIGURE_SUBPLATFORM)
GYP_FLAVOR_SUFFIX = -android
ENV = $(shell MASON_ANDROID_ABI=$(CONFIGURE_SUBPLATFORM) ./platform/android/scripts/toolchain.sh)
else
CONFIGURE_PLATFORM = $(PLATFORM)
CONFIGURE_SUBPLATFORM = $(shell uname -m)
CONFIGURE_INPUT = platform/$(CONFIGURE_PLATFORM)/scripts/configure.sh
PLATFORM_OUTPUT = ./build/$(PLATFORM)-$(CONFIGURE_SUBPLATFORM)
endif
# Text formatting
TEXT_BOLD = \033[1m
COLOR_GREEN = \033[32m
COLOR_CYAN = \033[36m
COLOR_PINK = \033[35m
FORMAT_END = \033[0m
# Never remove intermediate files
.SECONDARY:
#### Dependencies ##############################################################
ifneq (,$(wildcard .git/.))
.mason:
git submodule update --init
else
.mason: ;
endif
CONFIGURE_OUTPUT = $(PLATFORM_OUTPUT)/config.gypi
.NOTPARALLEL: $(CONFIGURE_OUTPUT)
$(CONFIGURE_OUTPUT): $(CONFIGURE_INPUT) .mason configure
@printf "$(TEXT_BOLD)$(COLOR_GREEN)* Running configure...$(FORMAT_END)\n"
$(ENV) ./configure $< $@ $(CONFIGURE_PLATFORM) $(CONFIGURE_SUBPLATFORM)
#### Build files ###############################################################
GYP_FLAGS += -I$(CONFIGURE_OUTPUT)
GYP_FLAGS += -Dcoverage=$(ENABLE_COVERAGE)
GYP_FLAGS += -Dcxx_host=$(CXX_HOST)
GYP_FLAGS += -Goutput_dir=.
GYP_FLAGS += --depth=.
GYP_FLAGS += --generator-output=$(PLATFORM_OUTPUT)
.PHONY: Makefile/__project__
Makefile/__project__: $(CONFIGURE_OUTPUT)
@printf "$(TEXT_BOLD)$(COLOR_GREEN)* Recreating project...$(FORMAT_END)\n"
$(ENV) deps/run_gyp platform/$(PLATFORM)/platform.gyp $(GYP_FLAGS) -f make$(GYP_FLAVOR_SUFFIX)
Makefile/%: Makefile/__project__
@printf "$(TEXT_BOLD)$(COLOR_GREEN)* Building target $*...$(FORMAT_END)\n"
$(ENV) $(MAKE) -j$(JOBS) -C $(PLATFORM_OUTPUT) BUILDTYPE=$(BUILDTYPE) $*
|