-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathMakefile
39 lines (29 loc) · 1.23 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
.EXPORT_ALL_VARIABLES:
VERSION = 0.2.0
BUILDDATE = $$(date)
LASTCOMMIT = $$(git rev-parse --short HEAD)
build: test compile upx
echo "Successfully built Sensible."
build-noupx: test compile
echo "Successfully built Sensible."
docker-example:
mkdir -p dist/docker-build/etc/sensible dist/docker-build/log
cp dist/sensible dist/docker-build/
cp -R examples/docker/* dist/docker-build
cp -R examples/scripts dist/docker-build/etc/sensible
$(SHELL) -c "cd dist/docker-build;docker build -t thetinkerdad/sensible-nginx-test .;cd -"
test:
go test
compile:
# go build -ldflags="-w" -o dist/sensible
CGO_ENABLED=0 GOOS=linux go build -ldflags="-w -X 'TheTinkerDad/sensible/releaseinfo.LastCommit=$(LASTCOMMIT)' -X 'TheTinkerDad/sensible/releaseinfo.BuildTime=$(BUILDDATE)' -X 'TheTinkerDad/sensible/releaseinfo.Version=$(VERSION)'" -a -installsuffix cgo -o dist/sensible
upx:
upx -9 dist/sensible
run:
$(SHELL) -c "cd dist;./sensible"
release-linux-amd64: build
$(SHELL) -c "cd dist;tar cvzf sensible-linux-amd64-$(VERSION).tar.gz sensible"
release-rpi-armhf: build
$(SHELL) -c "cd dist;tar cvzf sensible-rpi-armhf-$(VERSION).tar.gz sensible"
release-rpi-arm64: build
$(SHELL) -c "cd dist;tar cvzf sensible-rpi-arm64-$(VERSION).tar.gz sensible"