58 lines
1.2 KiB
Makefile
58 lines
1.2 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:
|
|
git submodule update
|
|
cd assets; npm i
|
|
|
|
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
|
|
|
|
go generate "sour.is/x/paste/src/routes"
|
|
|
|
$(DOCS_ASSET): $(DOCS_FILES) $(SOURCE)
|
|
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 deploy run setup
|
|
# DO NOT DELETE
|