Only archive the cacert-boardvoting binary and the config example
[cacert-boardvoting.git] / Makefile
index 857255e..e310918 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -1,11 +1,22 @@
 VERSION := $(shell git describe --always --dirty=-dev)
 BUILD := $(shell date --iso-8601=seconds --utc)
-GOFILES := $(wildcard *.go)
+GOFILES = $(shell find . -type f -name '*.go')
+STATICFILES = $(shell find boardvoting/static/ -type f)
+TEMPLATES = $(shell find boardvoting/templates/ -type f)
+DBMIGRATIONS = $(shell find boardvoting/migrations/ -type f)
 
-cacert-boardvoting: ${GOFILES}
-       go build -o $@ -ldflags "-X 'main.version=${VERSION}' -X 'main.build=${BUILD}'"
+all: cacert-boardvoting
+
+boardvoting/assets.go: $(DBMIGRATIONS) $(STATICFILES) $(TEMPLATES) $(DBMIGRATIONS) boardvoting/main.go
+       go generate -v ./boardvoting
+
+cacert-boardvoting: ${GOFILES} boardvoting/assets.go
+       go build -o $@ -x -ldflags " -X 'main.version=${VERSION}' -X 'main.build=${BUILD}'"
 
 clean:
        rm -f cacert-boardvoting
 
-.PHONY: clean
+distclean: clean
+       rm -f boardvoting/assets.go
+
+.PHONY: clean distclean all