# VERSION # If no version is specified as a parameter of make, the last git hash # value is taken. VERSION?=$(shell git describe --abbrev=0)+$(shell date +'%Y%m%d%H%I%S') # GOPROXY settings # If no GOPROXY environment variable available, the pre-defined GOPROXY from go # env to download and validate go modules is used. Exclude downloading and # validation of all private modules which are pre-defined in GOPRIVATE. If no # GOPRIVATE variable defined, the variable of go env is used. GOPROXY?=$(shell go env GOPROXY) GOPRIVATE?=$(shell go env GOPRIVATE) # CONTAINER_RUNTIME # The CONTAINER_RUNTIME variable will be used to specified the path to a # container runtime. This is needed to start and run a container images. CONTAINER_RUNTIME?=$(shell which docker) CONTAINER_IMAGE_VERSION?=latest # EXECUTABLE EXECUTABLE=set-sshkeys # BINARIES # ============================================================================== EXECUTABLE_TARGETS:= \ bin/linux/amd64/${EXECUTABLE} \ bin/linux/arm/5/${EXECUTABLE} \ bin/linux/arm/7/${EXECUTABLE} \ bin/tmp/${EXECUTABLE} ${EXECUTABLE}: bin/tmp/${EXECUTABLE} bin/linux/amd64/${EXECUTABLE}: GOOS=linux \ GOARCH=amd64 \ GOPROXY=${GOPROXY} \ GOPRIVATE=${GOPRIVATE} \ go build -ldflags "-X main.version=${VERSION:v%=%}" -o ${@} bin/linux/arm/5/${EXECUTABLE}: GOOS=linux \ GOARCH=arm \ GOARM=5 \ GOPROXY=${GOPROXY} \ GOPRIVATE=${GOPRIVATE} \ go build -ldflags "-X main.version=${VERSION:v%=%}" -o ${@} bin/linux/arm/7/${EXECUTABLE}: GOOS=linux \ GOARCH=arm \ GOARM=7 \ GOPROXY=${GOPROXY} \ GOPRIVATE=${GOPRIVATE} \ go build -ldflags "-X main.version=${VERSION:v%=%}" -o ${@} bin/tmp/${EXECUTABLE}: GOPROXY=${GOPROXY} \ GOPRIVATE=${GOPRIVATE} \ go build -ldflags "-X main.version=${VERSION:v%=%}" -o ${@} # CLEAN # ============================================================================== PHONY+=clean clean: -rm --force --recursive bin/ # PHONY # ============================================================================== # Declare the contents of the PHONY variable as phony. We keep that information # in a variable so we can use it in if_changed. .PHONY: ${PHONY}