Makefile 767 Bytes
.PHONY: start wasm build run clean

PROFILE ?= dev
ifeq "$(PROFILE)" "release"
CARGO_PROFILE = --release
WASM_PROFILE = --release
WASM_EXTRA = --no-default-features
else
CARGO_PROFILE =
WASM_PROFILE = --dev
WASM_EXTRA =
endif

define msg
	@printf "\033[38;5;197m%s\033[0m\n" "$(1)"
endef

start:
	systemfd --no-pid -s 0.0.0.0:3000 -- \
		cargo watch -i static/ -s "make run"

wasm:
	$(call msg,BUILD WASM UI)
	@wasm-pack build $(WASM_PROFILE) -d ../static/ui -t web ./ui -- \
		$(WASM_EXTRA)

build:
	$(call msg,BUILD SERVER)
	@cargo build $(CARGO_PROFILE) --bin artshop-server

run: build wasm
	$(call msg,RUN SERVER)
	@cargo run $(CARGO_PROFILE) --bin artshop-server

release:
	docker build -t artshop -f build/Dockerfile .

clean:
	cargo clean
	rm -Rf ./static/ui