go-paste/Makefile

58 lines
1.2 KiB
Makefile
Raw Normal View History

2018-03-14 07:18:19 -06:00
ROUTE_ASSET=src/routes/bindata.go
ROUTE_FILES=$(wildcard assets/src/*) $(wildcard assets/public/*)
2018-03-14 07:18:19 -06:00
DOCS_ASSET=src/docs/bindata.go
DOCS_FILES=$(wildcard src/docs/ui/*)
2018-03-17 19:43:37 -06:00
VENDOR_FILES=$(shell find vendor -type f -name '*.go')
2018-02-15 09:11:52 -07:00
2018-03-17 19:43:37 -06:00
SOURCE=$(wildcard cmd/paste/*.go) $(filter-out src/routes/bindata.go, $(wildcard src/routes/*.go))
BINARY=paste
2018-03-14 07:18:19 -06:00
define DUMMY_BINDATA
package docs
import "net/http"
func assetFS() (fs http.FileSystem) { return }
endef
export DUMMY_BINDATA
all: $(BINARY)
clean:
2018-03-15 11:03:29 -06:00
rm -rf $(BINARY) $(ROUTE_ASSET) $(DOCS_ASSET)
setup:
2018-03-14 07:18:19 -06:00
git submodule update
cd assets; npm i
2018-03-15 11:13:59 -06:00
fmt:
go fmt ./...
2018-02-15 08:01:35 -07:00
run: $(BINARY)
./$(BINARY) -vv serve
2017-05-22 11:13:47 -06:00
2018-03-14 07:18:19 -06:00
$(BINARY): $(SOURCE) $(ROUTE_ASSET) $(VENDOR_FILES) $(DOCS_ASSET)
2018-06-26 10:51:21 -06:00
go vet ./...
go test ./...
2018-03-14 07:18:19 -06:00
go build "sour.is/x/paste/cmd/paste"
$(ROUTE_ASSET): $(ROUTE_FILES)
cd assets; \
rm -rf build ../public; \
npm run build; \
2018-03-14 07:18:19 -06:00
cp -r build ../public
2020-08-16 09:18:52 -06:00
go generate "sour.is/x/paste/src/routes"
2018-03-14 07:18:19 -06:00
$(DOCS_ASSET): $(DOCS_FILES) $(SOURCE)
echo "$$DUMMY_BINDATA" > src/docs/bindata.go
2020-08-16 09:18:52 -06:00
go generate "sour.is/x/paste/cmd/paste"
go generate "sour.is/x/paste/src/docs"
2017-10-13 16:41:48 -06:00
2018-02-15 09:11:52 -07:00
deploy: $(SOURCE) $(ROUTE_ASSET)
cd debian && make
.PHONEY: all clean deploy run setup
2019-09-06 15:08:50 -06:00
# DO NOT DELETE