Makefile
changeset 103 b5b1dc62bdc0
parent 94 1b2cf5b2b46c
child 105 35cc545ec03d
equal deleted inserted replaced
102:69269f77a7a0 103:b5b1dc62bdc0
    23 .SUFFIXES:
    23 .SUFFIXES:
    24 # Default target.
    24 # Default target.
    25 .DEFAULT_GOAL = all
    25 .DEFAULT_GOAL = all
    26 
    26 
    27 ################################################################
    27 ################################################################
       
    28 # Version extracting/generation.
       
    29 
       
    30 # Prevent from deploying and distributing with wrong version.
       
    31 ifneq '' '$(filter deploy%,$(MAKECMDGOALS))'
       
    32   ifeq '' '$(MAKE_RESTARTS)'
       
    33     $(info $(shell rm VERSION))
       
    34   endif
       
    35 endif
       
    36 
       
    37 # Here are vmajor and vminor. Look README section "Versioning rules."
       
    38 -include VERSION
       
    39 
       
    40 VERSION:
       
    41 	ver=$$(hg log -r . --template '{latesttag}'); \
       
    42 ver=$${ver#t}; \
       
    43 major=$${ver%.*}; \
       
    44 minor=$${ver#*.}; \
       
    45 printf "vmajor=%s\nvminor=%s\n" $$major $$minor >VERSION
       
    46 	# is_release=`hg log --template '{latesttagdistance}'`
       
    47 
       
    48 ################################################################
    28 # Platform/environment definition.
    49 # Platform/environment definition.
    29 
    50 
    30 host_os = unix
    51 host_os = unix
    31 ifneq '' '$(COMSPEC)'
    52 ifneq '' '$(COMSPEC)'
    32   ifneq '' '$(WINDIR)'
    53   ifneq '' '$(WINDIR)'
    64 DICTDZ_FILES := $(C5_FILES:.dict-c5=.dict.dz)
    85 DICTDZ_FILES := $(C5_FILES:.dict-c5=.dict.dz)
    65 INDEX_FILES := $(C5_FILES:.dict-c5=.index)
    86 INDEX_FILES := $(C5_FILES:.dict-c5=.index)
    66 
    87 
    67 RST_FILES := $(wildcard *.rst)
    88 RST_FILES := $(wildcard *.rst)
    68 HTML_FILES := $(RST_FILES:.rst=.html)
    89 HTML_FILES := $(RST_FILES:.rst=.html)
       
    90 
       
    91 name = gadict
       
    92 fullpkgname = $(name)-$(vmajor).$(vminor)
       
    93 
       
    94 DIST_DIR = $(fullpkgname)
       
    95 DISTSRC_DIR = $(fullpkgname)_src
       
    96 
       
    97 DIST_FILES = $(DICTDZ_FILES) $(INDEX_FILES) $(HTML_FILES) $(RST_FILES) VERSION
       
    98 
       
    99 DISTSRC_HELPER_FILES = VERSION Makefile rst.css .dir-locals.el
       
   100 DISTSRC_FILES = $(HTML_FILES) $(RST_FILES) $(DISTSRC_HELPER_FILES)
       
   101 
       
   102 ################################################################
       
   103 # Dist targets.
       
   104 
       
   105 .PHONY: dist
       
   106 dist: dist-dictd dist-src
       
   107 
       
   108 .PHONY: dist-dictd
       
   109 dist-dictd: $(DIST_DIR).tar.gz $(DIST_DIR).tar.bz2
       
   110 
       
   111 .PHONY: dist-src
       
   112 dist-src: $(DISTSRC_DIR).tar.gz $(DISTSRC_DIR).tar.bz2
       
   113 
       
   114 %.tar.gz: %
       
   115 	tar zcf $*.tar.gz $*
       
   116 
       
   117 %.tar.bz2: %
       
   118 	tar jcf $*.tar.bz2 $*
       
   119 
       
   120 $(DIST_DIR): $(DIST_FILES)
       
   121 	rm -rf $@
       
   122 	mkdir $@
       
   123 	cp $(DIST_FILES) $@
       
   124 
       
   125 $(DISTSRC_DIR): $(DISTSRC_FILES)
       
   126 	rm -rf $@
       
   127 	mkdir $@
       
   128 	cp $(DISTSRC_FILES) $@
    69 
   129 
    70 ################################################################
   130 ################################################################
    71 # Build targets.
   131 # Build targets.
    72 
   132 
    73 .PHONY: all
   133 .PHONY: all