Makefile
changeset 275 9f70f66ee2a1
parent 274 f0b6d4c0ee97
child 276 66db1bbebe45
equal deleted inserted replaced
274:f0b6d4c0ee97 275:9f70f66ee2a1
    42 endif
    42 endif
    43 
    43 
    44 ################################################################
    44 ################################################################
    45 # Version extracting/generation.
    45 # Version extracting/generation.
    46 
    46 
    47 # Prevent from deploying and distributing with wrong version.
    47 # Prevent making distribution with wrong version.
    48 ifneq '' '$(filter deploy% dist%,$(MAKECMDGOALS))'
    48 ifneq '' '$(filter deploy% dist%,$(MAKECMDGOALS))'
    49   ifeq '' '$(MAKE_RESTARTS)'
    49   ifeq '' '$(MAKE_RESTARTS)'
    50     $(info $(shell rm -f VERSION))
    50     $(info $(shell rm -f VERSION))
    51   endif
    51   endif
    52 endif
    52 endif
   121 datadir = $(datarootdir)/dictd
   121 datadir = $(datarootdir)/dictd
   122 
   122 
   123 ################################################################
   123 ################################################################
   124 # Project dirs/files.
   124 # Project dirs/files.
   125 
   125 
       
   126 pkgname = gadict
       
   127 fullpkgname = $(pkgname)-$(vmajor).$(vminor)
       
   128 
   126 C5_FILES := $(wildcard *.dict-c5)
   129 C5_FILES := $(wildcard *.dict-c5)
   127 DICT_FILES := $(C5_FILES:.dict-c5=.dict)
   130 DICT_FILES := $(C5_FILES:.dict-c5=.dict)
   128 DICTDZ_FILES := $(C5_FILES:.dict-c5=.dict.dz)
   131 DICTDZ_FILES := $(C5_FILES:.dict-c5=.dict.dz)
   129 INDEX_FILES := $(C5_FILES:.dict-c5=.index)
   132 INDEX_FILES := $(C5_FILES:.dict-c5=.index)
   130 
   133 
   131 RST_FILES := $(sort $(wildcard *.rst) STAT.rst VERSION.rst)
   134 RST_GEN_FILES := VERSION.rst STAT.rst
       
   135 RST_FILES := $(sort $(wildcard *.rst) $(RST_GEN_FILES))
   132 HTML_FILES := $(filter-out VERSION.html header.html,$(RST_FILES:.rst=.html))
   136 HTML_FILES := $(filter-out VERSION.html header.html,$(RST_FILES:.rst=.html))
   133 
   137 
   134 pkgname = gadict
   138 LOGO_NAME := logo
   135 fullpkgname = $(pkgname)-$(vmajor).$(vminor)
   139 LOGO_SVG := $(LOGO_NAME).svg
       
   140 LOGO_DIM := 32x32 48x48 64x64
       
   141 LOGO_PNG_FILES := $(patsubst %,$(LOGO_NAME)-%.png,$(LOGO_DIM))
   136 
   142 
   137 DIST_DIR = $(fullpkgname)
   143 DIST_DIR = $(fullpkgname)
   138 DISTSRC_DIR = $(fullpkgname)_src
   144 DISTSRC_DIR = $(fullpkgname)_src
   139 
   145 
   140 DIST_FILES = $(DICTDZ_FILES) $(INDEX_FILES) $(HTML_FILES) $(RST_FILES) VERSION
   146 DIST_FILES = $(DICTDZ_FILES) $(INDEX_FILES) $(HTML_FILES) $(RST_FILES) VERSION
   159 #   $ sftp $(SF_USER),$(pkgname)@web.sourceforge.net
   165 #   $ sftp $(SF_USER),$(pkgname)@web.sourceforge.net
   160 # as it may require interactive input for accepting server public key.
   166 # as it may require interactive input for accepting server public key.
   161 # Next time any action fully automated.
   167 # Next time any action fully automated.
   162 
   168 
   163 .PHONY: deploy2sf
   169 .PHONY: deploy2sf
   164 deploy2sf: deploy2sf-doc deploy2sf-release deploy2sf-src
   170 deploy2sf: deploy2sf-src deploy2sf-doc deploy2sf-release
       
   171 
       
   172 .PHONY: deploy2sf-src
       
   173 deploy2sf-src:
       
   174 	hg push ssh://$(SF_USER)@hg.code.sf.net/p/$(pkgname)/code || [ $$? = 1 ]
   165 
   175 
   166 # Will be accessed via http://$(pkgname).sourceforge.net
   176 # Will be accessed via http://$(pkgname).sourceforge.net
   167 .PHONY: deploy2sf-doc
   177 .PHONY: deploy2sf-doc
   168 deploy2sf-doc: deploy-check $(HTML_FILES)
   178 deploy2sf-doc: deploy-check $(HTML_FILES)
   169 	( echo 'cd htdocs'; \
   179 	( echo 'cd htdocs'; \
   186 	echo "chmod 644 $$f"; \
   196 	echo "chmod 644 $$f"; \
   187 done; \
   197 done; \
   188 echo 'quit'; \
   198 echo 'quit'; \
   189 ) | sftp -b - $(SF_USER),$(pkgname)@frs.sourceforge.net
   199 ) | sftp -b - $(SF_USER),$(pkgname)@frs.sourceforge.net
   190 
   200 
   191 .PHONY: deploy2sf-src
       
   192 deploy2sf-src:
       
   193 	hg push ssh://$(SF_USER)@hg.code.sf.net/p/$(pkgname)/code || [ $$? = 1 ]
       
   194 
       
   195 .PHONY: deploy-check
   201 .PHONY: deploy-check
   196 deploy-check:
   202 deploy-check:
   197 	case ${visclean} in \
   203 	\
   198 		no) echo "Local changes found. Build stop."; \
   204 case ${visclean} in \
   199 			exit 1;; \
   205   no) echo "Local changes found. Build stop."; \
   200 	esac
   206     exit 1;; \
   201 	case $(vatrelease) in \
   207 esac
   202 		no) echo "We are not at release. Build stop."; \
   208 	\
   203 			exit 1;; \
   209 case $(vatrelease) in \
   204 	esac
   210   no) echo "We are not at release. Build stop."; \
       
   211     exit 1;; \
       
   212 esac
   205 
   213 
   206 ################################################################
   214 ################################################################
   207 # Dist targets.
   215 # Dist targets.
   208 
   216 
   209 .PHONY: dist
   217 .PHONY: dist
   269 	done
   277 	done
   270 
   278 
   271 ################################################################
   279 ################################################################
   272 # Documentation targets.
   280 # Documentation targets.
   273 
   281 
       
   282 .PHONY: docs
       
   283 docs: html
       
   284 
   274 .PHONY: html
   285 .PHONY: html
   275 html: $(HTML_FILES)
   286 html: $(HTML_FILES)
   276 
   287 
   277 $(HTML_FILES): %.html: %.rst header.rst rst.css VERSION.rst $(BUILD_SCRIPTS)
   288 $(HTML_FILES): %.html: %.rst header.rst VERSION.rst rst.css $(BUILD_SCRIPTS)
   278 	$(RST2HTML) $(RST2HTML_FLAGS) --stylesheet=rst.css $*.rst $@
   289 	$(RST2HTML) $(RST2HTML_FLAGS) --stylesheet=rst.css $*.rst $@
   279 
   290 
   280 VERSION.rst: VERSION $(BUILD_SCRIPTS)
   291 VERSION.rst: VERSION $(BUILD_SCRIPTS)
   281 	{ \
   292 	{ \
   282 	echo 'For ``$(pkgname)`` version: ``$(vmajor).$(vminor)``.'; \
   293 	echo 'For ``$(pkgname)`` version: ``$(vmajor).$(vminor)``.'; \
   293 	echo; \
   304 	echo; \
   294 	echo 'Build date: ``'$$(date +%F)'``.'; \
   305 	echo 'Build date: ``'$$(date +%F)'``.'; \
   295 	} >$@
   306 	} >$@
   296 
   307 
   297 ################################################################
   308 ################################################################
       
   309 # Misc targets.
       
   310 
       
   311 .PHONY: logo
       
   312 logo: logo-png
       
   313 
       
   314 .PHONY: logo-png
       
   315 logo-png: $(LOGO_PNG_FILES)
       
   316 
       
   317 # Require:
       
   318 #   $ sudo apt-get install imagemagick librsvg2-bin
       
   319 $(LOGO_PNG_FILES): $(LOGO_NAME)-%.png: $(LOGO_SVG)
       
   320 	convert +antialias -background transparent $< -resize $* $@
       
   321 
       
   322 ################################################################
   298 # Helpers targets.
   323 # Helpers targets.
   299 
   324 
   300 .PHONY: help
   325 .PHONY: help
   301 help:
   326 help:
   302 	@\
   327 	@\
   371 distclean: clean
   396 distclean: clean
   372 	rm -f VERSION
   397 	rm -f VERSION
   373 
   398 
   374 .PHONY: clean
   399 .PHONY: clean
   375 clean:
   400 clean:
   376 	rm -f $(DICTDZ_FILES) $(INDEX_FILES) $(HTML_FILES) STAT.rst VERSION.rst
   401 	rm -f $(DICTDZ_FILES) $(INDEX_FILES) $(HTML_FILES) $(RST_GEN_FILES) $(LOGO_PNG_FILES)
   377 	rm -rf $(DIST_DIR) $(DIST_TARBALLS)
   402 	rm -rf $(DIST_DIR) $(DIST_TARBALLS)
   378 	rm -rf $(DISTSRC_DIR) $(DISTSRC_TARBALLS)
   403 	rm -rf $(DISTSRC_DIR) $(DISTSRC_TARBALLS)
   379 
   404