Fix clean and inject version
This commit is contained in:
parent
3aaa746f41
commit
bd7f364a3c
|
|
@ -1,20 +1,22 @@
|
||||||
PACKAGES=`find ./cmd -mindepth 1 -maxdepth 1 -type d`
|
PACKAGES=`find ./cmd -mindepth 1 -maxdepth 1 -type d`
|
||||||
BINARY=unifi-poller
|
BINARY=unifi-poller
|
||||||
|
VERSION=`git tag -l --merged | tail -n1`
|
||||||
|
|
||||||
all: clean man build
|
all: clean man build
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
for p in $(PACKAGES); do rm -f `echo $${p}|cut -d/ -f3`{,.1,.1.gz}; done
|
for p in $(PACKAGES); do rm -f `echo $${p}|cut -d/ -f3`{,.1,.1.gz}; done
|
||||||
rm -rf package_build unifi-poller_*.deb unifi-poller-*.rpm unifi-poller-*.pkg
|
rm -rf package_build unifi-poller_*.deb unifi-poller-*.rpm unifi-poller-*.pkg
|
||||||
|
rm -f unifi-poller.*.gz
|
||||||
|
|
||||||
build:
|
build:
|
||||||
for p in $(PACKAGES); do go build -ldflags "-w -s" $${p}; done
|
for p in $(PACKAGES); do go build -ldflags "-w -s -X main.Version=$(VERSION)" $${p}; done
|
||||||
|
|
||||||
linux:
|
linux:
|
||||||
for p in $(PACKAGES); do GOOS=linux go build -ldflags "-w -s" $${p}; done
|
for p in $(PACKAGES); do GOOS=linux go build -ldflags "-w -s -X main.Version=$(VERSION)" $${p}; done
|
||||||
|
|
||||||
darwin:
|
darwin:
|
||||||
for p in $(PACKAGES); do GOOS=darwin go build -ldflags "-w -s" $${p}; done
|
for p in $(PACKAGES); do GOOS=darwin go build -ldflags "-w -s -X main.Version=$(VERSION)" $${p}; done
|
||||||
|
|
||||||
test: lint
|
test: lint
|
||||||
for p in $(PACKAGES) $(LIBRARYS); do go test -race -covermode=atomic $${p}; done
|
for p in $(PACKAGES) $(LIBRARYS); do go test -race -covermode=atomic $${p}; done
|
||||||
|
|
|
||||||
|
|
@ -2,8 +2,8 @@ package main
|
||||||
|
|
||||||
import "time"
|
import "time"
|
||||||
|
|
||||||
// Version is loosely followed.
|
// Version is injected by the Makefile
|
||||||
var Version = "v1.1.1"
|
var Version = "development"
|
||||||
|
|
||||||
const (
|
const (
|
||||||
// App defaults in case they're missing from the config.
|
// App defaults in case they're missing from the config.
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue