Makefile
author Oleksandr Gavenko <gavenkoa@gmail.com>
Thu, 25 Sep 2014 01:10:01 +0300
changeset 138 23cd36180bf9
parent 84 58adeb5e4264
child 175 9a83576eec4c
permissions -rw-r--r--
Add ability to enable browser profile.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
48
32b976d3fd10 Release build script.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
     1
#
32b976d3fd10 Release build script.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
     2
# You can override such variables in Makefile.config:
32b976d3fd10 Release build script.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
     3
#
32b976d3fd10 Release build script.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
     4
#   SF_USER     SourceForge user name.
32b976d3fd10 Release build script.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
     5
32b976d3fd10 Release build script.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
     6
################################################################
32b976d3fd10 Release build script.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
     7
# Standard GNU Makefile settings.
32b976d3fd10 Release build script.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
     8
32b976d3fd10 Release build script.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
     9
SHELL = /bin/bash
32b976d3fd10 Release build script.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    10
export PATH := /bin:/usr/bin:${PATH}
32b976d3fd10 Release build script.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    11
32b976d3fd10 Release build script.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    12
# Disable built in pattern rules.
32b976d3fd10 Release build script.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    13
MAKEFLAGS += -r
32b976d3fd10 Release build script.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    14
# Disable built in variables.
32b976d3fd10 Release build script.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    15
MAKEFLAGS += -R
32b976d3fd10 Release build script.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    16
# Disable built in suffix rules.
32b976d3fd10 Release build script.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    17
.SUFFIXES:
32b976d3fd10 Release build script.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    18
# Delete target file if command fails.
32b976d3fd10 Release build script.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    19
.DELETE_ON_ERROR:
32b976d3fd10 Release build script.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    20
# Default target.
32b976d3fd10 Release build script.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    21
.DEFAULT_GOAL = help
32b976d3fd10 Release build script.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    22
32b976d3fd10 Release build script.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    23
################################################################
32b976d3fd10 Release build script.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    24
# Build script definitions.
32b976d3fd10 Release build script.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    25
32b976d3fd10 Release build script.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    26
BUILD_SCRIPTS := $(firstword $(MAKEFILE_LIST))
32b976d3fd10 Release build script.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    27
32b976d3fd10 Release build script.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    28
ifneq '' '$(wildcard Makefile.config)'
32b976d3fd10 Release build script.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    29
  include Makefile.config
32b976d3fd10 Release build script.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    30
  BUILD_SCRIPTS += Makefile.config
32b976d3fd10 Release build script.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    31
endif
32b976d3fd10 Release build script.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    32
32b976d3fd10 Release build script.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    33
################################################################
32b976d3fd10 Release build script.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    34
# Version extracting/generation.
32b976d3fd10 Release build script.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    35
32b976d3fd10 Release build script.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    36
# Prevent making distribution with wrong version.
32b976d3fd10 Release build script.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    37
ifneq '' '$(filter deploy% dist%,$(MAKECMDGOALS))'
32b976d3fd10 Release build script.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    38
  ifeq '' '$(MAKE_RESTARTS)'
32b976d3fd10 Release build script.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    39
    $(info $(shell rm -f VERSION))
32b976d3fd10 Release build script.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    40
  endif
32b976d3fd10 Release build script.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    41
endif
32b976d3fd10 Release build script.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    42
32b976d3fd10 Release build script.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    43
# Here are vmajor and vminor. Look README section "Versioning rules."
32b976d3fd10 Release build script.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    44
-include VERSION
32b976d3fd10 Release build script.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    45
32b976d3fd10 Release build script.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    46
VERSION:
32b976d3fd10 Release build script.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    47
	\
32b976d3fd10 Release build script.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    48
vtagdist=$$(hg log -r . --template '{latesttagdistance}'); \
32b976d3fd10 Release build script.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    49
vatrelease=$$([ $$vtagdist -le 1 ] && echo yes || echo no); \
32b976d3fd10 Release build script.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    50
vtag=$$(hg log -r . --template '{latesttag}'); \
50
0bda4161d1b9 Fix tag prefix (after copy/paste).
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 49
diff changeset
    51
vmajor=$${vtag#v}; \
48
32b976d3fd10 Release build script.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    52
vmajor=$${vmajor%%.*}; \
32b976d3fd10 Release build script.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    53
vminor=$${vtag#*.}; \
32b976d3fd10 Release build script.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    54
vrev=$$(hg id -i); \
32b976d3fd10 Release build script.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    55
visclean=$$(case $$vrev in *+) echo no;; *) echo yes;; esac); \
32b976d3fd10 Release build script.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    56
vrev=$${vrev%+}; \
32b976d3fd10 Release build script.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    57
{ \
32b976d3fd10 Release build script.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    58
echo "vrev=$$vrev"; \
32b976d3fd10 Release build script.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    59
echo "vtag=$$vtag"; \
32b976d3fd10 Release build script.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    60
echo "vtagdist=$$vtagdist"; \
32b976d3fd10 Release build script.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    61
echo "visclean=$$visclean"; \
32b976d3fd10 Release build script.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    62
echo "vatrelease=$$vatrelease"; \
32b976d3fd10 Release build script.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    63
echo "vmajor=$$vmajor"; \
32b976d3fd10 Release build script.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    64
echo "vminor=$$vminor"; \
32b976d3fd10 Release build script.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    65
} >VERSION
32b976d3fd10 Release build script.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    66
32b976d3fd10 Release build script.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    67
################################################################
32b976d3fd10 Release build script.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    68
# Determine platform/environment.
32b976d3fd10 Release build script.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    69
32b976d3fd10 Release build script.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    70
host_os = unix
32b976d3fd10 Release build script.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    71
ifneq '' '$(COMSPEC)'
32b976d3fd10 Release build script.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    72
  ifneq '' '$(WINDIR)'
32b976d3fd10 Release build script.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    73
    # Probably under Windows.
32b976d3fd10 Release build script.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    74
    host_os = windows
32b976d3fd10 Release build script.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    75
    ifneq '' '$(wildcard /etc/setup/*cygwin*)'
32b976d3fd10 Release build script.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    76
      # Probably under Cygwin.
32b976d3fd10 Release build script.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    77
      host_os = cygwin
32b976d3fd10 Release build script.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    78
    endif
32b976d3fd10 Release build script.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    79
  endif
32b976d3fd10 Release build script.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    80
endif
32b976d3fd10 Release build script.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    81
32b976d3fd10 Release build script.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    82
################################################################
77
c2bad6178c65 Add project docs.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 57
diff changeset
    83
# Build tools definition/switches.
c2bad6178c65 Add project docs.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 57
diff changeset
    84
c2bad6178c65 Add project docs.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 57
diff changeset
    85
RST_WARNING_FLAGS := --halt warning
c2bad6178c65 Add project docs.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 57
diff changeset
    86
RST_FLAGS := --strip-comments
c2bad6178c65 Add project docs.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 57
diff changeset
    87
RST_FLAGS += $(RST_WARNING_FLAGS)
c2bad6178c65 Add project docs.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 57
diff changeset
    88
c2bad6178c65 Add project docs.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 57
diff changeset
    89
RST2HTML := rst2html
c2bad6178c65 Add project docs.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 57
diff changeset
    90
ifeq '$(host_os)' 'cygwin'
c2bad6178c65 Add project docs.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 57
diff changeset
    91
  RST2HTML := rst2html.py
c2bad6178c65 Add project docs.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 57
diff changeset
    92
endif
c2bad6178c65 Add project docs.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 57
diff changeset
    93
RST2HTML_FLAGS := $(RST_FLAGS)
c2bad6178c65 Add project docs.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 57
diff changeset
    94
c2bad6178c65 Add project docs.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 57
diff changeset
    95
################################################################
48
32b976d3fd10 Release build script.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    96
# Project dirs/files.
32b976d3fd10 Release build script.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    97
32b976d3fd10 Release build script.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    98
pkgname = 2048-js-ai
32b976d3fd10 Release build script.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    99
sfpkgname = js-2048-ai
32b976d3fd10 Release build script.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   100
fullpkgname = $(pkgname)-$(vmajor).$(vminor)
32b976d3fd10 Release build script.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   101
32b976d3fd10 Release build script.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   102
DIST_DIR = $(fullpkgname)
32b976d3fd10 Release build script.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   103
77
c2bad6178c65 Add project docs.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 57
diff changeset
   104
RST_GEN_FILES := VERSION.rst
c2bad6178c65 Add project docs.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 57
diff changeset
   105
RST_COMMON_FILES := VERSION.rst header.rst
c2bad6178c65 Add project docs.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 57
diff changeset
   106
RST_FILES := $(filter-out $(RST_COMMON_FILES),$(sort $(wildcard *.rst) $(RST_GEN_FILES)))
c2bad6178c65 Add project docs.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 57
diff changeset
   107
RST_HTML_FILES := $(RST_FILES:.rst=.html)
c2bad6178c65 Add project docs.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 57
diff changeset
   108
57
94e1b2d0bd31 Add JSDoc annotation.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 50
diff changeset
   109
JS_FILES := $(wildcard *.js)
77
c2bad6178c65 Add project docs.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 57
diff changeset
   110
HTML_FILES := 2048.html
84
58adeb5e4264 Add missing file to dist and deploy.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 82
diff changeset
   111
WWW_FILES := $(JS_FILES) $(HTML_FILES) $(RST_HTML_FILES)
48
32b976d3fd10 Release build script.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   112
82
a61ac9c2d506 Package RST files.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 80
diff changeset
   113
DIST_FILES = $(WWW_FILES) $(RST_FILES) VERSION
48
32b976d3fd10 Release build script.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   114
32b976d3fd10 Release build script.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   115
DIST_TARBALLS = $(DIST_DIR).tar.gz $(DIST_DIR).zip
32b976d3fd10 Release build script.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   116
57
94e1b2d0bd31 Add JSDoc annotation.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 50
diff changeset
   117
JSDOC_DIR := jsdoc
94e1b2d0bd31 Add JSDoc annotation.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 50
diff changeset
   118
48
32b976d3fd10 Release build script.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   119
################################################################
32b976d3fd10 Release build script.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   120
# Deploy targets.
32b976d3fd10 Release build script.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   121
32b976d3fd10 Release build script.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   122
ifeq '' '$(SF_USER)'
32b976d3fd10 Release build script.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   123
  SF_USER := gavenkoa
32b976d3fd10 Release build script.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   124
endif
32b976d3fd10 Release build script.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   125
32b976d3fd10 Release build script.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   126
.PHONY: deploy
32b976d3fd10 Release build script.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   127
deploy: deploy2sf
32b976d3fd10 Release build script.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   128
32b976d3fd10 Release build script.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   129
# First time you deploy to SourceForge (sf) you need manually login to:
32b976d3fd10 Release build script.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   130
#   $ sftp $(SF_USER),$(pkgname)@web.sourceforge.net
32b976d3fd10 Release build script.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   131
# as it may require interactive input for accepting server public key.
32b976d3fd10 Release build script.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   132
# Next time any action fully automated.
32b976d3fd10 Release build script.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   133
32b976d3fd10 Release build script.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   134
.PHONY: deploy2sf
32b976d3fd10 Release build script.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   135
deploy2sf: deploy2sf-src deploy2sf-www deploy2sf-release
32b976d3fd10 Release build script.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   136
32b976d3fd10 Release build script.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   137
.PHONY: deploy2sf-src
32b976d3fd10 Release build script.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   138
deploy2sf-src:
32b976d3fd10 Release build script.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   139
	hg push ssh://$(SF_USER)@hg.code.sf.net/p/$(sfpkgname)/hg || [ $$? = 1 ]
32b976d3fd10 Release build script.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   140
32b976d3fd10 Release build script.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   141
# Will be accessed via http://$(pkgname).sourceforge.net
32b976d3fd10 Release build script.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   142
.PHONY: deploy2sf-www
32b976d3fd10 Release build script.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   143
deploy2sf-www: deploy-check $(WWW_FILES)
32b976d3fd10 Release build script.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   144
	( echo 'cd htdocs'; \
32b976d3fd10 Release build script.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   145
for f in $(WWW_FILES); do \
32b976d3fd10 Release build script.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   146
  echo "put $$f"; \
32b976d3fd10 Release build script.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   147
  echo "chmod 644 $$f"; \
32b976d3fd10 Release build script.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   148
done; \
80
1ed275e69293 Make README as index.html in SF.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 77
diff changeset
   149
echo "put README.html index.html"; \
48
32b976d3fd10 Release build script.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   150
echo 'quit'; \
32b976d3fd10 Release build script.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   151
) | sftp -b - $(SF_USER),$(sfpkgname)@web.sourceforge.net
32b976d3fd10 Release build script.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   152
32b976d3fd10 Release build script.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   153
.PHONY: deploy2sf-release
32b976d3fd10 Release build script.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   154
deploy2sf-release: deploy-check $(DIST_TARBALLS)
32b976d3fd10 Release build script.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   155
	( echo 'cd /home/frs/project/$(shell v=$(sfpkgname); echo $${v:0:1}/$${v:0:2})/$(sfpkgname)'; \
32b976d3fd10 Release build script.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   156
echo "put  README.rst"; \
32b976d3fd10 Release build script.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   157
echo "chmod 644 README.rst"; \
32b976d3fd10 Release build script.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   158
echo "mkdir v$(vmajor).$(vminor)"; \
32b976d3fd10 Release build script.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   159
echo "cd v$(vmajor).$(vminor)"; \
32b976d3fd10 Release build script.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   160
for f in $(DIST_TARBALLS); do \
32b976d3fd10 Release build script.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   161
	echo "put $$f"; \
32b976d3fd10 Release build script.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   162
	echo "chmod 644 $$f"; \
32b976d3fd10 Release build script.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   163
done; \
32b976d3fd10 Release build script.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   164
echo 'quit'; \
32b976d3fd10 Release build script.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   165
) | sftp -b - $(SF_USER),$(sfpkgname)@frs.sourceforge.net
32b976d3fd10 Release build script.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   166
32b976d3fd10 Release build script.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   167
.PHONY: deploy-check
32b976d3fd10 Release build script.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   168
deploy-check:
32b976d3fd10 Release build script.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   169
	\
32b976d3fd10 Release build script.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   170
case ${visclean} in \
32b976d3fd10 Release build script.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   171
  no) echo "Local changes found. Build stop."; \
32b976d3fd10 Release build script.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   172
    exit 1;; \
32b976d3fd10 Release build script.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   173
esac
32b976d3fd10 Release build script.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   174
	\
32b976d3fd10 Release build script.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   175
case $(vatrelease) in \
32b976d3fd10 Release build script.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   176
  no) echo "We are not at release. Build stop."; \
32b976d3fd10 Release build script.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   177
    exit 1;; \
32b976d3fd10 Release build script.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   178
esac
32b976d3fd10 Release build script.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   179
32b976d3fd10 Release build script.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   180
################################################################
32b976d3fd10 Release build script.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   181
# Dist targets.
32b976d3fd10 Release build script.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   182
32b976d3fd10 Release build script.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   183
.PHONY: dist
32b976d3fd10 Release build script.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   184
dist: dist-bin
32b976d3fd10 Release build script.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   185
32b976d3fd10 Release build script.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   186
.PHONY: dist-bin
49
4b48e9e06000 Fix dist build target.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 48
diff changeset
   187
dist-bin: $(DIST_TARBALLS)
48
32b976d3fd10 Release build script.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   188
32b976d3fd10 Release build script.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   189
%.tar.gz: %
32b976d3fd10 Release build script.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   190
	tar zcf $*.tar.gz $*
32b976d3fd10 Release build script.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   191
32b976d3fd10 Release build script.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   192
%.tar.bz2: %
32b976d3fd10 Release build script.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   193
	tar jcf $*.tar.bz2 $*
32b976d3fd10 Release build script.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   194
49
4b48e9e06000 Fix dist build target.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 48
diff changeset
   195
%.zip: %
4b48e9e06000 Fix dist build target.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 48
diff changeset
   196
	zip -r $*.zip $*
4b48e9e06000 Fix dist build target.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 48
diff changeset
   197
48
32b976d3fd10 Release build script.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   198
$(DIST_DIR): $(DIST_FILES)
32b976d3fd10 Release build script.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   199
	rm -rf $@
32b976d3fd10 Release build script.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   200
	mkdir $@
32b976d3fd10 Release build script.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   201
	cp $(DIST_FILES) $@
32b976d3fd10 Release build script.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   202
32b976d3fd10 Release build script.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   203
################################################################
77
c2bad6178c65 Add project docs.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 57
diff changeset
   204
# Documentation targets.
c2bad6178c65 Add project docs.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 57
diff changeset
   205
c2bad6178c65 Add project docs.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 57
diff changeset
   206
.PHONY: docs
c2bad6178c65 Add project docs.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 57
diff changeset
   207
docs: rst2html
c2bad6178c65 Add project docs.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 57
diff changeset
   208
c2bad6178c65 Add project docs.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 57
diff changeset
   209
.PHONY: rst2html
c2bad6178c65 Add project docs.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 57
diff changeset
   210
rst2html: $(RST_HTML_FILES)
c2bad6178c65 Add project docs.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 57
diff changeset
   211
c2bad6178c65 Add project docs.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 57
diff changeset
   212
$(RST_HTML_FILES): $(RST_COMMON_FILES)
c2bad6178c65 Add project docs.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 57
diff changeset
   213
c2bad6178c65 Add project docs.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 57
diff changeset
   214
$(RST_HTML_FILES): %.html: %.rst rst.css header.rst VERSION.rst $(BUILD_SCRIPTS)
c2bad6178c65 Add project docs.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 57
diff changeset
   215
	$(RST2HTML) $(RST2HTML_FLAGS) --stylesheet=rst.css $*.rst $@
c2bad6178c65 Add project docs.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 57
diff changeset
   216
c2bad6178c65 Add project docs.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 57
diff changeset
   217
VERSION.rst: VERSION $(BUILD_SCRIPTS)
c2bad6178c65 Add project docs.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 57
diff changeset
   218
	{ \
c2bad6178c65 Add project docs.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 57
diff changeset
   219
	echo 'For ``$(pkgname)`` version: ``$(vmajor).$(vminor)``.'; \
c2bad6178c65 Add project docs.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 57
diff changeset
   220
	echo; \
c2bad6178c65 Add project docs.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 57
diff changeset
   221
	case ${visclean} in \
c2bad6178c65 Add project docs.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 57
diff changeset
   222
		yes) echo 'Source files are at revision: ``$(vrev)``.';; \
c2bad6178c65 Add project docs.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 57
diff changeset
   223
		no) echo 'Some source files was modified from revision: ``$(vrev)``.';; \
c2bad6178c65 Add project docs.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 57
diff changeset
   224
	esac; \
c2bad6178c65 Add project docs.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 57
diff changeset
   225
	echo; \
c2bad6178c65 Add project docs.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 57
diff changeset
   226
	case ${vatrelease} in \
c2bad6178c65 Add project docs.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 57
diff changeset
   227
		yes) echo 'Package is at release state.';; \
c2bad6178c65 Add project docs.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 57
diff changeset
   228
		no) echo 'Package is far from release state by $(vtagdist) changes.';; \
c2bad6178c65 Add project docs.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 57
diff changeset
   229
	esac; \
c2bad6178c65 Add project docs.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 57
diff changeset
   230
	echo; \
c2bad6178c65 Add project docs.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 57
diff changeset
   231
	echo 'Build date: ``'$$(date +%F)'``.'; \
c2bad6178c65 Add project docs.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 57
diff changeset
   232
	} >$@
c2bad6178c65 Add project docs.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 57
diff changeset
   233
c2bad6178c65 Add project docs.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 57
diff changeset
   234
################################################################
48
32b976d3fd10 Release build script.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   235
# Helpers targets.
32b976d3fd10 Release build script.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   236
32b976d3fd10 Release build script.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   237
.PHONY: help
32b976d3fd10 Release build script.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   238
help:
32b976d3fd10 Release build script.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   239
	@\
32b976d3fd10 Release build script.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   240
echo; \
32b976d3fd10 Release build script.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   241
echo Current configuration:; \
32b976d3fd10 Release build script.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   242
echo; \
32b976d3fd10 Release build script.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   243
sed 's=^=  =' <VERSION
32b976d3fd10 Release build script.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   244
	@if [ -f Makefile.config ]; then \
32b976d3fd10 Release build script.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   245
		echo; \
32b976d3fd10 Release build script.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   246
		echo User configuration:; \
32b976d3fd10 Release build script.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   247
		echo; \
32b976d3fd10 Release build script.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   248
		sed 's=^=  =' <Makefile.config; \
32b976d3fd10 Release build script.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   249
	fi
32b976d3fd10 Release build script.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   250
	@\
32b976d3fd10 Release build script.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   251
echo; \
32b976d3fd10 Release build script.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   252
echo Supported targets:; \
32b976d3fd10 Release build script.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   253
echo; \
32b976d3fd10 Release build script.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   254
sed -n -e '/^[[:alnum:]_-]*:/{s=^\(.*\):.*=  \1=;p;}' $(BUILD_SCRIPTS)
32b976d3fd10 Release build script.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   255
57
94e1b2d0bd31 Add JSDoc annotation.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 50
diff changeset
   256
.PHONY: jsdoc
94e1b2d0bd31 Add JSDoc annotation.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 50
diff changeset
   257
jsdoc:
94e1b2d0bd31 Add JSDoc annotation.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 50
diff changeset
   258
	jsdoc -a -p -d=$(JSDOC_DIR) $(JS_FILES)
94e1b2d0bd31 Add JSDoc annotation.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 50
diff changeset
   259
48
32b976d3fd10 Release build script.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   260
################################################################
32b976d3fd10 Release build script.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   261
# Clean targets.
32b976d3fd10 Release build script.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   262
32b976d3fd10 Release build script.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   263
.PHONY: distclean
32b976d3fd10 Release build script.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   264
distclean: clean
32b976d3fd10 Release build script.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   265
	rm -f VERSION
32b976d3fd10 Release build script.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   266
32b976d3fd10 Release build script.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   267
.PHONY: clean
32b976d3fd10 Release build script.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   268
clean:
77
c2bad6178c65 Add project docs.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 57
diff changeset
   269
	rm -rf $(JSDOC_DIR) $(RST_GEN_FILES) $(RST_HTML_FILES) $(DIST_DIR) $(DIST_TARBALLS)
57
94e1b2d0bd31 Add JSDoc annotation.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 50
diff changeset
   270