
Its make was moved to `serve` target in ccec612687
, but we can't use `serve` target in the nix build
It's also run after `frontend` target is already built which probably causes the `frontend` target to build.
51 lines
1.2 KiB
Makefile
51 lines
1.2 KiB
Makefile
# Directories
|
|
FRONTEND_DIR := ./frontend
|
|
BACKEND_DIR := ./backend
|
|
PUBLIC_DIR := ./public
|
|
ASSET_DIR := ./assets
|
|
|
|
# Commands
|
|
ELM_MAKE := elm make
|
|
CARGO_BUILD := cargo build
|
|
CARGO_RUN := cargo run
|
|
|
|
ifeq ($(DEBUG)$(RELEASE),) # Both are empty
|
|
$(error You must set exactly one of DEBUG=1 or RELEASE=1)
|
|
endif
|
|
|
|
ifeq ($(DEBUG)$(RELEASE),11) # Both are set
|
|
$(error Both DEBUG and RELEASE cannot be set at the same time)
|
|
endif
|
|
|
|
# Targets
|
|
.PHONY: all frontend backend clean serve
|
|
|
|
$(PUBLIC_DIR):
|
|
mkdir -p $(PUBLIC_DIR)
|
|
|
|
$(PUBLIC_DIR)/index.html: $(FRONTEND_DIR)/index.html $(PUBLIC_DIR)
|
|
cp $< $@
|
|
|
|
.PHONY: frontend backend
|
|
|
|
frontend: $(PUBLIC_DIR)/index.html $(PUBLIC_DIR)
|
|
make -C $(FRONTEND_DIR)
|
|
cp $(FRONTEND_DIR)/elm.min.js $(PUBLIC_DIR)/
|
|
cp $(FRONTEND_DIR)/src/ports.websocket.js $(PUBLIC_DIR)/
|
|
mkdir -p $(PUBLIC_DIR)/assets
|
|
|
|
backend:
|
|
$(CARGO_BUILD) --manifest-path=$(BACKEND_DIR)/Cargo.toml
|
|
|
|
serve: frontend backend
|
|
ifeq ($(DEBUG),1)
|
|
RUST_LOG=info,actix_web=debug $(CARGO_RUN) --manifest-path=$(BACKEND_DIR)/Cargo.toml
|
|
else ifeq ($(RELEASE),1)
|
|
$(CARGO_RUN) --release --manifest-path=$(BACKEND_DIR)/Cargo.toml
|
|
endif
|
|
|
|
clean:
|
|
rm -rf $(PUBLIC_DIR)/*
|
|
rm -rf $(BACKEND_DIR)/target
|
|
make -C $(FRONTEND_DIR) clean
|