go-paste/Makefile
2018-03-14 07:18:19 -06:00

55 lines
1.3 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=$(wildcard vendor/*)
SOURCE=$(wildcard cmd/*/*.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) public/
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
run: $(BINARY)
./$(BINARY) -vv serve
$(BINARY): $(SOURCE) $(ROUTE_ASSET) $(VENDOR_FILES) $(DOCS_ASSET)
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