2017-12-17 22:11:08 +00:00
|
|
|
export PROJECT = yq
|
2017-09-20 23:40:33 +00:00
|
|
|
IMPORT_PATH := github.com/mikefarah/${PROJECT}
|
|
|
|
|
|
|
|
export GIT_COMMIT = $(shell git rev-parse --short HEAD)
|
|
|
|
export GIT_DIRTY = $(shell test -n "$$(git status --porcelain)" && echo "+CHANGES" || true)
|
|
|
|
export GIT_DESCRIBE = $(shell git describe --tags --always)
|
|
|
|
LDFLAGS :=
|
2017-09-23 04:45:31 +00:00
|
|
|
LDFLAGS += -X main.GitCommit=${GIT_COMMIT}${GIT_DIRTY}
|
|
|
|
LDFLAGS += -X main.GitDescribe=${GIT_DESCRIBE}
|
2023-03-16 02:36:51 +00:00
|
|
|
LDFLAGS += -w -s
|
2017-09-20 23:40:33 +00:00
|
|
|
|
2017-09-25 01:10:57 +00:00
|
|
|
GITHUB_TOKEN ?=
|
|
|
|
|
2017-09-20 23:40:33 +00:00
|
|
|
# Windows environment?
|
|
|
|
CYG_CHECK := $(shell hash cygpath 2>/dev/null && echo 1)
|
|
|
|
ifeq ($(CYG_CHECK),1)
|
|
|
|
VBOX_CHECK := $(shell hash VBoxManage 2>/dev/null && echo 1)
|
|
|
|
|
|
|
|
# Docker Toolbox (pre-Windows 10)
|
|
|
|
ifeq ($(VBOX_CHECK),1)
|
|
|
|
ROOT := /${PROJECT}
|
|
|
|
else
|
|
|
|
# Docker Windows
|
|
|
|
ROOT := $(shell cygpath -m -a "$(shell pwd)")
|
|
|
|
endif
|
|
|
|
else
|
|
|
|
# all non-windows environments
|
|
|
|
ROOT := $(shell pwd)
|
2024-04-14 08:51:17 +00:00
|
|
|
SELINUX := $(shell which getenforce 2>&1 >/dev/null && echo :z)
|
2017-09-20 23:40:33 +00:00
|
|
|
endif
|
|
|
|
|
|
|
|
DEV_IMAGE := ${PROJECT}_dev
|
|
|
|
|
2021-12-01 23:01:44 +00:00
|
|
|
ENGINERUN := ${ENGINE} run --rm \
|
2017-09-23 04:45:31 +00:00
|
|
|
-e LDFLAGS="${LDFLAGS}" \
|
2017-09-25 01:10:57 +00:00
|
|
|
-e GITHUB_TOKEN="${GITHUB_TOKEN}" \
|
2024-04-14 08:51:17 +00:00
|
|
|
-v ${ROOT}/vendor:/go/src${SELINUX} \
|
|
|
|
-v ${ROOT}:/${PROJECT}/src/${IMPORT_PATH}${SELINUX} \
|
2017-09-20 23:40:33 +00:00
|
|
|
-w /${PROJECT}/src/${IMPORT_PATH} \
|
|
|
|
${DEV_IMAGE}
|