Makefile
author Oleksandr Gavenko <gavenkoa@gmail.com>
Thu, 11 Sep 2014 03:37:22 +0300
changeset 48 32b976d3fd10
child 49 4b48e9e06000
permissions -rw-r--r--
Release build script.
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}'); \
32b976d3fd10 Release build script.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    51
vmajor=$${vtag#t}; \
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
################################################################
32b976d3fd10 Release build script.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    83
# Project dirs/files.
32b976d3fd10 Release build script.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    84
32b976d3fd10 Release build script.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    85
pkgname = 2048-js-ai
32b976d3fd10 Release build script.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    86
sfpkgname = js-2048-ai
32b976d3fd10 Release build script.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    87
fullpkgname = $(pkgname)-$(vmajor).$(vminor)
32b976d3fd10 Release build script.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    88
32b976d3fd10 Release build script.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    89
DIST_DIR = $(fullpkgname)
32b976d3fd10 Release build script.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    90
32b976d3fd10 Release build script.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    91
WWW_FILES := $(wildcard *.js) $(wildcard *.html)
32b976d3fd10 Release build script.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    92
32b976d3fd10 Release build script.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    93
DIST_FILES = $(WWW_FILES) README.rst VERSION
32b976d3fd10 Release build script.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    94
32b976d3fd10 Release build script.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    95
DIST_TARBALLS = $(DIST_DIR).tar.gz $(DIST_DIR).zip
32b976d3fd10 Release build script.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    96
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
# Deploy targets.
32b976d3fd10 Release build script.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    99
32b976d3fd10 Release build script.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   100
ifeq '' '$(SF_USER)'
32b976d3fd10 Release build script.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   101
  SF_USER := gavenkoa
32b976d3fd10 Release build script.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   102
endif
32b976d3fd10 Release build script.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   103
32b976d3fd10 Release build script.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   104
.PHONY: deploy
32b976d3fd10 Release build script.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   105
deploy: deploy2sf
32b976d3fd10 Release build script.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   106
32b976d3fd10 Release build script.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   107
# First time you deploy to SourceForge (sf) you need manually login to:
32b976d3fd10 Release build script.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   108
#   $ sftp $(SF_USER),$(pkgname)@web.sourceforge.net
32b976d3fd10 Release build script.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   109
# as it may require interactive input for accepting server public key.
32b976d3fd10 Release build script.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   110
# Next time any action fully automated.
32b976d3fd10 Release build script.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   111
32b976d3fd10 Release build script.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   112
.PHONY: deploy2sf
32b976d3fd10 Release build script.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   113
deploy2sf: deploy2sf-src deploy2sf-www deploy2sf-release
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
.PHONY: deploy2sf-src
32b976d3fd10 Release build script.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   116
deploy2sf-src:
32b976d3fd10 Release build script.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   117
	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
   118
32b976d3fd10 Release build script.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   119
# Will be accessed via http://$(pkgname).sourceforge.net
32b976d3fd10 Release build script.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   120
.PHONY: deploy2sf-www
32b976d3fd10 Release build script.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   121
deploy2sf-www: deploy-check $(WWW_FILES)
32b976d3fd10 Release build script.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   122
	( echo 'cd htdocs'; \
32b976d3fd10 Release build script.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   123
for f in $(WWW_FILES); do \
32b976d3fd10 Release build script.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   124
  echo "put $$f"; \
32b976d3fd10 Release build script.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   125
  echo "chmod 644 $$f"; \
32b976d3fd10 Release build script.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   126
done; \
32b976d3fd10 Release build script.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   127
echo 'quit'; \
32b976d3fd10 Release build script.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   128
) | sftp -b - $(SF_USER),$(sfpkgname)@web.sourceforge.net
32b976d3fd10 Release build script.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   129
32b976d3fd10 Release build script.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   130
.PHONY: deploy2sf-release
32b976d3fd10 Release build script.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   131
deploy2sf-release: deploy-check $(DIST_TARBALLS)
32b976d3fd10 Release build script.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   132
	( 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
   133
echo "put  README.rst"; \
32b976d3fd10 Release build script.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   134
echo "chmod 644 README.rst"; \
32b976d3fd10 Release build script.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   135
echo "mkdir v$(vmajor).$(vminor)"; \
32b976d3fd10 Release build script.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   136
echo "cd v$(vmajor).$(vminor)"; \
32b976d3fd10 Release build script.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   137
for f in $(DIST_TARBALLS); do \
32b976d3fd10 Release build script.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   138
	echo "put $$f"; \
32b976d3fd10 Release build script.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   139
	echo "chmod 644 $$f"; \
32b976d3fd10 Release build script.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   140
done; \
32b976d3fd10 Release build script.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   141
echo 'quit'; \
32b976d3fd10 Release build script.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   142
) | sftp -b - $(SF_USER),$(sfpkgname)@frs.sourceforge.net
32b976d3fd10 Release build script.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   143
32b976d3fd10 Release build script.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   144
.PHONY: deploy-check
32b976d3fd10 Release build script.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   145
deploy-check:
32b976d3fd10 Release build script.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   146
	\
32b976d3fd10 Release build script.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   147
case ${visclean} in \
32b976d3fd10 Release build script.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   148
  no) echo "Local changes found. Build stop."; \
32b976d3fd10 Release build script.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   149
    exit 1;; \
32b976d3fd10 Release build script.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   150
esac
32b976d3fd10 Release build script.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   151
	\
32b976d3fd10 Release build script.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   152
case $(vatrelease) in \
32b976d3fd10 Release build script.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   153
  no) echo "We are not at release. Build stop."; \
32b976d3fd10 Release build script.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   154
    exit 1;; \
32b976d3fd10 Release build script.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   155
esac
32b976d3fd10 Release build script.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   156
32b976d3fd10 Release build script.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   157
################################################################
32b976d3fd10 Release build script.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   158
# Dist targets.
32b976d3fd10 Release build script.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   159
32b976d3fd10 Release build script.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   160
.PHONY: dist
32b976d3fd10 Release build script.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   161
dist: dist-bin
32b976d3fd10 Release build script.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   162
32b976d3fd10 Release build script.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   163
.PHONY: dist-bin
32b976d3fd10 Release build script.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   164
dist-release: $(DIST_TARBALLS)
32b976d3fd10 Release build script.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   165
32b976d3fd10 Release build script.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   166
%.tar.gz: %
32b976d3fd10 Release build script.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   167
	tar zcf $*.tar.gz $*
32b976d3fd10 Release build script.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   168
32b976d3fd10 Release build script.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   169
%.tar.bz2: %
32b976d3fd10 Release build script.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   170
	tar jcf $*.tar.bz2 $*
32b976d3fd10 Release build script.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   171
32b976d3fd10 Release build script.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   172
$(DIST_DIR): $(DIST_FILES)
32b976d3fd10 Release build script.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   173
	rm -rf $@
32b976d3fd10 Release build script.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   174
	mkdir $@
32b976d3fd10 Release build script.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   175
	cp $(DIST_FILES) $@
32b976d3fd10 Release build script.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   176
32b976d3fd10 Release build script.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   177
################################################################
32b976d3fd10 Release build script.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   178
# Helpers targets.
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
.PHONY: help
32b976d3fd10 Release build script.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   181
help:
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
echo; \
32b976d3fd10 Release build script.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   184
echo Current configuration:; \
32b976d3fd10 Release build script.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   185
echo; \
32b976d3fd10 Release build script.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   186
sed 's=^=  =' <VERSION
32b976d3fd10 Release build script.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   187
	@if [ -f Makefile.config ]; then \
32b976d3fd10 Release build script.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   188
		echo; \
32b976d3fd10 Release build script.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   189
		echo User configuration:; \
32b976d3fd10 Release build script.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   190
		echo; \
32b976d3fd10 Release build script.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   191
		sed 's=^=  =' <Makefile.config; \
32b976d3fd10 Release build script.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   192
	fi
32b976d3fd10 Release build script.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   193
	@\
32b976d3fd10 Release build script.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   194
echo; \
32b976d3fd10 Release build script.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   195
echo Supported targets:; \
32b976d3fd10 Release build script.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   196
echo; \
32b976d3fd10 Release build script.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   197
sed -n -e '/^[[:alnum:]_-]*:/{s=^\(.*\):.*=  \1=;p;}' $(BUILD_SCRIPTS)
32b976d3fd10 Release build script.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   198
32b976d3fd10 Release build script.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   199
################################################################
32b976d3fd10 Release build script.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   200
# Clean targets.
32b976d3fd10 Release build script.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   201
32b976d3fd10 Release build script.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   202
.PHONY: distclean
32b976d3fd10 Release build script.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   203
distclean: clean
32b976d3fd10 Release build script.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   204
	rm -f VERSION
32b976d3fd10 Release build script.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   205
32b976d3fd10 Release build script.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   206
.PHONY: clean
32b976d3fd10 Release build script.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   207
clean:
32b976d3fd10 Release build script.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   208
	rm -rf $(DIST_DIR) $(DIST_TARBALLS)