2018-03-14 07:18:19 -06:00
|
|
|
ROUTE_ASSET=src/routes/bindata.go
|
|
|
|
DOCS_ASSET=src/docs/bindata.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))
|
2017-04-24 09:20:46 -06:00
|
|
|
BINARY=paste
|
2020-09-07 10:45:20 -06:00
|
|
|
PKG=./cmd/paste
|
2017-04-24 09:20:46 -06:00
|
|
|
|
2020-09-07 10:45:20 -06:00
|
|
|
VERSION=$(shell git describe --tags `git rev-list --tags --max-count=1`|cut -b2-)
|
|
|
|
VERSION_PAT=$(shell debian/inc_version.sh -p $(VERSION))
|
|
|
|
VERSION_MIN=$(shell debian/inc_version.sh -m $(VERSION))
|
|
|
|
VERSION_MAJ=$(shell debian/inc_version.sh -M $(VERSION))
|
2020-08-28 17:23:12 -06:00
|
|
|
DATE:=$(shell date -u +%FT%TZ)
|
|
|
|
|
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:
|
2020-08-17 12:23:38 -06:00
|
|
|
rm -rf $(BINARY)
|
2017-04-24 09:20:46 -06:00
|
|
|
|
2018-03-13 16:25:18 -06:00
|
|
|
setup:
|
2020-08-17 09:46:19 -06:00
|
|
|
go mod download
|
2018-03-15 11:13:59 -06:00
|
|
|
fmt:
|
|
|
|
go fmt ./...
|
2020-08-17 11:11:12 -06:00
|
|
|
test: $(ROUTE_ASSET) $(DOCS_ASSET)
|
2020-08-17 09:40:10 -06:00
|
|
|
go test ./...
|
|
|
|
go vet ./...
|
2020-10-17 10:32:03 -06:00
|
|
|
run:
|
2020-09-07 10:45:20 -06:00
|
|
|
go run \
|
|
|
|
-ldflags "-X main.AppVersion=$(VERSION_PAT) -X main.AppBuild=$(DATE)" \
|
|
|
|
$(PKG) -vv serve
|
2017-05-22 11:13:47 -06:00
|
|
|
|
2020-08-17 09:47:57 -06:00
|
|
|
$(BINARY): $(SOURCE) $(ROUTE_ASSET) $(DOCS_ASSET)
|
2020-09-04 17:18:58 -06:00
|
|
|
go build -v \
|
2020-08-28 17:23:12 -06:00
|
|
|
-ldflags "-X main.AppVersion=$(VERSION) -X main.AppBuild=$(DATE)" \
|
2023-10-15 14:27:15 -06:00
|
|
|
"go.sour.is/paste/cmd/paste"
|
2020-08-28 16:50:27 -06:00
|
|
|
|
|
|
|
clean-ui:
|
|
|
|
rm -rf $(ROUTE_ASSET) $(DOCS_ASSET)
|
|
|
|
build-ui: clean-ui $(ROUTE_ASSET) $(DOCS_ASSET)
|
2020-08-17 12:23:38 -06:00
|
|
|
$(ROUTE_ASSET):
|
2017-04-24 09:20:46 -06:00
|
|
|
cd assets; \
|
2018-03-13 16:25:18 -06:00
|
|
|
rm -rf build ../public; \
|
2020-08-17 12:23:38 -06:00
|
|
|
npm i; npm run build; \
|
2018-03-14 07:18:19 -06:00
|
|
|
cp -r build ../public
|
2023-10-15 14:27:15 -06:00
|
|
|
go generate "go.sour.is/paste/src/routes"
|
2018-03-14 07:18:19 -06:00
|
|
|
|
2020-08-17 12:23:38 -06:00
|
|
|
$(DOCS_ASSET):
|
2018-03-14 07:18:19 -06:00
|
|
|
echo "$$DUMMY_BINDATA" > src/docs/bindata.go
|
2023-10-15 14:27:15 -06:00
|
|
|
go generate "go.sour.is/paste/cmd/paste"
|
|
|
|
go generate "go.sour.is/paste/src/docs"
|
2020-09-07 10:45:20 -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
|
|
|
|
2020-08-17 09:40:10 -06:00
|
|
|
.PHONEY: all clean build deploy run setup
|
2019-09-06 15:08:50 -06:00
|
|
|
# DO NOT DELETE
|