2018-03-14 07:18:19 -06:00
|
|
|
ROUTE_ASSET=src/routes/bindata.go
|
2018-03-13 16:25:18 -06:00
|
|
|
ROUTE_FILES=$(wildcard assets/src/*) $(wildcard assets/public/*)
|
2017-04-24 09:20:46 -06:00
|
|
|
|
2018-03-14 07:18:19 -06:00
|
|
|
DOCS_ASSET=src/docs/bindata.go
|
|
|
|
DOCS_FILES=$(wildcard src/docs/ui/*)
|
|
|
|
|
2018-02-15 09:11:52 -07:00
|
|
|
VENDOR_FILES=$(wildcard vendor/*)
|
|
|
|
|
2018-03-14 07:18:19 -06:00
|
|
|
SOURCE=$(wildcard cmd/*/*.go) $(filter-out src/routes/bindata.go, $(wildcard src/routes/*.go))
|
2017-04-24 09:20:46 -06:00
|
|
|
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
|
|
|
|
|
2017-04-24 09:20:46 -06:00
|
|
|
all: $(BINARY)
|
|
|
|
|
|
|
|
clean:
|
2018-03-14 07:18:19 -06:00
|
|
|
rm -rf $(BINARY) $(ROUTE_ASSET) public/
|
2017-04-24 09:20:46 -06:00
|
|
|
|
2018-03-13 16:25:18 -06:00
|
|
|
setup:
|
|
|
|
dep ensure
|
|
|
|
go get github.com/jteeuwen/go-bindata/...
|
|
|
|
go get github.com/elazarl/go-bindata-assetfs/...
|
2018-03-14 07:18:19 -06:00
|
|
|
git submodule update
|
|
|
|
cd assets; npm i
|
2018-03-13 16:25:18 -06:00
|
|
|
|
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)
|
|
|
|
go build "sour.is/x/paste/cmd/paste"
|
2017-04-24 09:20:46 -06:00
|
|
|
|
|
|
|
$(ROUTE_ASSET): $(ROUTE_FILES)
|
|
|
|
cd assets; \
|
2018-03-13 16:25:18 -06:00
|
|
|
rm -rf build ../public; \
|
|
|
|
npm run build; \
|
2018-03-14 07:18:19 -06:00
|
|
|
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"
|
2017-10-13 16:41:48 -06:00
|
|
|
|
2017-04-24 09:20:46 -06:00
|
|
|
|
2018-02-15 09:11:52 -07:00
|
|
|
deploy: $(SOURCE) $(ROUTE_ASSET)
|
2018-03-13 16:25:18 -06:00
|
|
|
cd debian && make
|
2017-04-24 09:20:46 -06:00
|
|
|
|
2018-03-13 16:25:18 -06:00
|
|
|
.PHONEY: all clean deploy run setup
|