diff --git a/Makefile b/Makefile index a406825..8c120d8 100644 --- a/Makefile +++ b/Makefile @@ -1,22 +1,27 @@ -all: sqlc elm build +GOSRC!=find * -type f \( -name '*.go' -and -not -name '*_test.go' \) +GOSRC+=go.mod go.sum +gostart: $(GO_SRC) go.mod go.sum data + go build -trimpath -o $@ + +assets/main.min.js: src/Main.elm + elm make $< --optimize --output=assets/main.js + uglifyjs assets/main.js --compress 'pure_funcs=[F2,F3,F4,F5,F6,F7,F8,F9,A2,A3,A4,A5,A6,A7,A8,A9],pure_getters,keep_fargs=false,unsafe_comps,unsafe' | uglifyjs --mangle --output $@ + rm -f assets/main.js + +data: queries.sql schema.sql + sqlc generate + touch data + +.PHONY: check check: go vet ./... staticcheck ./... -elm: src/Main.elm - elm make src/Main.elm --optimize --output=assets/main.js - uglifyjs assets/main.js --compress 'pure_funcs=[F2,F3,F4,F5,F6,F7,F8,F9,A2,A3,A4,A5,A6,A7,A8,A9],pure_getters,keep_fargs=false,unsafe_comps,unsafe' | uglifyjs --mangle --output assets/main.min.js - rm -f assets/main.js - -sqlc: queries.sql schema.sql - sqlc generate - -build: - go build - +.PHONY: watch watch: echo src/Main.elm | entr -r make elm -run: sqlc build +.PHONY: run +run: gostart ./gostart -name startdev -db ./test.db -dev