forked from Gigoteur/UnicornConsole
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
45 lines (32 loc) · 938 Bytes
/
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
buildtype = release
PROJECT = px8
TARGET = asmjs-unknown-emscripten
DOCS_DIR = html
DOCS_PORT = 8080
JS_FILE = $(PROJECT).js
CARGO_OUTDIR = target/$(TARGET)/$(buildtype)
CARGO_OPTION = --target $(TARGET) -vv --features "sdl_renderer lua"
EMCC_OPTION = -s USE_SDL=2 --embed-file games
ifeq ($(buildtype),release)
CARGO_OPTION += --release
EMCC_OPTION += -O3
else ifeq ($(buildtype),debug)
CARGO_OPTION +=
EMCC_OPTION += -g4
DOCS_FILES = $(DOCS_DIR)/$(JS_FILE)
else
$(error "unknown buildtype")
endif
all: $(DOCS_DIR)/$(JS_FILE)
.PHONY: all
clean:
cargo clean
$(RM) $(DOCS_DIR)/*.js $(DOCS_DIR)/*.js.mem
.PHONY: clean
FORCE:
.PHONY: FORCE
$(CARGO_OUTDIR)/$(JS_FILE): FORCE
$(RM) $(DOCS_DIR)/*.js $(DOCS_DIR)/*.js.mem
EMMAKEN_CFLAGS="$(EMCC_OPTION)" cargo build $(CARGO_OPTION)
$(DOCS_DIR)/$(JS_FILE): $(CARGO_OUTDIR)/$(JS_FILE) FORCE
find $(CARGO_OUTDIR) \( -name '*.js' -or -name '*.js.mem' \) -exec cp {} $(DOCS_DIR) \;