forked from usbarmory/armoryctl
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
31 lines (26 loc) · 888 Bytes
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
SHELL := /bin/bash
GO ?= go
BUILD_GOPATH = ${GOPATH}:$(CURDIR)
BUILD_USER ?= $(shell whoami)
BUILD_HOST ?= $(shell hostname)
BUILD_DATE ?= $(shell /bin/date -u "+%Y-%m-%d %H:%M:%S")
BUILD := ${BUILD_USER}@${BUILD_HOST} on ${BUILD_DATE}
REV := $(shell git rev-parse --short HEAD 2> /dev/null)
PKG = "github.com/usbarmory/armoryctl"
.PHONY: armoryctl test
all: armoryctl
# requires the following dependencies in $GOPATH
# honnef.co/go/tools/cmd/staticcheck
# github.com/kisielk/errcheck
check:
@${GO} vet ./...
@${GOPATH}/bin/staticcheck ./...
@${GOPATH}/bin/errcheck ./...
test:
@${GO} test ./...
armoryctl:
@GOPATH="${BUILD_GOPATH}" ${GO} build -v \
-gcflags=-trimpath=${CURDIR} -asmflags=-trimpath=${CURDIR} \
-ldflags "-s -w -X '${PKG}/internal.Revision=${REV}' -X '${PKG}/internal.Build=${BUILD}'" \
armoryctl.go
@echo -e "compiled armoryctl ${REV} (${BUILD})"