This repository has been archived by the owner on Oct 13, 2021. It is now read-only.
/
Makefile
55 lines (44 loc) · 2.11 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
49
50
51
52
53
54
55
.PHONY: build build-fs clean test help default
BIN_NAME=paladin
VERSION := $(shell grep "const Version " version/version.go | sed -E 's/.*"(.+)"$$/\1/')
GIT_COMMIT=$(shell git rev-parse HEAD)
GIT_DIRTY=$(shell test -n "`git status --porcelain`" && echo "+CHANGES" || true)
BUILD_DATE=$(shell date '+%Y-%m-%d-%H:%M:%S')
default: clean build-fs build
help:
@echo 'Management commands for paladin:'
@echo
@echo 'Usage:'
@echo ' make build Compile the project.'
@echo ' make build-fs Build atomic red team static fs.'
@echo ' make build-all Build all envs.'
@echo ' make get-deps runs dep ensure, mostly used for ci.'
@echo ' make test-release Test release with goreleaser
@echo ' make clean Clean the directory tree.'
@echo
clean:
rm -rf art/
rm -rf statik/
rm -rf dist/
@test ! -e bin/${BIN_NAME} || rm bin/${BIN_NAME}
build:
@echo "building ${BIN_NAME} ${VERSION}"
@echo "GOPATH=${GOPATH}"
go build -ldflags "-X github.com/Zeerg/paladin/version.GitCommit=${GIT_COMMIT}${GIT_DIRTY} -X github.com/Zeerg/paladin/version.BuildDate=${BUILD_DATE}" -o bin/${BIN_NAME}
build-all:
@echo "building ${BIN_NAME} ${VERSION}"
@echo "GOPATH=${GOPATH}"
GOOS=linux GOARCH=amd64 go build -ldflags "-X github.com/Zeerg/paladin/version.GitCommit=${GIT_COMMIT}${GIT_DIRTY} -X github.com/Zeerg/paladin/version.BuildDate=${BUILD_DATE}" -o bin/linux/${BIN_NAME}
GOOS=darwin GOARCH=amd64 go build -ldflags "-X github.com/Zeerg/paladin/version.GitCommit=${GIT_COMMIT}${GIT_DIRTY} -X github.com/Zeerg/paladin/version.BuildDate=${BUILD_DATE}" -o bin/darwin/${BIN_NAME}
GOOS=windows GOARCH=amd64 go build -ldflags "-X github.com/Zeerg/paladin/version.GitCommit=${GIT_COMMIT}${GIT_DIRTY} -X github.com/Zeerg/paladin/version.BuildDate=${BUILD_DATE}" -o bin/windows/${BIN_NAME}
build-fs:
@echo "building Atomic Red Team Static FS"
git clone https://github.com/redcanaryco/atomic-red-team.git art
~/go/bin/statik -include=*.yaml -src=art/atomics
get-deps:
dep ensure
test:
go test ./...
test-release:
export VERSION=${VERSION}
/usr/local/bin/goreleaser --snapshot --skip-publish --rm-dist