Makefile
changeset 275 9f70f66ee2a1
parent 274 f0b6d4c0ee97
child 276 66db1bbebe45
--- a/Makefile	Wed Oct 23 23:37:55 2013 +0300
+++ b/Makefile	Fri Oct 25 22:37:32 2013 +0300
@@ -44,7 +44,7 @@
 ################################################################
 # Version extracting/generation.
 
-# Prevent from deploying and distributing with wrong version.
+# Prevent making distribution with wrong version.
 ifneq '' '$(filter deploy% dist%,$(MAKECMDGOALS))'
   ifeq '' '$(MAKE_RESTARTS)'
     $(info $(shell rm -f VERSION))
@@ -123,16 +123,22 @@
 ################################################################
 # Project dirs/files.
 
+pkgname = gadict
+fullpkgname = $(pkgname)-$(vmajor).$(vminor)
+
 C5_FILES := $(wildcard *.dict-c5)
 DICT_FILES := $(C5_FILES:.dict-c5=.dict)
 DICTDZ_FILES := $(C5_FILES:.dict-c5=.dict.dz)
 INDEX_FILES := $(C5_FILES:.dict-c5=.index)
 
-RST_FILES := $(sort $(wildcard *.rst) STAT.rst VERSION.rst)
+RST_GEN_FILES := VERSION.rst STAT.rst
+RST_FILES := $(sort $(wildcard *.rst) $(RST_GEN_FILES))
 HTML_FILES := $(filter-out VERSION.html header.html,$(RST_FILES:.rst=.html))
 
-pkgname = gadict
-fullpkgname = $(pkgname)-$(vmajor).$(vminor)
+LOGO_NAME := logo
+LOGO_SVG := $(LOGO_NAME).svg
+LOGO_DIM := 32x32 48x48 64x64
+LOGO_PNG_FILES := $(patsubst %,$(LOGO_NAME)-%.png,$(LOGO_DIM))
 
 DIST_DIR = $(fullpkgname)
 DISTSRC_DIR = $(fullpkgname)_src
@@ -161,7 +167,11 @@
 # Next time any action fully automated.
 
 .PHONY: deploy2sf
-deploy2sf: deploy2sf-doc deploy2sf-release deploy2sf-src
+deploy2sf: deploy2sf-src deploy2sf-doc deploy2sf-release
+
+.PHONY: deploy2sf-src
+deploy2sf-src:
+	hg push ssh://$(SF_USER)@hg.code.sf.net/p/$(pkgname)/code || [ $$? = 1 ]
 
 # Will be accessed via http://$(pkgname).sourceforge.net
 .PHONY: deploy2sf-doc
@@ -188,20 +198,18 @@
 echo 'quit'; \
 ) | sftp -b - $(SF_USER),$(pkgname)@frs.sourceforge.net
 
-.PHONY: deploy2sf-src
-deploy2sf-src:
-	hg push ssh://$(SF_USER)@hg.code.sf.net/p/$(pkgname)/code || [ $$? = 1 ]
-
 .PHONY: deploy-check
 deploy-check:
-	case ${visclean} in \
-		no) echo "Local changes found. Build stop."; \
-			exit 1;; \
-	esac
-	case $(vatrelease) in \
-		no) echo "We are not at release. Build stop."; \
-			exit 1;; \
-	esac
+	\
+case ${visclean} in \
+  no) echo "Local changes found. Build stop."; \
+    exit 1;; \
+esac
+	\
+case $(vatrelease) in \
+  no) echo "We are not at release. Build stop."; \
+    exit 1;; \
+esac
 
 ################################################################
 # Dist targets.
@@ -271,10 +279,13 @@
 ################################################################
 # Documentation targets.
 
+.PHONY: docs
+docs: html
+
 .PHONY: html
 html: $(HTML_FILES)
 
-$(HTML_FILES): %.html: %.rst header.rst rst.css VERSION.rst $(BUILD_SCRIPTS)
+$(HTML_FILES): %.html: %.rst header.rst VERSION.rst rst.css $(BUILD_SCRIPTS)
 	$(RST2HTML) $(RST2HTML_FLAGS) --stylesheet=rst.css $*.rst $@
 
 VERSION.rst: VERSION $(BUILD_SCRIPTS)
@@ -295,6 +306,20 @@
 	} >$@
 
 ################################################################
+# Misc targets.
+
+.PHONY: logo
+logo: logo-png
+
+.PHONY: logo-png
+logo-png: $(LOGO_PNG_FILES)
+
+# Require:
+#   $ sudo apt-get install imagemagick librsvg2-bin
+$(LOGO_PNG_FILES): $(LOGO_NAME)-%.png: $(LOGO_SVG)
+	convert +antialias -background transparent $< -resize $* $@
+
+################################################################
 # Helpers targets.
 
 .PHONY: help
@@ -373,7 +398,7 @@
 
 .PHONY: clean
 clean:
-	rm -f $(DICTDZ_FILES) $(INDEX_FILES) $(HTML_FILES) STAT.rst VERSION.rst
+	rm -f $(DICTDZ_FILES) $(INDEX_FILES) $(HTML_FILES) $(RST_GEN_FILES) $(LOGO_PNG_FILES)
 	rm -rf $(DIST_DIR) $(DIST_TARBALLS)
 	rm -rf $(DISTSRC_DIR) $(DISTSRC_TARBALLS)