Skip to content

Commit

Permalink
Start adding more logic / error-checking to the versioned doc build
Browse files Browse the repository at this point in the history
I'm committing this in order to save my work, but I realized that I
don't want to go down this path: Instead, I'll use
https://github.com/ESMCI/versioned-doc-builder.

If I did go further with this makefile-based logic, my plan was:

- In the TODO, determine if the directory already exists; if not, abort

- Then I wanted to pull this block of logic out into a separate file
that could be included by this and other components' Makefiles.
  • Loading branch information
billsacks committed May 24, 2018
1 parent eb9e1d0 commit b290d0f
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions doc/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,21 @@ SPHINXPROJ = cismdoc
SOURCEDIR = source

ifndef BUILDDIR
# If version isn't set on the command-line, then we set it here, by
# getting the current git branch name.
VERSION ?= $(shell git symbolic-ref --short -q HEAD)
ifdef VERSION
VERSION_EXPLICIT = 1
else # ifdef VERSION
VERSION_EXPLICIT = 0
VERSION := $(shell git symbolic-ref --short -q HEAD)
ifeq ($(VERSION),)
$(error Cannot determine version based on git branch; set VERSION on the command line)
endif
endif # ifeq ($(VERSION),)
endif # ifdef VERSION
BUILDDIR = $(BUILDREPO)/cism-in-cesm/$(VERSION)
ifeq ($(VERSION_EXPLICIT),0)
# TODO: use a wildcard-based function here? see https://stackoverflow.com/questions/20763629/test-whether-a-directory-exists-inside-a-makefile (may want to test this first in a simple test makefile)
endif # ifeq ($(VERSION_EXPLICIT),0)
$(info Using build directory: $(BUILDDIR))
endif
endif # ifndef BUILDDIR

# Put it first so that "make" without argument is like "make help".
help:
Expand Down

0 comments on commit b290d0f

Please sign in to comment.