forked from douchey01Cuppa/SPFT_Source
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
33 lines (26 loc) · 1.07 KB
/
Makefile
File metadata and controls
33 lines (26 loc) · 1.07 KB
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
# Usage
# make HOST=(linux/windows) BUILD_TYPE=(debug/release)
# The objects and execution file will be move to ../_Output/
export
HOST := $(if $(HOST),$(HOST),linux)
BUILD_TYPE := $(if $(BUILD_TYPE),$(BUILD_TYPE),debug)
$(if $(filter debug release,$(BUILD_TYPE)),,$(error BUILD_TYPE "$(BUILD_TYPE)" invalid; should be debug or release))
$(if $(filter linux windows,$(HOST)),,$(error HOST "$(HOST)" invalid; should be linux or windows))
BASE_OUTPUT_PATH := ../_Output
# tools
ifeq ($(HOST),linux)
OUTPUT_PATH := $(BASE_OUTPUT_PATH)/$(HOST)/$(BUILD_TYPE)
TEE := tee
MAKE := make
else
WORKING_DIR := $(shell cd)
TOOLS_DIR := $(WORKING_DIR)\Build\Tools\Windows
OUTPUT_PATH := $(BASE_OUTPUT_PATH)\$(HOST)
TEE := $(TOOLS_DIR)\tee.exe
MAKE := make.exe
endif
PLATFORM_MAKEFILE := Build/build-$(HOST).mk
LOG := build.log
$(MAKECMDGOALS): recursive-make
recursive-make:
$(MAKE) -f $(PLATFORM_MAKEFILE) BUILD_TYPE=$(BUILD_TYPE) HOST=$(HOST) $(MAKECMDGOALS) 2>&1 | $(TEE) $(LOG)