Browse Source

Makefile: optionally switch to a specific git branch

* mk/default.mk (GIT_BRANCH): New configuration variable to specify a
  Git branch that is checked out before updating.

* mk/targets.mk (up0 up1 up2): Check out the branch in GIT_BRANCH
  before doing an update.  Stays on the current branch if GIT_BRANCH
  is undefined or empty.
Achim Gratz 7 years ago
parent
commit
01b42f91de
2 changed files with 5 additions and 0 deletions
  1. 4 0
      mk/default.mk
  2. 1 0
      mk/targets.mk

+ 4 - 0
mk/default.mk

@@ -22,6 +22,10 @@ infodir = $(prefix)/info
 # Define if you only need info documentation, the default includes html and pdf
 #ORG_MAKE_DOC = info # html pdf
 
+# Define which git branch to switch to during update.  Does not switch
+# the branch when undefined.
+GIT_BRANCH =
+
 # Define if you want to include some (or all) files from contrib/lisp
 # just the filename please (no path prefix, no .el suffix), maybe with globbing
 #ORG_ADD_CONTRIB = ox-* # e.g. the contributed exporter

+ 1 - 0
mk/targets.mk

@@ -108,6 +108,7 @@ endif
 
 up0::	cleanaddcontrib
 up0 up1 up2::
+	git checkout $(GIT_BRANCH)
 	git remote update
 	git pull
 up1 up2::	all