Skip to content

Commit

Permalink
Allow Makefile variables to be set from the command line (#1501)
Browse files Browse the repository at this point in the history
This changes the assignment operator of various Makefile variables from
the recursive expansion operator (=) to the conditional assignment
operator (?=), such that a developer can define their own values for
those variables. This is highly valuable for a dev who wants to do local
development with a local docker image
  • Loading branch information
ian-howell authored and jessesuen committed Jul 31, 2019
1 parent e62be65 commit f62105e
Showing 1 changed file with 15 additions and 15 deletions.
30 changes: 15 additions & 15 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
PACKAGE=github.com/argoproj/argo
CURRENT_DIR=$(shell pwd)
DIST_DIR=${CURRENT_DIR}/dist
ARGO_CLI_NAME=argo
PACKAGE = github.com/argoproj/argo
CURRENT_DIR = $(shell pwd)
DIST_DIR = ${CURRENT_DIR}/dist
ARGO_CLI_NAME = argo

VERSION=$(shell cat ${CURRENT_DIR}/VERSION)
BUILD_DATE=$(shell date -u +'%Y-%m-%dT%H:%M:%SZ')
GIT_COMMIT=$(shell git rev-parse HEAD)
GIT_TAG=$(shell if [ -z "`git status --porcelain`" ]; then git describe --exact-match --tags HEAD 2>/dev/null; fi)
GIT_TREE_STATE=$(shell if [ -z "`git status --porcelain`" ]; then echo "clean" ; else echo "dirty"; fi)
VERSION = $(shell cat ${CURRENT_DIR}/VERSION)
BUILD_DATE = $(shell date -u +'%Y-%m-%dT%H:%M:%SZ')
GIT_COMMIT = $(shell git rev-parse HEAD)
GIT_TAG = $(shell if [ -z "`git status --porcelain`" ]; then git describe --exact-match --tags HEAD 2>/dev/null; fi)
GIT_TREE_STATE = $(shell if [ -z "`git status --porcelain`" ]; then echo "clean" ; else echo "dirty"; fi)

# docker image publishing options
DOCKER_PUSH=false
IMAGE_TAG=latest
DOCKER_PUSH ?= false
IMAGE_TAG ?= latest
# perform static compilation
STATIC_BUILD=true
STATIC_BUILD ?= true
# build development images
DEV_IMAGE=false
DEV_IMAGE ?= false

GOLANGCI_EXISTS := $(shell command -v golangci-lint 2> /dev/null)

Expand All @@ -30,7 +30,7 @@ override LDFLAGS += -extldflags "-static"
endif

ifneq (${GIT_TAG},)
IMAGE_TAG=${GIT_TAG}
IMAGE_TAG = ${GIT_TAG}
override LDFLAGS += -X ${PACKAGE}.gitTag=${GIT_TAG}
endif

Expand All @@ -41,7 +41,7 @@ endif
endif

ifdef IMAGE_NAMESPACE
IMAGE_PREFIX=${IMAGE_NAMESPACE}/
IMAGE_PREFIX = ${IMAGE_NAMESPACE}/
endif

# Build the project
Expand Down

0 comments on commit f62105e

Please sign in to comment.