changeset 86:592ad4c25644

Fix deploy target.
author Oleksandr Gavenko <gavenkoa@gmail.com>
date Tue, 23 Aug 2016 23:02:03 +0300
parents 1d4f704e40ee
children d60814630989
files Makefile
diffstat 1 files changed, 37 insertions(+), 43 deletions(-) [+]
line wrap: on
line diff
--- a/Makefile	Tue Aug 23 23:01:02 2016 +0300
+++ b/Makefile	Tue Aug 23 23:02:03 2016 +0300
@@ -40,52 +40,45 @@
 ################################################################
 # Proj dirs/files.
 
+BUILD_DIR := _
+SITE_DIR := $(BUILD_DIR)/site
+
 RST_FILES := $(wildcard *.rst)
 
-HTML_DIR := tips-html
-RST_HTML_FILES := $(patsubst %.rst,$(HTML_DIR)/%.html,$(RST_FILES))
+RST_HTML_FILES := $(patsubst %.rst,$(SITE_DIR)/%.html,$(RST_FILES))
 HTML_FILES := $(RST_HTML_FILES)
 
-DIRS := $(HTML_DIR)
-
 ################################################################
 # Deploy targets.
 
-WWW_SRV_NAME := tips.defun.work
+WWW_SRV_NAME := cooking.defun.work
 WWW_SRV_USER := user
 HG_SRV_NAME := hg.defun.work
 HG_SRV_USER := user
-LOCAL_DIR := /srv/www/tips
+LOCAL_DIR := /srv/www/cooking
 
 ifneq '' '$(filter deploy%,$(MAKECMDGOALS))'
-  $(shell rm -f $(HTML_DIR)/rst.tmpl)
+  $(shell rm -f $(BUILD_DIR)/rst.tmpl)
 endif
 
-# For SEO reason I removed tips from SF.
 .PHONY: deploy
-deploy: deploy2defun-web deploy2defun-hg # deploy2sf-web deploy2sf-hg
+deploy: deploy2defun
 
-# Will be accessible via: http://tips.defun.work/
+.PHONY: deploy2defun
+deploy2defun: deploy2defun-web deploy2defun-hg
+
+# Will be accessible via: http://cooking.defun.work/
 .PHONY: deploy2defun-web
 deploy2defun-web: www
-	rsync --delete -avP -e ssh $(HTML_DIR)/ $(WWW_SRV_USER)@$(WWW_SRV_NAME):/srv/www/tips/
+	rsync --delete -avP -e ssh $(SITE_DIR)/ $(WWW_SRV_USER)@$(WWW_SRV_NAME):/srv/www/cooking/
 
 .PHONY: deploy2defun-hg
 deploy2defun-hg:
-	hg push ssh://$(HG_SRV_USER)@$(HG_SRV_NAME)//srv/hg/tips || [ $$? = 1 ]
-
-# Will be accessible via: http://gavenkoa.users.sourceforge.net/tips-html/
-.PHONY: deploy2sf-web
-deploy2sf-web: www
-	rsync --delete -avP -e ssh $(HTML_DIR)/ gavenkoa@frs.sourceforge.net:/home/user-web/g/ga/gavenkoa/htdocs/tips-html/
-
-.PHONY: deploy2sf-hg
-deploy2sf-hg:
-	hg push ssh://gavenkoa@hg.code.sf.net/u/gavenkoa/tips || [ $$? = 1 ]
+	hg push ssh://$(HG_SRV_USER)@$(HG_SRV_NAME)//srv/hg/cooking || [ $$? = 1 ]
 
 .PHONY: deploy2local
-deploy2local: html
-	rsync --delete -avP $(HTML_DIR)/ $(LOCAL_DIR)
+deploy2local: html | $(LOCAL_DIR)
+	rsync --delete -avP $(SITE_DIR)/ $(LOCAL_DIR)
 
 ################################################################
 # Build targets.
@@ -94,51 +87,51 @@
 all:
 
 .PHONY: www
-www: html $(HTML_DIR)/sitemap.xml $(HTML_DIR)/robots.txt
+www: html $(SITE_DIR)/sitemap.xml $(SITE_DIR)/robots.txt
 
 .PHONY: html
 html: $(HTML_FILES)
 
-$(HTML_DIR)/%.html: %.rst www/rst.css www/rst-multi.css $(HTML_DIR)/rst.tmpl $(MAKEFILE_LIST) | $(HTML_DIR)
-	$(RST2HTML) $(RST_FLAGS) --stylesheet=www/rst.css,www/rst-multi.css --template=$(HTML_DIR)/rst.tmpl $*.rst $@
+$(SITE_DIR)/%.html: %.rst www/rst.css www/rst-multi.css $(BUILD_DIR)/rst.tmpl $(MAKEFILE_LIST) | $(SITE_DIR)
+	$(RST2HTML) $(RST_FLAGS) --stylesheet=www/rst.css,www/rst-multi.css --template=$(BUILD_DIR)/rst.tmpl $*.rst $@
 
-$(HTML_DIR)/rst.tmpl: www/rst.tmpl $(MAKEFILE_LIST) | $(HTML_DIR)
+$(BUILD_DIR)/rst.tmpl: www/rst.tmpl $(MAKEFILE_LIST) | $(BUILD_DIR)
 	sed -e "s|{date}|$$(date +%F)|" -e "s|{rev}|$$(hg id -i)|"  <$< >$@
 
-.PHONY: single-html
-single-html: $(HTML_DIR)/single.html
+# .PHONY: single-html
+# single-html: $(HTML_DIR)/single.html
 
-$(HTML_DIR)/single.html: $(HTML_DIR)/single.rest www/rst.css www/rst-single.css $(RST_FILES)
-	$(RST2HTML) $(RST_FLAGS) --stylesheet=www/rst.css,www/rst-single.css $(HTML_DIR)/single.rest $@
+# $(HTML_DIR)/single.html: $(HTML_DIR)/single.rest www/rst.css www/rst-single.css $(RST_FILES)
+# 	$(RST2HTML) $(RST_FLAGS) --stylesheet=www/rst.css,www/rst-single.css $(HTML_DIR)/single.rest $@
 
-$(HTML_DIR)/single.rest: $(RST_FILES) $(MAKEFILE_LIST)
-	{ \
-echo ".. contents::"; \
-echo "   :local:"; \
-echo; \
-for f in *.rst; do echo ".. include:: ../$$f"; done; \
-} >$@
+# $(HTML_DIR)/single.rest: $(RST_FILES) $(MAKEFILE_LIST)
+# 	{ \
+# echo ".. contents::"; \
+# echo "   :local:"; \
+# echo; \
+# for f in *.rst; do echo ".. include:: ../$$f"; done; \
+# } >$@
 
-$(HTML_DIR)/sitemap.xml: $(RST_FILES) $(MAKEFILE_LIST) | $(HTML_DIR)
+$(SITE_DIR)/sitemap.xml: $(RST_FILES) $(MAKEFILE_LIST) | $(SITE_DIR)
 	{ \
 echo '<?xml version="1.0" encoding="UTF-8"?>'; \
 echo '<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">'; \
 for f in $(RST_FILES); do \
   echo '<url>'; \
   echo "  <loc>http://$(WWW_SRV_NAME)/$${f%.rst}.html</loc>"; \
-  echo '  <changefreq>weekly</changefreq>'; \
+  echo '  <changefreq>monthly</changefreq>'; \
   echo '</url>'; \
 done; \
 echo '</urlset>'; \
 } >$@
 
-$(HTML_DIR)/robots.txt: www/robots.txt $(MAKEFILE_LIST) | $(HTML_DIR)
+$(SITE_DIR)/robots.txt: www/robots.txt $(MAKEFILE_LIST) | $(SITE_DIR)
 	cp $< $@
 
 ################################################################
 # Init targets.
 
-$(DIRS):
+$(BUILD_DIR) $(SITE_DIR) $(LOCAL_DIR):
 	mkdir -p $@
 
 ################################################################
@@ -146,10 +139,11 @@
 
 .PHONY: distclean
 distclean: clean
+	rm -r -f $(LOCAL_DIR)
 
 .PHONY: clean
 clean:
-	rm -r -f $(DIRS)
+	rm -r -f $(BUILD_DIR)
 
 ################################################################
 # Helper target.