forked from battlecode/battlecode-2018
-
Notifications
You must be signed in to change notification settings - Fork 0
/
helpers.mk
46 lines (41 loc) · 792 Bytes
/
helpers.mk
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
define build_command
@echo
$(call magenta,$$ $(1))
@$(1)
$(call green,succeeded)
@echo
endef
define test_command
@echo
$(call magenta,$$ $(1))
@$(1)
$(call green,passed)
@echo
endef
define magenta
@-tput setaf 5
@echo "$(1)"
@-tput sgr0
endef
define green
@-tput setaf 2
@echo "$(1)"
@-tput sgr0
endef
ifeq ($(OS),Windows_NT)
CUR_OS := win32
else
UNAME_S := $(shell uname -s)
ifeq ($(UNAME_S),Linux)
CUR_OS := linux
endif
ifeq ($(UNAME_S),Darwin)
CUR_OS := darwin
endif
endif
ifeq ($(CARGO_TARGET_DIR),)
# set current_dir to path to helpers.mk (i.e. the path of battlecode-2018
ROOT_DIR := $(shell dirname $(realpath $(lastword $(MAKEFILE_LIST))))
# use the standard rust `target` directory
CARGO_TARGET_DIR := $(ROOT_DIR)/target
endif