The "make" commands and filenames below are run in/relative to the documentation directory. 1. Between releases, EPICS_DEV_SNAPSHOT != "": "make" generates $(COMMON_DIR)/RELEASE_NOTES.md from new-notes/*.md and installs it and all the older RELEASE-<ver>.md files into the $(INSTALL_DOC) directory. "make release" or "make unrelease" fail with an error message: "make release" not available, EPICS_DEV_SNAPSHOT not empty 2. Creating a release, so EPICS_DEV_SNAPSHOT == "": "make" installs all existing RELEASE-<ver>.md files into $(INSTALL_DOC). 3. Creating a release, EPICS_DEV_SNAPSHOT == "", no file exists named RELEASE-<ver>.md: "make release" generates RELEASE-<ver>.md from new-notes/*.md and does "git add" of that; runs "git rm" of new-notes/*.md; generates $(COMMON_DIR)/RELEASE_NOTES.md with a different introduction; Installs all RELEASE*.md files into $(INSTALL_DOC). 4. EPICS_DEV_SNAPSHOT == "", RELEASE-<ver>.md exists and was added to the Git index: "make unrelease" here undoes the changes the "make release" command applied to the Git index and restores the deleted new-notes files. Running "make release" twice in a row could mess up the first generated RELEASE-<ver>.md file if any new-notes/*.md files were added or the make-notes.pl script modified between the two, but to recover just running "make unrelease" and then "make release" again. 4. EPICS_DEV_SNAPSHOT == "", RELEASE-<ver>.md was added to Git but the file has since been deleted: "make unrelease" here will also recover the state and restore any deleted new-notes/*.md files. 5. EPICS_DEV_SNAPSHOT == "", RELEASE-<ver>.md exists but was not added to the Git index: "make release" or "make unrelease" fail with an error message: "make release" not available, RELEASE-<ver>.md exists but isn't in Git
127 lines
3.3 KiB
Makefile
127 lines
3.3 KiB
Makefile
TOP = ..
|
|
include $(TOP)/configure/CONFIG
|
|
|
|
EXPAND = Doxyfile@
|
|
EXPAND_ME += EPICS_VERSION
|
|
EXPAND_ME += EPICS_REVISION
|
|
EXPAND_ME += EPICS_MODIFICATION
|
|
EXPAND_ME += EPICS_PATCH_LEVEL
|
|
EXPAND_ME += OS_CLASS CMPLR_CLASS
|
|
EXPAND_ME += RTD_SRC
|
|
|
|
DOXYGEN ?= doxygen
|
|
|
|
include $(TOP)/documentation/Makefile.headers
|
|
|
|
HEADER_MD_FILES = $(foreach t, $(HEADER_TYPES), \
|
|
$(addsuffix _h.md, $($t_HEADERS)))
|
|
API_RST_FILES = $(addsuffix -api.rst, $(HEADER_TYPES))
|
|
|
|
RTD_SRC = $(COMMON_DIR)/rtd-src
|
|
|
|
DOCS += README.md
|
|
DOCS += ca-cli.md
|
|
|
|
OLD_NOTES = $(wildcard ../RELEASE-*.md)
|
|
DOCS += $(OLD_NOTES:../%=%)
|
|
|
|
ifneq ($(EPICS_DEV_SNAPSHOT),)
|
|
# Between releases the release target is disabled
|
|
DOCS += RELEASE_NOTES.md
|
|
REASON = EPICS_DEV_SNAPSHOT not empty
|
|
else
|
|
# Not a snapshot, user may be creating a new release
|
|
ifdef T_A
|
|
DOC = ../
|
|
endif
|
|
# Could we be in the middle of anything?
|
|
NOTES_FILE = RELEASE-$(EPICS_SHORT_VERSION).md
|
|
NOTES_PATH = $(DOC)$(NOTES_FILE)
|
|
NOTES_GIT := $(firstword $(shell git status --porcelain $(NOTES_PATH)))
|
|
ifeq ($(NOTES_GIT),A)
|
|
# New file was added to the Git index; allow unrelease
|
|
else ifeq ($(NOTES_GIT),AD)
|
|
# File was added to the Git index but deleted; allow unrelease
|
|
else ifeq ($(wildcard $(NOTES_PATH)),)
|
|
# No file yet, allow release
|
|
else
|
|
# File exists but isn't in Git
|
|
REASON := $(NOTES_FILE) exists but isn't in Git
|
|
NOTES_FILE =
|
|
NOTES_PATH =
|
|
endif
|
|
endif
|
|
|
|
NEW_DIR = ../new-notes
|
|
NEW_NOTES = $(wildcard $(NEW_DIR)/*.md)
|
|
|
|
include $(TOP)/configure/RULES
|
|
|
|
ifndef T_A
|
|
release unrelease doxygen rtd sphinx: inc
|
|
$(MAKE) -C O.$(EPICS_HOST_ARCH) $@
|
|
else
|
|
|
|
MAKENOTES = ../make-notes.pl
|
|
|
|
ifneq ($(NOTES_PATH),)
|
|
$(NOTES_PATH): $(NEW_NOTES) $(MAKENOTES)
|
|
@$(RM) $@
|
|
$(PERL) $(MAKENOTES) -o $@ -V $(EPICS_SHORT_VERSION) \
|
|
-d $(abspath $(NEW_DIR))
|
|
release-git: $(NOTES_PATH)
|
|
$(if $(NEW_NOTES), \
|
|
git rm -q $(NEW_NOTES))
|
|
git add $<
|
|
release: $(INSTALL_DOC)/RELEASE_NOTES.md $(INSTALL_DOC)/$(NOTES_FILE)
|
|
|
|
unrelease:
|
|
$(if $(wildcard $(NOTES_PATH)), \
|
|
git restore --staged $(NOTES_PATH); \
|
|
$(RM) $(NOTES_PATH))
|
|
git restore --staged $(NEW_DIR)
|
|
git restore $(NEW_DIR)
|
|
|
|
REL_DEP = release-git $(NOTES_PATH)
|
|
else
|
|
REL_DEV = -D
|
|
release unrelease:
|
|
$(error "make $@" not available, $(REASON))
|
|
endif
|
|
|
|
$(COMMON_DIR)/RELEASE_NOTES.md: $(REL_DEP) $(NEW_NOTES) $(MAKENOTES)
|
|
@$(RM) $@
|
|
$(PERL) $(MAKENOTES) -o $@ -V $(EPICS_SHORT_VERSION) $(REL_DEV) \
|
|
-d $(abspath $(NEW_DIR)) $(OLD_NOTES) $(NOTES_PATH)
|
|
|
|
$(HEADER_MD_FILES): %_h.md: ../HEADER_h.md
|
|
$(EXPAND_TOOL) -t $(INSTALL_LOCATION) -DHEADER=$* $< $@
|
|
|
|
$(API_RST_FILES): %-api.rst: ../%-API.rst
|
|
@$(RM) $@
|
|
@$(ECHO) Creating $@
|
|
@$(CP) $< $@
|
|
@$(foreach h, $($*_HEADERS), \
|
|
echo " $h_h.rst" >> $@;)
|
|
|
|
doxygen: Doxyfile
|
|
@$(MKDIR) $(RTD_SRC)
|
|
$(DOXYGEN)
|
|
DOX = doxygen
|
|
|
|
# Use "make sphinx DOX=" to skip running doxygen
|
|
rtd: $(DOX) $(API_RST_FILES) $(HEADER_MD_FILES)
|
|
rsync -av --exclude=RELEASE-*.md $(INSTALL_DOC)/ $(RTD_SRC)/
|
|
rsync -av $(HEADER_MD_FILES) $(RTD_SRC)/
|
|
rsync -av $(API_RST_FILES) $(RTD_SRC)/
|
|
rsync -av ../index.rst ../conf.py $(RTD_SRC)/
|
|
RTD = rtd
|
|
|
|
# Use "make sphinx RTD=" to skip earlier steps
|
|
sphinx: $(RTD)
|
|
cd $(COMMON_DIR); $(PYTHON) -m sphinx rtd-src readthedocs
|
|
rsync -av $(COMMON_DIR)/readthedocs $(INSTALL_HTML)/
|
|
endif
|
|
|
|
.PHONY: release release-git unrelease doxygen rtd sphinx
|