Skip to content

Commit

Permalink
Updated common makefile
Browse files Browse the repository at this point in the history
  • Loading branch information
mrz1836 committed Oct 2, 2020
1 parent 42267ad commit fdb29dc
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion .make/Makefile.common
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,12 @@ ifndef GIT_DOMAIN
override GIT_DOMAIN=github.com
endif

## Set if defined (alias variable for ease of use)
ifdef branch
override REPO_BRANCH=$(branch)
export REPO_BRANCH
endif

## Do we have git available?
HAS_GIT := $(shell command -v git 2> /dev/null)

Expand All @@ -12,7 +18,8 @@ ifdef HAS_GIT
ifdef HAS_REPO
## Automatically detect the repo owner and repo name (for local use with Git)
REPO_NAME=$(shell basename "$(shell git rev-parse --show-toplevel 2> /dev/null)")
REPO_OWNER=$(shell git config --get remote.origin.url | sed 's/git@$(GIT_DOMAIN)://g' | sed 's/\/$(REPO_NAME).git//g')
OWNER=$(shell git config --get remote.origin.url | sed 's/git@$(GIT_DOMAIN)://g' | sed 's/\/$(REPO_NAME).git//g')
REPO_OWNER=$(shell echo $(OWNER) | tr A-Z a-z)
VERSION_SHORT=$(shell git describe --tags --always --abbrev=0)
export REPO_NAME, REPO_OWNER, VERSION_SHORT
endif
Expand Down

0 comments on commit fdb29dc

Please sign in to comment.