-
Notifications
You must be signed in to change notification settings - Fork 19
/
Makefile
48 lines (40 loc) · 1.42 KB
/
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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
SHELL := /bin/bash
GO ?= go
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/crucible"
.PHONY: clean test crucible habtool habtool.exe
all: test crucible habtool
# 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:
@cd fusemap && ${GO} test -cover
@cd hab && ${GO} test -cover
@cd otp && ${GO} test -cover *linux*.go
crucible:
${GO} build -v \
-trimpath -ldflags "-s -w -X 'main.Revision=${REV}' -X 'main.Build=${BUILD}'" \
./cmd/crucible
@echo -e "compiled crucible ${REV} (${BUILD})"
habtool:
${GO} build -v \
-trimpath -ldflags "-s -w -X 'main.Revision=${REV}' -X 'main.Build=${BUILD}'" \
./cmd/habtool
@echo -e "compiled habtool ${REV} (${BUILD})"
habtool.exe: BUILD_OPTS := GOOS=windows CGO_ENABLED=1 CXX=x86_64-w64-mingw32-g++ CC=x86_64-w64-mingw32-gcc
habtool.exe:
$(BUILD_OPTS) ${GO} build -v \
-trimpath -ldflags "-s -w -X 'main.Revision=${REV}' -X 'main.Build=${BUILD}'" \
-o $(CURDIR)/habtool.exe \
./cmd/habtool
@echo -e "compiled habtool ${REV} (${BUILD})"
clean:
@rm -fr $(CURDIR)/crucible $(CURDIR)/habtool $(CURDIR)/habtool.exe