-
Notifications
You must be signed in to change notification settings - Fork 23
/
Copy pathMakefile
48 lines (35 loc) · 1.18 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
GO_LINKER_SYMBOL := main.version
GO_BUILD_ENV := GOOS=linux GOARCH=amd64
all: test
test:
go test -v ./...
go test -v -race ./...
install: ldflags
go install -v ${LDFLAGS} ./...
update-deps: govendor
govendor add +ex
govendor:
go get -u github.com/kardianos/govendor
debs: tmp ldflags ver
$(eval DEB_ROOT := "${TMP}/DEBIAN")
${GO_BUILD_ENV} go build -v -o ${TMP}/usr/bin/log-shuttle ${LDFLAGS} ./cmd/log-shuttle
mkdir -p ${DEB_ROOT}
cat misc/DEBIAN.control | sed s/{{VERSION}}/${VERSION}/ > ${DEB_ROOT}/control
dpkg-deb -Zgzip -b ${TMP} log-shuttle_${VERSION}_amd64.deb
rm -rf ${TMP}
glv:
$(eval GO_LINKER_VALUE := $(shell git describe --tags --always))
ldflags: glv
$(eval LDFLAGS := -ldflags "-X ${GO_LINKER_SYMBOL}=${GO_LINKER_VALUE}")
ver: glv
$(eval VERSION := $(shell echo ${GO_LINKER_VALUE} | sed s/^v//))
docker: ldflags ver clean-docker-build
${GO_BUILD_ENV} go build -v -o .docker_build/log-shuttle ${LDFLAGS} ./cmd/log-shuttle
docker build -t heroku/log-shuttle:${VERSION} ./
${MAKE} clean-docker-build
clean-docker-build:
rm -rf .docker_build
docker-push: docker ver
docker push heroku/log-shuttle:${VERSION}
tmp:
$(eval TMP := $(shell mktemp -d -t log_shuttle.XXXXX))