Makefile
changeset 185 59df68b203ca
parent 183 e3293e79262b
equal deleted inserted replaced
184:b6984282fee8 185:59df68b203ca
     1 #
     1 #
     2 # You can override such variables in Makefile.config:
     2 # You can override such variables in Makefile.config:
     3 #
     3 #
     4 #   SF_USER     SourceForge user name.
     4 #   FORCE         Non empty allow deploy with unclean working state.
       
     5 #
       
     6 #   SF_USER       SourceForge user name.
       
     7 #   WWW_SRV_NAME
       
     8 #   WWW_SRV_USER
       
     9 #   WWW_SRV_DIR
       
    10 #   HG_SRV_NAME
       
    11 #   HG_SRV_USER
       
    12 #   HG_SRV_DIR
     5 
    13 
     6 ################################################################
    14 ################################################################
     7 # Standard GNU Makefile settings.
    15 # Standard GNU Makefile settings.
     8 
    16 
     9 SHELL = /bin/bash
    17 SHELL = /bin/bash
   118 JSDOC_DIR := jsdoc
   126 JSDOC_DIR := jsdoc
   119 
   127 
   120 ################################################################
   128 ################################################################
   121 # Deploy targets.
   129 # Deploy targets.
   122 
   130 
   123 ifeq '' '$(SF_USER)'
   131 SF_USER ?= gavenkoa
   124   SF_USER := gavenkoa
   132 
   125 endif
   133 WWW_SRV_NAME ?= defun.work
   126 ifeq '' '$(DEFUN_USER)'
   134 WWW_SRV_USER ?= user
   127   DEFUN_USER := user
   135 WWW_SRV_DIR ?= /srv/www/2048
   128 endif
   136 HG_SRV_NAME ?= hg.defun.work
       
   137 HG_SRV_USER ?= user
       
   138 HG_SRV_DIR ?= /srv/hg/2048-js-ai
   129 
   139 
   130 .PHONY: deploy
   140 .PHONY: deploy
   131 deploy: deploy2defun deploy2sf
   141 deploy: deploy2defun deploy2sf
   132 
   142 
   133 .PHONY: deploy2defun
   143 .PHONY: deploy2defun
   134 deploy2defun: deploy2defun-src deploy2defun-www
   144 deploy2defun: deploy2defun-src deploy2defun-www
   135 
   145 
   136 .PHONY: deploy2defun-src
   146 .PHONY: deploy2defun-src
   137 deploy2defun-src:
   147 deploy2defun-src:
   138 	hg push ssh://$(DEFUN_USER)@hg.defun.work//srv/hg/2048-js-ai/ || [ $$? = 1 ]
   148 	hg push ssh://$(HG_SRV_USER)@$(HG_SRV_NAME)/$(HG_SRV_DIR)/ || [ $$? = 1 ]
   139 
   149 
   140 .PHONY: deploy2defun-www
   150 .PHONY: deploy2defun-www
   141 deploy2defun-www: deploy-check $(WWW_FILES)
   151 deploy2defun-www: deploy-check $(WWW_FILES)
   142 	( echo 'cd /srv/www/2048'; \
   152 	( echo 'cd $(WWW_SRV_DIR)'; \
   143 for f in $(WWW_FILES); do \
   153 for f in $(WWW_FILES); do \
   144   echo "put $$f"; \
   154   echo "put $$f"; \
   145   echo "chmod 644 $$f"; \
   155   echo "chmod 644 $$f"; \
   146 done; \
   156 done; \
   147 echo "put 2048.html index.html"; \
   157 echo "put 2048.html index.html"; \
   148 echo 'quit'; \
   158 echo 'quit'; \
   149 ) | sftp -b - $(DEFUN_USER)@defun.work
   159 ) | sftp -b - $(WWW_SRV_USER)@$(WWW_SRV_NAME)
   150 
   160 
   151 # First time you deploy to SourceForge (sf) you need manually login to:
   161 # First time you deploy to SourceForge (sf) you need manually login to:
   152 #   $ sftp $(SF_USER),$(pkgname)@web.sourceforge.net
   162 #   $ sftp $(SF_USER),$(pkgname)@web.sourceforge.net
   153 # as it may require interactive input for accepting server public key.
   163 # as it may require interactive input for accepting server public key.
   154 # Next time any action fully automated.
   164 # Next time any action fully automated.
   187 ) | sftp -b - $(SF_USER),$(sfpkgname)@frs.sourceforge.net
   197 ) | sftp -b - $(SF_USER),$(sfpkgname)@frs.sourceforge.net
   188 
   198 
   189 .PHONY: deploy-check
   199 .PHONY: deploy-check
   190 deploy-check:
   200 deploy-check:
   191 	\
   201 	\
   192 case ${visclean} in \
   202 case "$(FORCE)$(visclean)" in \
   193   no) echo "Local changes found. Build stop."; \
   203   no) echo "Local changes found. Build stop."; \
   194     exit 1;; \
   204     exit 1;; \
   195 esac
   205 esac
   196 	\
   206 	\
   197 case $(vatrelease) in \
   207 case "$(FORCE)$(vatrelease)" in \
   198   no) echo "We are not at release. Build stop."; \
   208   no) echo "We are not at release. Build stop."; \
   199     exit 1;; \
   209     exit 1;; \
   200 esac
   210 esac
   201 
   211 
   202 ################################################################
   212 ################################################################