go-paste/Makefile
2020-08-28 16:50:27 -06:00

52 lines
1.1 KiB
Makefile

ROUTE_ASSET=src/routes/bindata.go
DOCS_ASSET=src/docs/bindata.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)
setup:
go mod download
go mod vendor
fmt:
go fmt ./...
test: $(ROUTE_ASSET) $(DOCS_ASSET)
go test ./...
go vet ./...
run: $(BINARY)
./$(BINARY) -vv serve
$(BINARY): $(SOURCE) $(ROUTE_ASSET) $(DOCS_ASSET)
go build "sour.is/x/paste/cmd/paste"
clean-ui:
rm -rf $(ROUTE_ASSET) $(DOCS_ASSET)
build-ui: clean-ui $(ROUTE_ASSET) $(DOCS_ASSET)
$(ROUTE_ASSET):
cd assets; \
rm -rf build ../public; \
npm i; npm run build; \
cp -r build ../public
go generate "sour.is/x/paste/src/routes"
$(DOCS_ASSET):
echo "$$DUMMY_BINDATA" > src/docs/bindata.go
go generate "sour.is/x/paste/cmd/paste"
go generate "sour.is/x/paste/src/docs"
deploy: $(SOURCE) $(ROUTE_ASSET)
cd debian && make
.PHONEY: all clean build deploy run setup
# DO NOT DELETE