Makefile
changeset 65 6e28048f3e74
parent 64 e1866d4fdbad
child 66 edb06d57511f
equal deleted inserted replaced
64:e1866d4fdbad 65:6e28048f3e74
    44 TXT_FILES := $(wildcard *.txt)
    44 TXT_FILES := $(wildcard *.txt)
    45 
    45 
    46 HTML_DIR := tips-html
    46 HTML_DIR := tips-html
    47 RST_HTML_FILES := $(patsubst %.rst,$(HTML_DIR)/%.html,$(RST_FILES))
    47 RST_HTML_FILES := $(patsubst %.rst,$(HTML_DIR)/%.html,$(RST_FILES))
    48 HTML_FILES := $(RST_HTML_FILES) \
    48 HTML_FILES := $(RST_HTML_FILES) \
    49         $(HTML_DIR)/index.html $(HTML_DIR)/iframe.html $(HTML_DIR)/frame.html $(HTML_DIR)/frame-index.html
    49         $(HTML_DIR)/index.html $(HTML_DIR)/iframe.html
    50 TXT__FILES := $(addprefix $(HTML_DIR)/,$(TXT_FILES))
    50 TXT__FILES := $(addprefix $(HTML_DIR)/,$(TXT_FILES))
    51 
    51 
    52 CHM_FILES := $(addprefix $(HTML_DIR)/,chm.hhp chm.hhc chm.stp)
    52 CHM_FILES := $(addprefix $(HTML_DIR)/,chm.hhp chm.hhc chm.stp)
    53 
    53 
    54 DIRS := $(HTML_DIR)
    54 DIRS := $(HTML_DIR)
    66 endif
    66 endif
    67 
    67 
    68 .PHONY: deploy
    68 .PHONY: deploy
    69 deploy: deploy2defun-web deploy2defun-hg deploy2sf-web deploy2sf-hg
    69 deploy: deploy2defun-web deploy2defun-hg deploy2sf-web deploy2sf-hg
    70 
    70 
    71 # Will be accessible via: http://tips.defun.work/frame.html
    71 # Will be accessible via: http://tips.defun.work/
    72 .PHONY: deploy2defun-web
    72 .PHONY: deploy2defun-web
    73 deploy2defun-web: html
    73 deploy2defun-web: html
    74 	rsync --delete -avP -e ssh tips-html/ $(WWW_SRV_USER)@$(WWW_SRV_NAME):/srv/www/tips/
    74 	rsync --delete -avP -e ssh tips-html/ $(WWW_SRV_USER)@$(WWW_SRV_NAME):/srv/www/tips/
    75 
    75 
    76 .PHONY: deploy2defun-hg
    76 .PHONY: deploy2defun-hg
    77 deploy2defun-hg:
    77 deploy2defun-hg:
    78 	hg push ssh://$(HG_SRV_USER)@$(HG_SRV_NAME)//srv/hg/tips || [ $$? = 1 ]
    78 	hg push ssh://$(HG_SRV_USER)@$(HG_SRV_NAME)//srv/hg/tips || [ $$? = 1 ]
    79 
    79 
    80 # Will be accessible via: http://gavenkoa.users.sourceforge.net/tips-html/frame.html
    80 # Will be accessible via: http://gavenkoa.users.sourceforge.net/tips-html/
    81 .PHONY: deploy2sf-web
    81 .PHONY: deploy2sf-web
    82 deploy2sf-web: html
    82 deploy2sf-web: html
    83 	rsync --delete -avP -e ssh tips-html/ gavenkoa@frs.sourceforge.net:/home/user-web/g/ga/gavenkoa/htdocs/tips-html/
    83 	rsync --delete -avP -e ssh tips-html/ gavenkoa@frs.sourceforge.net:/home/user-web/g/ga/gavenkoa/htdocs/tips-html/
    84 
    84 
    85 .PHONY: deploy2sf-hg
    85 .PHONY: deploy2sf-hg
   104 echo 'a { text-decoration: none; color: hsl(240, 100%, 50%); }'; \
   104 echo 'a { text-decoration: none; color: hsl(240, 100%, 50%); }'; \
   105 echo '</style></head><body>'; \
   105 echo '</style></head><body>'; \
   106 echo '<ul style="padding-left: 1em;">'; \
   106 echo '<ul style="padding-left: 1em;">'; \
   107 for f in $(sort $(RST_FILES)); do \
   107 for f in $(sort $(RST_FILES)); do \
   108   n=$${f%.rst}; \
   108   n=$${f%.rst}; \
   109   printf '<li><a target="_parent" href="%s.html">%s</a></li>' $$n $$n; \
   109   printf '<li><a target="_parent" href="%s.html">%s</a></li>\n' $$n $$n; \
   110 done; \
   110 done; \
   111 echo '</ul>'; \
   111 echo '</ul>'; \
   112 echo '</body></html>'; \
   112 echo '</body></html>'; \
   113 } >$@
   113 } >$@
   114 
   114 
   130 echo '.. container:: header small'; \
   130 echo '.. container:: header small'; \
   131 echo; \
   131 echo; \
   132 echo '  Written by Oleksandr Gavenko (AKA gavenkoa), compiled at ``'`date +%F`'`` from rev ``'`hg id -i`'``.'; \
   132 echo '  Written by Oleksandr Gavenko (AKA gavenkoa), compiled at ``'`date +%F`'`` from rev ``'`hg id -i`'``.'; \
   133 } >$@
   133 } >$@
   134 
   134 
   135 $(HTML_DIR)/frame-index.html: index.sh $(RST_HTML_FILES) $(MAKEFILE_LIST) | $(HTML_DIR)
       
   136 	./index.sh frame >$@
       
   137 
       
   138 $(HTML_DIR)/index.html: $(HTML_DIR)/README.html $(MAKEFILE_LIST) | $(HTML_DIR)
   135 $(HTML_DIR)/index.html: $(HTML_DIR)/README.html $(MAKEFILE_LIST) | $(HTML_DIR)
   139 	cp $< $@
   136 	cp $< $@
   140 
   137 
   141 $(HTML_DIR)/%.html: %.html $(MAKEFILE_LIST) | $(HTML_DIR)
   138 $(HTML_DIR)/%.html: %.html $(MAKEFILE_LIST) | $(HTML_DIR)
   142 	cp $< $@
   139 	cp $< $@
   143 
   140 
   144 $(HTML_DIR)/%.txt: %.txt $(MAKEFILE_LIST) | $(HTML_DIR)
   141 $(HTML_DIR)/%.txt: %.txt $(MAKEFILE_LIST) | $(HTML_DIR)
   145 	cp $< $@
   142 	cp $< $@
   146 
   143 
   147 .PHONY: chm
   144 .PHONY: chm
   148 chm: html $(CHM_FILES) $(HTML_DIR)/index-chm.html
   145 chm: html $(CHM_FILES) $(HTML_DIR)/iframe.html
   149 	cd $(HTML_DIR); for file in *.html; do sed -i '/<\?xml.*\?>/d' $$file; done
   146 	cd $(HTML_DIR); for file in *.html; do sed -i '/<\?xml.*\?>/d' $$file; done
   150 
   147 
   151 $(HTML_DIR)/%.stp: %.stp $(MAKEFILE_LIST) | $(HTML_DIR)
   148 $(HTML_DIR)/%.stp: %.stp $(MAKEFILE_LIST) | $(HTML_DIR)
   152 	cp $< $@
   149 	cp $< $@
   153 
   150 
   154 $(HTML_DIR)/chm.hhp: chm-hhp.sh $(MAKEFILE_LIST) | $(HTML_DIR)
   151 $(HTML_DIR)/chm.hhp: chm-hhp.sh $(MAKEFILE_LIST) | $(HTML_DIR)
   155 	./chm-hhp.sh >$@
   152 	./chm-hhp.sh >$@
   156 
   153 
   157 $(HTML_DIR)/chm.hhc: chm-hhc.sh $(MAKEFILE_LIST) | $(HTML_DIR)
   154 $(HTML_DIR)/chm.hhc: chm-hhc.sh $(MAKEFILE_LIST) | $(HTML_DIR)
   158 	./chm-hhc.sh >$@
   155 	./chm-hhc.sh >$@
   159 
       
   160 $(HTML_DIR)/index-chm.html: index.sh $(MAKEFILE_LIST) | $(HTML_DIR)
       
   161 	./index.sh html >$@
       
   162 
   156 
   163 ################################################################
   157 ################################################################
   164 # Init targets.
   158 # Init targets.
   165 
   159 
   166 $(DIRS):
   160 $(DIRS):