weiro/Makefile

35 lines
734 B
Makefile
Raw Permalink Normal View History

2026-02-19 10:21:27 +00:00
BUILD_DIR=build
all: clean build
.Phony: init
init:
npm install --save-exact --save-dev esbuild
2026-02-19 10:21:27 +00:00
.Phony: clean
clean:
-rm -r $(BUILD_DIR)
.Phony: frontend
frontend:
npm install
node esbuild.mjs
2026-02-19 10:21:27 +00:00
.Phony: gen
gen:
go run github.com/sqlc-dev/sqlc/cmd/sqlc@v1.30.0 generate
.Phony: build
build: frontend
go build -o ./build/weiro
.Phony: run
run: build
./build/weiro
.Phony: setup_targets
setup_targets: build
SITE_ID=$$(DATA_DIR=$(BUILD_DIR)/data ./$(BUILD_DIR)/weiro sites | tail -n1 | awk '{ print $$1 }'); \
DATA_DIR=$(BUILD_DIR)/data ./build/weiro pubtargets "$$SITE_ID"; \
DATA_DIR=$(BUILD_DIR)/data ./build/weiro pubtargets add --site "$$SITE_ID" --type localfs --ref ./$(BUILD_DIR)/out --url http://localhost:8000