PKGBUILD/Makefile
Markus Pesch b2bd4f8fe6
fix(Makefile): delete build container and container runtime
changes:
- delete build container after any container step
- define container runtime over variable
2019-06-16 23:39:34 +02:00

47 lines
1.2 KiB
Makefile

# 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.
UID?=$(shell id --user)
GID?=$(shell id --group)
# VERSION
# If no version is specified as a parameter of make, the last git hash
# value is taken.
VERSION:=$(or ${TRAVIS_TAG}, ${TRAVIS_TAG}, $(shell git rev-parse --short HEAD)-git)
CONTAINER_RUNTIME?=$(shell which docker)
GOARCH?=amd64
GOOS?=linux
# default build
build:
GOOS=${GOOS} \
GOARCH=${GOARCH} \
go build -ldflags "-X main.version=${VERSION}"
chown -R ${UID}:${GID} *
test: bindata
go test -v ./pkg/...
bindata:
go-bindata -pkg logfile -o ./pkg/logfile/bindata_test.go ./pkg/logfile/test
container-build:
$(MAKE) container-run COMMAND=build
container-test:
$(MAKE) container-run COMMAND=test
container-run:
${CONTAINER_RUNTIME} run \
--volume ${PWD}:/workspace \
--rm \
volkerraschek/build-image:latest\
make ${COMMAND} UID=${UID} GID=${GID} VERSION=${VERSION} GOOS=${GOOS} GOARCH=${GOARCH}
remote:
$(MAKE) build GOARCH=arm
scp flucky ${FLUCKY_REMOTE}:/usr/local/bin
ssh ${FLUCKY_REMOTE} "chmod +x /usr/local/bin/flucky"