blob: f759d69cac4e9cd7cc12b9c3f91a07f5d24eca17 [file] [log] [blame]
PORT ?= 8080
VERBOSE ?= 0
BIN := backend/dist/fidlbolt
.PHONY: all help frontend backend run format clean
all: frontend backend support
help:
@echo "Targets:"
@echo " all Build everything."
@echo " help Show this help message."
@echo " frontend Build the frontend/dist bundle using webpack."
@echo " For more build options: cd frontend && npm run."
@echo " backend Build the $(BIN) server binary."
@echo " support Copy FIDL files and binaries from \$$FUCHSIA_DIR."
@echo " Note: make is unaware of changes in fuchsia."
@echo " To force a new copy: make -B support."
@echo " run Run the fidlbolt server on \$$PORT."
@echo " This rebuilds targets only if they do not exist."
@echo " To ensure an up-to-date server: make && make run."
@echo " format Auto-format all code."
@echo " clean Remove all build/copied files."
frontend: frontend/dist
frontend/node_modules: frontend/package*.json
cd frontend && npm install
frontend/dist: frontend/node_modules frontend/src/* frontend/src/elm/*
cd frontend && npm run build
backend: $(BIN)
$(BIN): backend/go.mod backend/*.go
cd backend && go build -o ../$@
support: copy_support_files.sh
./$<
run: $(if $(wildcard frontend/dist),,frontend)
run: $(if $(wildcard $(BIN)),,backend)
run: $(if $(wildcard support),,support)
./$(BIN) \
-static=frontend/dist \
-bin=support/bin \
-fidl=support/fidl \
-port=$(PORT) \
-verbose=$(VERBOSE)
format:
cd frontend && npm run fix
cd backend && go fmt
clean:
rm -rf backend/dist/
rm -rf frontend/dist/
rm -rf support/