2019-04-18 14:59:55 +00:00
|
|
|
# UID/GID
|
|
|
|
# UID or GID is the UNIX user ID or group ID of the user who executes
|
|
|
|
# make. If the UID or GID is not passed as a make variable, an attempt
|
|
|
|
# is made to determine it.
|
2019-05-12 09:57:53 +00:00
|
|
|
UID?=$(shell id --user)
|
|
|
|
GID?=$(shell id --group)
|
2019-04-18 14:59:55 +00:00
|
|
|
|
|
|
|
# VERSION
|
|
|
|
# If no version is specified as a parameter of make, the last git hash
|
|
|
|
# value is taken.
|
2019-04-18 15:10:03 +00:00
|
|
|
VERSION:=$(or ${TRAVIS_TAG}, ${TRAVIS_TAG}, $(shell git rev-parse --short HEAD)-git)
|
2018-11-07 19:07:15 +00:00
|
|
|
|
2019-04-18 15:10:03 +00:00
|
|
|
GOARCH?=amd64
|
|
|
|
GOOS?=linux
|
2019-04-18 14:59:55 +00:00
|
|
|
|
|
|
|
# default build
|
2019-04-18 15:10:03 +00:00
|
|
|
build:
|
|
|
|
GOOS=${GOOS} \
|
|
|
|
GOARCH=${GOARCH} \
|
|
|
|
go build -ldflags "-X main.version=${VERSION}"
|
2019-05-12 09:57:53 +00:00
|
|
|
chown -R ${UID}:${GID} *
|
2018-11-07 19:07:15 +00:00
|
|
|
|
2019-06-11 18:07:55 +00:00
|
|
|
container-build:
|
2019-04-18 15:10:03 +00:00
|
|
|
docker run \
|
|
|
|
--volume ${PWD}:/workspace \
|
|
|
|
volkerraschek/build-image:1.0.0 \
|
2019-05-12 09:57:53 +00:00
|
|
|
make build UID=${UID} GID=${GID} VERSION=${VERSION} GOOS=${GOOS} GOARCH=${GOARCH}
|
2019-06-11 18:07:55 +00:00
|
|
|
|
|
|
|
hades:
|
|
|
|
$(MAKE) build GOARCH=arm
|
|
|
|
scp flucky hades.hellenthal.cryptic.systems:/usr/local/bin
|
|
|
|
ssh hades.hellenthal.cryptic.systems "chmod +x /usr/local/bin/flucky"
|
|
|
|
|
|
|
|
poseidon:
|
|
|
|
$(MAKE) build GOARCH=arm
|
|
|
|
scp flucky poseidon.trier.cryptic.systems:/usr/local/bin
|
|
|
|
ssh poseidon.trier.cryptic.systems "chmod +x /usr/local/bin/flucky"
|