Makefile
changeset 78 093ee7c2985f
parent 77 df763e1c3fe6
child 79 a0f224c26f08
equal deleted inserted replaced
77:df763e1c3fe6 78:093ee7c2985f
    52 DIRS := $(HTML_DIR)
    52 DIRS := $(HTML_DIR)
    53 
    53 
    54 ################################################################
    54 ################################################################
    55 # Deploy targets.
    55 # Deploy targets.
    56 
    56 
    57 WWW_SRV_NAME := defun.work
    57 WWW_SRV_NAME := tips.defun.work
    58 WWW_SRV_USER := user
    58 WWW_SRV_USER := user
    59 HG_SRV_NAME := hg.defun.work
    59 HG_SRV_NAME := hg.defun.work
    60 HG_SRV_USER := user
    60 HG_SRV_USER := user
    61 LOCAL_DIR := /srv/www/tips
    61 LOCAL_DIR := /srv/www/tips
    62 
    62 
    67 .PHONY: deploy
    67 .PHONY: deploy
    68 deploy: deploy2defun-web deploy2defun-hg deploy2sf-web deploy2sf-hg
    68 deploy: deploy2defun-web deploy2defun-hg deploy2sf-web deploy2sf-hg
    69 
    69 
    70 # Will be accessible via: http://tips.defun.work/
    70 # Will be accessible via: http://tips.defun.work/
    71 .PHONY: deploy2defun-web
    71 .PHONY: deploy2defun-web
    72 deploy2defun-web: html
    72 deploy2defun-web: www
    73 	rsync --delete -avP -e ssh $(HTML_DIR)/ $(WWW_SRV_USER)@$(WWW_SRV_NAME):/srv/www/tips/
    73 	rsync --delete -avP -e ssh $(HTML_DIR)/ $(WWW_SRV_USER)@$(WWW_SRV_NAME):/srv/www/tips/
    74 
    74 
    75 .PHONY: deploy2defun-hg
    75 .PHONY: deploy2defun-hg
    76 deploy2defun-hg:
    76 deploy2defun-hg:
    77 	hg push ssh://$(HG_SRV_USER)@$(HG_SRV_NAME)//srv/hg/tips || [ $$? = 1 ]
    77 	hg push ssh://$(HG_SRV_USER)@$(HG_SRV_NAME)//srv/hg/tips || [ $$? = 1 ]
    78 
    78 
    79 # Will be accessible via: http://gavenkoa.users.sourceforge.net/tips-html/
    79 # Will be accessible via: http://gavenkoa.users.sourceforge.net/tips-html/
    80 .PHONY: deploy2sf-web
    80 .PHONY: deploy2sf-web
    81 deploy2sf-web: html
    81 deploy2sf-web: www
    82 	rsync --delete -avP -e ssh $(HTML_DIR)/ gavenkoa@frs.sourceforge.net:/home/user-web/g/ga/gavenkoa/htdocs/tips-html/
    82 	rsync --delete -avP -e ssh $(HTML_DIR)/ gavenkoa@frs.sourceforge.net:/home/user-web/g/ga/gavenkoa/htdocs/tips-html/
    83 
    83 
    84 .PHONY: deploy2sf-hg
    84 .PHONY: deploy2sf-hg
    85 deploy2sf-hg:
    85 deploy2sf-hg:
    86 	hg push ssh://gavenkoa@hg.code.sf.net/u/gavenkoa/tips || [ $$? = 1 ]
    86 	hg push ssh://gavenkoa@hg.code.sf.net/u/gavenkoa/tips || [ $$? = 1 ]
    92 ################################################################
    92 ################################################################
    93 # Build targets.
    93 # Build targets.
    94 
    94 
    95 .PHONY: all
    95 .PHONY: all
    96 all:
    96 all:
       
    97 
       
    98 .PHONY: www
       
    99 www: html $(HTML_DIR)/sitemap.xml
    97 
   100 
    98 .PHONY: html
   101 .PHONY: html
    99 html: $(HTML_FILES)
   102 html: $(HTML_FILES)
   100 
   103 
   101 $(HTML_DIR)/%.html: %.rst rst.css rst-multi.css $(HTML_DIR)/rst.tmpl $(MAKEFILE_LIST) | $(HTML_DIR)
   104 $(HTML_DIR)/%.html: %.rst rst.css rst-multi.css $(HTML_DIR)/rst.tmpl $(MAKEFILE_LIST) | $(HTML_DIR)
   149 echo "   :local:"; \
   152 echo "   :local:"; \
   150 echo; \
   153 echo; \
   151 for f in *.rst; do echo ".. include:: ../$$f"; done; \
   154 for f in *.rst; do echo ".. include:: ../$$f"; done; \
   152 } >$@
   155 } >$@
   153 
   156 
       
   157 $(HTML_DIR)/sitemap.xml: $(RST_FILES) $(MAKEFILE_LIST)
       
   158 	{ \
       
   159 echo '<?xml version="1.0" encoding="UTF-8"?>'; \
       
   160 echo '<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">'; \
       
   161 for f in *.rst iframe; do \
       
   162   echo '<url>'; \
       
   163   echo "  <loc>http://$(WWW_SRV_NAME)/$${f%.rst}.html</loc>"; \
       
   164   echo '  <changefreq>weekly</changefreq>'; \
       
   165   echo '</url>'; \
       
   166 done; \
       
   167 echo '</urlset>'; \
       
   168 } >$@
       
   169 
   154 ################################################################
   170 ################################################################
   155 # Init targets.
   171 # Init targets.
   156 
   172 
   157 $(DIRS):
   173 $(DIRS):
   158 	mkdir -p $@
   174 	mkdir -p $@