fleet/Makefile
Victor Vrantchan da05e360ac print version info (#164)
add version package and print version commands
make build now sets build info like git branch and revision when creating a binary.
2016-09-14 13:19:11 -04:00

73 lines
1.9 KiB
Makefile

.PHONY: build
all: build
.prefix:
ifeq ($(OS), Windows_NT)
if not exist build mkdir build
else
mkdir -p build
endif
ifeq ($(OS), Windows_NT)
OUTPUT = build/kolide.exe
else
OUTPUT = build/kolide
endif
VERSION = 0.0.0-development
BRANCH = $(shell git rev-parse --abbrev-ref HEAD)
REVISION = $(shell git rev-parse HEAD)
GOVERSION = $(shell go version | awk '{print $$3}')
NOW = $(shell date +"%Y%m%d-%T")
USER = $(shell whoami)
build: .prefix
go build -o ${OUTPUT} -ldflags "\
-X github.com/kolide/kolide-ose/version.version=${VERSION} \
-X github.com/kolide/kolide-ose/version.branch=${BRANCH} \
-X github.com/kolide/kolide-ose/version.revision=${REVISION} \
-X github.com/kolide/kolide-ose/version.buildDate=${NOW} \
-X github.com/kolide/kolide-ose/version.buildUser=${USER} \
-X github.com/kolide/kolide-ose/version.goVersion=${GOVERSION}"
lint-js:
$(shell npm bin)/eslint . --ext .js,.jsx
lint-go:
go vet $(shell glide nv)
lint: lint-go lint-js
test-go:
go test -v -cover $(shell glide nv)
test-js:
$(shell npm bin)/_mocha --compilers js:babel-core/register --recursive 'frontend/**/*.tests.js*' --require 'frontend/.test.setup.js'
test: lint test-go test-js
generate: .prefix
go-bindata -pkg=server -o=server/bindata.go frontend/templates/ assets/ assets/images/
$(shell npm bin)/webpack --progress --colors --bail
generate-dev: .prefix
go-bindata -debug -pkg=server -o=server/bindata.go frontend/templates/ assets/...
$(shell npm bin)/webpack --progress --colors --bail --watch
deps:
npm install
go get -u github.com/Masterminds/glide
go get -u github.com/jteeuwen/go-bindata/...
glide install
distclean:
rm -rf build/*
rm -rf assets/bundle.js
rm -rf vendor/*
docker:
docker pull kolide/kolide-builder:1.7
docker run --rm -it -v $(shell pwd):/go/src/github.com/kolide/kolide-ose -v ${GOPATH}/pkg:/go/pkg kolide/kolide-builder:1.7 -B
docker-compose up