-
Notifications
You must be signed in to change notification settings - Fork 7
/
GNUmakefile
75 lines (55 loc) · 1.31 KB
/
GNUmakefile
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
67
68
69
70
71
72
73
74
75
TARGET := junie
VERSION := 0.7.1-$(shell date +%s)
ifeq ($(DEBUG), 1)
BUILD := development
else
BUILD := production
endif
DEPS_DIR := deps
CORES_DIR := cores
APP_DIR := app
UI_DIR := ui
OUT_DIR := build
QUIET := > /dev/null 2>&1
MAKEFLAGS += --no-print-directory
UI_FLAGS := --version $(VERSION)
ifeq ($(DEBUG), 1)
UI_FLAGS += --debug
endif
ifeq ($(UI_ONLY), 1)
WATCH_CMD := $(MAKE) -C $(APP_DIR) DEBUG=$(DEBUG)
else
UI_FLAGS += --command "$(MAKE) -C ../$(APP_DIR) DEBUG=$(DEBUG)"
endif
.PHONY: deps cores app ui
# Build
all: clean prepare deps cores app ui
deps:
@$(MAKE) -C $(DEPS_DIR)
cores:
@$(MAKE) -C $(CORES_DIR)
app:
@$(MAKE) -C $(APP_DIR) DEBUG=$(DEBUG)
ui:
@echo Building application...
@( cd ui && node esbuild.mjs $(UI_FLAGS) $(QUIET) )
# Watch
watch: clean prepare deps cores
@$(WATCH_CMD)
@( cd ui && node esbuild.mjs --watch $(UI_FLAGS) )
# Common
prepare:
@echo Fetching dependencies...
@yarn --cwd $(UI_DIR) install $(QUIET)
# Pack
pack: all
@echo Packing Junie $(VERSION)...
@mkdir $(OUT_DIR)
@( cd $(UI_DIR)/$(OUT_DIR) && zip -r ../../$(OUT_DIR)/$(TARGET)-$(VERSION).zip `ls -I games` $(QUIET) )
# Clean
clean:
@$(MAKE) -C $(APP_DIR) clean
@rm -rf $(OUT_DIR) $(APP_DIR)/$(OUT_DIR) $(UI_DIR)/$(OUT_DIR)
clean-all: clean
@$(MAKE) -C $(DEPS_DIR) clean
@$(MAKE) -C $(CORES_DIR) clean