forked from go-swagger/go-swagger
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile.variables
41 lines (35 loc) · 1.12 KB
/
Makefile.variables
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
nosudo = $(shell docker version > /dev/null 2>&1 && echo 1)
ifeq ($(nosudo),1)
DOCKER := docker
else
DOCKER := sudo docker
endif
export PROJECT = go-swagger
IMPORT_PATH := github.com/go-swagger/${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 :=
LDFLAGS += -X ${IMPORT_PATH}/cmd/swagger/commands.Commit=${GIT_COMMIT}
LDFLAGS += -X ${IMPORT_PATH}/cmd/swagger/commands.Version=${GIT_DESCRIBE}
# 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)
endif
DEV_IMAGE := ${PROJECT}_dev
DOCKRUN := docker run --rm \
-v ${ROOT}/vendor:/go/src \
-v ${ROOT}:/${PROJECT}/src/${IMPORT_PATH} \
-w /${PROJECT}/src/${IMPORT_PATH} \
${DEV_IMAGE}