-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
37 lines (26 loc) · 885 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
MODE ?= DEBUG
ifeq ($(MODE),DEBUG)
WEBPACK_MODE=development
RUST_MODE=debug
else
WEBPACK_MODE=production
RUST_MODE=release
endif
RUST_BINARY = target/$(RUST_MODE)/mccraft_web_server
RUST_SOURCES = $(shell find -name '*.rs')
WEB_SOURCES = $(shell find ./mccraft_frontend/src) $(glob ./mccraft_frontend/%.json)
web: mccraft_frontend/dist/main.js $(RUST_BINARY)
ifneq ($(IMAGE_PATH),)
RUST_IMAGE_PATH=--image-path $(IMAGE_PATH)
else
RUST_IMAGE_PATH=
endif
serve: web
$(RUST_BINARY) --static-path mccraft_frontend/dist $(RUST_IMAGE_PATH)
mccraft_frontend/dist/main.js: $(WEB_SOURCES)
cd mccraft_frontend && ./node_modules/.bin/webpack --mode $(WEBPACK_MODE)
target/debug/mccraft_web_server: $(RUST_SOURCES)
cargo build -p mccraft_web_server
target/release/mccraft_web_server: $(RUST_SOURCES)
cargo build --release -p mccraft_web_server
.PHONY: web serve