-
Notifications
You must be signed in to change notification settings - Fork 70
/
Makefile
executable file
·51 lines (43 loc) · 1.79 KB
/
Makefile
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
# Usage
# make HOST=(linux/windows) BUILD_TYPE=(debug/release)
# The objects and execution file will be move to ../_Output/
# Windows known issues:1.jom.exe could not be executed to make; 2. eval to assign variable does not work
#
# general config
TARGET :=
HOST := $(if $(HOST),$(HOST),linux)
BUILD_TYPE := $(if $(BUILD_TYPE),$(BUILD_TYPE),debug)
#BUILDCHANGELIST := $(if $(BUILDCHANGELIST),$(BUILDCHANGELIST),CHANGE_LIST_NOT_SPECIFIED)
#BUILDOWNER := $(if $(BUILDOWNER),$(BUILDOWNER),OWNER_NOT_SPECIFIED)
#BUILD_CONFIG_H := Build/build_cfg.h
# tools
ifeq ($(HOST),linux)
TOOLS_DIR := ./Build/Tools/$(HOST)
OUTPUT_PATH := ../_Output/$(HOST)/$(BUILD_TYPE)
TEE := tee
MAKE := make
else
OUTPUT_PATH := ..\_Output\$(HOST)
TEE := $(TOOLS_DIR)\tee.exe
MAKE := make.exe
endif
ifeq (off,$(LOG))
all:
.PHONY: FORCE
include Build/build-$(HOST).mk
else
$(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))
LOG := build_log.txt
$(MAKECMDGOALS): recursive-make
recursive-make:
$(MAKE) BUILD_TYPE=$(BUILD_TYPE) HOST=$(HOST) LOG=off $(MAKECMDGOALS) 2>&1 | $(TEE) $(LOG)
endif
#.PHONY: builder-config
#builder-config:
# $(if $(LINUX), @chmod a+w $(BUILD_CONFIG_H), @attrib -r $(BUILD_CONFIG_H))
# @echo #ifndef _BUILD_CONFIG_ > $(BUILD_CONFIG_H)
# @echo #define _BUILD_CONFIG_ >> $(BUILD_CONFIG_H)
# @echo #define BUILDCHANGELIST "$(BUILDCHANGELIST)" >> $(BUILD_CONFIG_H)
# @echo #define BUILDOWNER "$(BUILDOWNER)" >> $(BUILD_CONFIG_H)
# @echo #endif >> $(BUILD_CONFIG_H)