go-paste/Makefile
2019-09-06 15:08:50 -06:00

65 lines
1.4 KiB
Makefile

ROUTE_ASSET=src/routes/bindata.go
ROUTE_FILES=$(wildcard assets/src/*) $(wildcard assets/public/*)
DOCS_ASSET=src/docs/bindata.go
DOCS_FILES=$(wildcard src/docs/ui/*)
VENDOR_FILES=$(shell find vendor -type f -name '*.go')
SOURCE=$(wildcard cmd/paste/*.go) $(filter-out src/routes/bindata.go, $(wildcard src/routes/*.go))
BINARY=paste
define DUMMY_BINDATA
package docs
import "net/http"
func assetFS() (fs http.FileSystem) { return }
endef
export DUMMY_BINDATA
all: $(BINARY)
clean:
rm -rf $(BINARY) $(ROUTE_ASSET) $(DOCS_ASSET)
setup:
dep ensure
go get github.com/jteeuwen/go-bindata/...
go get github.com/elazarl/go-bindata-assetfs/...
git submodule update
cd assets; npm i
ensure:
dep ensure -update
dep status
fmt:
go fmt ./...
run: $(BINARY)
./$(BINARY) -vv serve
$(BINARY): $(SOURCE) $(ROUTE_ASSET) $(VENDOR_FILES) $(DOCS_ASSET)
go vet ./...
go test ./...
go build "sour.is/x/paste/cmd/paste"
$(ROUTE_ASSET): $(ROUTE_FILES)
cd assets; \
rm -rf build ../public; \
npm run build; \
cp -r build ../public
export PATH=$$GOPATH/bin:$$PATH; go generate "sour.is/x/paste/src/routes"
$(DOCS_ASSET): $(DOCS_FILES) $(SOURCE)
echo "$$DUMMY_BINDATA" > src/docs/bindata.go
export PATH=$$GOPATH/bin:$$PATH; go generate "sour.is/x/paste/cmd/paste"
export PATH=$$GOPATH/bin:$$PATH; go generate "sour.is/x/paste/src/docs"
deploy: $(SOURCE) $(ROUTE_ASSET)
cd debian && make
.PHONEY: all clean deploy run setup
# DO NOT DELETE