Improve make targets

This commit is contained in:
Darko Poljak 2019-04-25 12:01:42 +02:00
parent cdcab934fc
commit db2cd88660

View file

@ -16,18 +16,19 @@ CDIST_MAKE_VERSION=make -C "$(CDIST_DIR)" version
CDIST_MAKE_HTML=make -C "$(CDIST_DIR)" html
CDIST_CLEAN_HTML=make -C "$(CDIST_DOCS_DIR)/src" clean
SPHINXW=make -C $(WEBSITE_SRC_DIR) html
SPHINXWC=make -C $(WEBSITE_SRC_DIR) clean
SPHINXH=make -C $(WEBSITE_SRC_DIR) html
SPHINXC=make -C $(WEBSITE_SRC_DIR) clean
.PHONY: help
help:
@echo "Please use \`make <target>' where <target> is one of"
@echo " website"
@echo " website-no-latest"
@echo " website-publish"
@echo " website-publish-no-latest"
@echo " website-publish-only"
@echo " clean"
@echo " build only build static web"
@echo " publish only publish built web"
@echo " release update web with latest cdist release and build static web"
@echo " release-publish do release and then publish"
@echo " release-no-latest update web without latest cdist release and build static web"
@echo " release-publish-no-latest do release-no-latest and then publish"
@echo " clean clean generated files"
################################################################################
@ -40,24 +41,25 @@ help:
# Copy target version manual directory to website.
# Add latest manual page.
# Update latest manual link.
website-prepare:
release-prepare:
$(CDIST_MAKE_VERSION)
$(CDIST_MAKE_HTML)
@awk '/^[0-9a-z.]+: [0-9-]+$$/ { print; for(i = 0; i < length; ++i) { printf "~"; }; printf "\n"; next; } { print; }' "$(CDIST_CHANGELOG_FILE)" > "$(WEBSITE_SRC_DIR)/cdist-changelog.rst"
@mkdir -p "$(WEBSITE_MANUALS_DIR)/$(CDIST_CHANGELOG_VERSION)/"
@rsync -a "$(CDIST_DOCS_HTML_DIST_DIR)/" "$(WEBSITE_MANUALS_DIR)/$(CDIST_CHANGELOG_VERSION)/"
website-prepare-latest: website-prepare
release-prepare-latest: release-prepare
@grep '$(CDIST_CHANGELOG_VERSION)' "$(WEBSITE_MAN_PAGE)" || awk 'FNR == 11 { print "* `$(CDIST_CHANGELOG_VERSION) <manuals/$(CDIST_CHANGELOG_VERSION)>`_"; print; next; } /^\* `Latest manual/ { print "* `Latest manual <manuals/$(CDIST_CHANGELOG_VERSION)>`_"; next; } { print; }' "$(WEBSITE_MAN_PAGE)" > "$(WEBSITE_MAN_PAGE)-new" && mv "$(WEBSITE_MAN_PAGE)-new" "$(WEBSITE_MAN_PAGE)" || exit 0
# Build website.
website: website-prepare-latest
$(SPHINXW)
build:
$(SPHINXH)
website-no-latest: website-prepare
$(SPHINXW)
release: release-prepare-latest build
website-publish-only:
release-no-latest: release-prepare build
publish:
@cd "$(WEBSITE_HTML_DIST_DIR)" \
&& tar -c -z -f "../$(WEBSITE_ARCHIVE)" . \
&& scp "../$(WEBSITE_ARCHIVE)" "$(WEBSITE_REMOTE_HOST):$(WEBSITE_REMOTE_DIR)" \
@ -65,10 +67,10 @@ website-publish-only:
@ssh "$(WEBSITE_REMOTE_HOST)" "cd $(WEBSITE_REMOTE_DIR) && tar -x -f $(WEBSITE_ARCHIVE) && rm -f $(WEBSITE_ARCHIVE)"
# Publish static website
website-publish: website website-publish-only
release-publish: release publish
website-publish-no-latest: website-no-latest website-publish-only
release-publish-no-latest: release-no-latest publish
clean:
$(CDIST_CLEAN_HTML)
$(SPHINXWC)
$(SPHINXC)