source: trunk/m4/yat_svn_release.m4 @ 2112

Last change on this file since 2112 was 2112, checked in by Peter, 13 years ago

Note, this will likely break the Makefile; you need to run autoreconf -m.

Moving maintainer rules to an m4 autoconf macro to make it more
reusable. The macro creates an automake fragment file, which is
included in the top Makefile.am. The macro also searches a tool to
calculate md5sum. We prefer gmd5sum over md5, i.e., on Darwin we
prefer the GNU version installed by port.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id Date
File size: 3.0 KB
Line 
1## $Id: yat_svn_release.m4 2112 2009-11-15 16:59:00Z peter $
2
3# serial 0 
4
5# SYNOPSIS
6#
7#   YAT_SVN_RELEASE
8#
9# DESCRIPTION
10#
11#   Creates a few make rules useful for maintainer. You need to add
12#
13#     include $(srcdir)/maintainer.am
14#
15#   to your top Makefile.am.
16#
17# COPYLEFT
18#
19#   Copyright (C) 2009 Peter Johansson
20#
21#   This file is part of the yat library, http://dev.thep.lu.se/yat
22#
23#   The yat library is free software; you can redistribute it and/or
24#   modify it under the terms of the GNU General Public License as
25#   published by the Free Software Foundation; either version 3 of the
26#   License, or (at your option) any later version.
27#
28#   The yat library is distributed in the hope that it will be useful,
29#   but WITHOUT ANY WARRANTY; without even the implied warranty of
30#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
31#   General Public License for more details.
32#
33#   You should have received a copy of the GNU General Public License
34#   along with yat. If not, see <http://www.gnu.org/licenses/>.
35#
36
37AC_DEFUN([YAT_SVN_RELEASE],
38[
39  AC_REQUIRE([AC_PROG_SED])       
40  AC_REQUIRE([AC_PROG_EGREP])       
41  AC_CHECK_PROGS([MD5], [md5sum gmd5sum md5 md5deep], [no])
42
43  AX_AC_PRINT_TO_FILE([maintainer.am], [
44.PHONY: check-svn-diff check-news check-news-date check-version \\
45        check-release-tools maintainer-check release
46
47# stub rule to work around bug in Automake
48\$(srcdir)/maintainer.am:
49
50check-svn-diff:
51  @str=\`svn diff -rHEAD \$(srcdir)\`; \\
52  if test -n \"\$\$str\"; then \\
53    echo \"\$\$str\" 1>&2;\\
54    exit 1;\\
55  fi
56
57check-news:
58  @case \`sed 15q \$(srcdir)/NEWS\` in \\
59  *\"\$(VERSION)\"*);; \\
60  *) \\
61    echo \"NEWS not updated\" 1>&2; \\
62    exit 1;; \\
63  esac
64
65check-news-date:
66  @today=\`date -u \"+%%e %%B %%Y\"\`; \\
67  case \`sed 15q \$(srcdir)/NEWS\` in \\
68  *\"\$\$today\"*);; \\
69  *) \\
70    echo \"NEWS: release date incorrect; expected '\$\$date'\" 1>&2;\\
71    exit 1;; \\
72  esac
73
74check-version:
75  @echo \$(VERSION) | \$(EGREP) '^[0-9]+(\\.[0-9]+)+\$\$' > /dev/null || \\
76  { echo \"invalid version string: \$(VERSION)\" 1>&2; exit 1; }
77
78check-release-tools:
79  @test \"x\$(MD5)\" != \"xno\" || \\
80  (echo \"no tool to calculate MD5 checksum available\" 1>&2 && exit 1)
81
82mc_exportdir=_exported
83
84maintainer-check:
85  rm -rf \$(mc_exportdir)
86  svn export \$(srcdir) \$(mc_exportdir)
87  mkdir \$(mc_exportdir)/_build
88  @cd \$(mc_exportdir) \\
89  && echo \"./bootstrap\" \\
90  && ./bootstrap \\
91  && cd _build \\
92  && ../configure --srcdir=.. \$(DISTCHECK_CONFIGURE_FLAGS) \\
93  && ( test -z \"\$(MAINTAINER_CHECK_LOCAL)\" || \\
94        \$(MAKE) \$(AM_MAKEFLAGS) \$(MAINTAINER_CHECK_LOCAL) ) \\
95  && \$(MAKE) \$(AM_MAKEFLAGS) dist \\
96  && rm -rf \$(mc_exportdir)
97
98release:
99  \$(MAKE) \$(AM_MAKEFLAGS) check-release-tools
100  @test -z \"\$(RELEASE_LOCAL)\" || \$(MAKE) \$(AM_MAKEFLAGS) \$(RELEASE_LOCAL)
101  \$(MAKE) \$(AM_MAKEFLAGS) check-version
102  \$(MAKE) \$(AM_MAKEFLAGS) check-news
103  \$(MAKE) \$(AM_MAKEFLAGS) check-news-date
104  \$(MAKE) \$(AM_MAKEFLAGS) check-svn-diff
105  \$(MAKE) \$(AM_MAKEFLAGS) maintainer-check
106  \$(MAKE) \$(AM_MAKEFLAGS) distcheck
107  @for a in \$(DIST_ARCHIVES); do \\
108    \$(MD5) \$\$a > \$\$a.MD5 \\
109  done;
110])
111
112]) # YAT_SVN_RELEASE
113
Note: See TracBrowser for help on using the repository browser.