forked from sanpii/oxfeed
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
56 lines (44 loc) · 1.03 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
52
53
54
55
56
YARN?=yarn
YARN_FLAGS?=
CARGO?=cargo
CARGO_FLAGS?=
WASM_PACK?=wasm-pack
WASM_PACK_FLAGS?=
ifeq ($(APP_ENVIRONMENT),prod)
ENV=release
YARN_FLAGS+=--production
CARGO_FLAGS+=--release
WASM_PACK_FLAGS+=--release
else
ENV=debug
WASM_PACK_FLAGS+=--dev
endif
.DEFAULT_GOAL := build
ifneq (,$(wildcard ./.env))
include .env
export
endif
build: api front
.PHONY: build
api:
$(CARGO) build $(CARGO_FLAGS) --package oxfeed-api
.PHONY: api
front: yarn wasm
.PHONY: front
wasm:
RUST_LOG=info $(WASM_PACK) build $(WASM_PACK_FLAGS) --target web --out-dir ./static front
ln --relative --force --symbolic $(shell ls -rt $(shell find target/ -name index.html | grep ".") | tail -1) front/static/index.html
rm front/static/.gitignore
.PHONY: wasm
yarn: front/static/lib
.PHONY: yarn
front/static/lib: front/package.json
cd front && $(YARN) $(YARN_FLAGS) install
serve: serve_api serve_front
.PHONY: server
serve_api:
$(CARGO) $(CARGO_FLAGS) run --package oxfeed-api
.PHONY: serve_api
serve_front: front
microserver front/static/
.PHONY: serve_front