29 lines
852 B
Makefile
29 lines
852 B
Makefile
# Builds the two-file distribution: dist/kjv-api (static binary) and dist/kjv.db
|
|
# (the Bible, every page/script/style/data file, plus runtime tables and logs).
|
|
# dist/ also holds the user service and the nginx/apache configs, which are kept in git.
|
|
|
|
GO ?= go
|
|
SOURCES := $(shell find cmd internal -name '*.go') go.mod go.sum
|
|
|
|
.PHONY: all build dist test clean
|
|
all: dist
|
|
|
|
build: bin/kjv-api
|
|
|
|
bin/kjv-api: $(SOURCES)
|
|
CGO_ENABLED=0 $(GO) build -trimpath -ldflags="-s -w" -o $@ ./cmd/kjv-api
|
|
|
|
# kjv.db is a fresh copy of db/kjv.db with everything under assets/ loaded into it
|
|
dist: bin/kjv-api db/kjv.db $(shell find assets -type f)
|
|
mkdir -p dist
|
|
cp bin/kjv-api dist/kjv-api
|
|
cp db/kjv.db dist/kjv.db
|
|
bin/kjv-api import-assets -db dist/kjv.db assets
|
|
@ls -l dist
|
|
|
|
test:
|
|
$(GO) vet ./... && $(GO) test ./...
|
|
|
|
clean:
|
|
rm -rf bin dist/kjv-api dist/kjv.db
|