Improve the release make targets
[nobug] / Makefile.am
1 # This file is part of the NoBug debugging library.
2 #
3 # Copyright (C)
4 #   2007, 2008, 2009,   Christian Thaeter <ct@pipapo.org>
5 #
6 # This program is free software; you can redistribute it and/or modify
7 # it under the terms of the GNU General Public License as published by
8 # the Free Software Foundation; either version 2 of the License, or
9 # (at your option) any later version.
10 #
11 # This program is distributed in the hope that it will be useful,
12 # but WITHOUT ANY WARRANTY; without even the implied warranty of
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14 # GNU General Public License for more details.
15 #
16 # You should have received a copy of the GNU General Public License
17 # along with this program; if not, contact Christian Thaeter <ct@pipapo.org>.
18
19 include_HEADERS                         = src/nobug.h
20 pcdir                                   = $(libdir)/pkgconfig
21 pc_DATA                                 = nobug.pc nobugmt.pc
22
23 ACLOCAL_AMFLAGS = -I m4
24
25 AM_CFLAGS = $(CONF_CFLAGS) -D_GNU_SOURCE
26
27 libnobug_version = 2:0:0
28
29 CLEANFILES =
30 EXTRA_DIST =
31
32 ##### single-threading variant
33
34 lib_LTLIBRARIES                         = libnobug.la
35 libnobug_la_SOURCES                     = src/nobug.c src/nobug_env.c src/nobug_ringbuffer.c src/nobug_resources.c src/mpool.c
36 libnobug_la_CFLAGS                      = $(AM_CFLAGS) @VALGRIND_CFLAGS@
37 libnobug_la_CPPFLAGS                    = -DNOBUG_USE_PTHREAD=0
38 libnobug_la_LDFLAGS                     = -version-info $(libnobug_version)
39
40
41 bin_PROGRAMS                            = nobug_rbdump
42 nobug_rbdump_SOURCES                    = src/nobug_rbdump.c
43 nobug_rbdump_LDADD                      = libnobug.la
44 nobug_rbdump_CFLAGS                     = $(AM_CFLAGS) @VALGRIND_CFLAGS@
45
46 noinst_HEADERS                          = src/llist.h src/mpool.h
47
48 ##### multi-threading variant
49
50 if HAVE_THREADING
51
52 lib_LTLIBRARIES                         += libnobugmt.la
53 libnobugmt_la_SOURCES                   = src/nobug.c src/nobug_env.c src/nobug_ringbuffer.c src/nobug_resources.c src/nobug_thread.c src/mpool.c
54 libnobugmt_la_CFLAGS                    = $(AM_CFLAGS) @PTHREAD_CFLAGS@ @VALGRIND_CFLAGS@
55 libnobugmt_la_LDFLAGS                   = -version-info $(libnobug_version)
56
57 endif   # HAVE_THREADING
58
59 ##### Testsuite
60
61 include tests/Makefile.am
62
63
64 ##### maintainer targets
65 CLEANFILES      += nobug_manual.txt
66 EXTRA_DIST      += pipadoc doc/nobug_manual.conf doc/asciidoc.pawk doc/verbatim.pawk
67
68 manual_ASCIIDOCS = \
69         $(include_HEADERS) \
70         $(libnobugmt_la_SOURCES) \
71         $(nobug_rbdump_SOURCES)
72
73 nobug_manual.txt: doc/nobug_manual.conf doc/asciidoc.pawk doc/verbatim.pawk $(manual_ASCIIDOCS) $(wildcard $(top_srcdir)/doc/*.txt)
74         @which gawk >/dev/null || ( echo "gawk not installed!"; exit 1; )
75         ( cd $(top_srcdir) ; ./pipadoc doc/nobug_manual.conf doc/asciidoc.pawk doc/verbatim.pawk        \
76                 $(patsubst $(top_srcdir)/%,%,$(wildcard $(top_srcdir)/doc/*.txt))               \
77                 $(manual_ASCIIDOCS) ) >$(top_builddir)/nobug_manual.txt
78
79
80 test_manual.txt: doc/asciidoc.pawk tests/test.sh
81         @which gawk >/dev/null || ( echo "gawk not installed!"; exit 1; )
82         ( cd $(top_srcdir); COM='#' ./pipadoc doc/asciidoc.pawk tests/test.sh ) >$(top_builddir)/test_manual.txt
83
84 .txt.html:
85         asciidoc -a toc $<
86
87 .txt.pdf:
88         a2x -f pdf $<
89
90 .txt.ps: .txt
91         a2x -f ps $<
92
93 doc: nobug_manual.html nobug_manual.pdf
94 # TODO create manpage
95
96 README: nobug_manual.txt
97         cp nobug_manual.txt $(top_srcdir)/README || true
98         git add $(top_srcdir)/README
99
100 ChangeLog.new:
101         @cd $(top_srcdir);                                                                              \
102         git whatchanged --pretty=format:"%n%ai %h%n%aN <%aE>%n%n%s%n%n%b" latest-release..HEAD |        \
103          sed -e 's/^:.*\.\.\.//' >ChangeLog.new;
104
105
106 ChangeLog: ChangeLog.new
107         @cd $(top_srcdir);                                      \
108         mv ChangeLog ChangeLog.bak;                             \
109         echo >.newline;                                         \
110         cat ChangeLog.new .newline ChangeLog.bak >ChangeLog;    \
111         rm .newline ChangeLog.new;                              \
112         git add ChangeLog
113
114 NEWS.new:
115         @cd $(top_srcdir);                                      \
116         admin/get_version.sh >NEWS.new;                         \
117         echo "--------" >>NEWS.new;                             \
118         date "+%d %b %Y" >>NEWS.new;                            \
119         echo >>NEWS.new;                                        \
120         git shortlog latest-release..HEAD >>NEWS.new;           \
121         echo -e "\n EDIT NEWS.new and then hit enter\n";        \
122         read;
123
124 NEWS: NEWS.new
125         @cd $(top_srcdir);                              \
126         mv NEWS NEWS.old;                               \
127         echo >.newline;                                 \
128         cat NEWS.new .newline .newline NEWS.old > NEWS; \
129         rm .newline NEWS.new;                           \
130         git add NEWS;
131
132
133 release-tag: NEWS ChangeLog README
134         @cd $(top_srcdir);                                                                      \
135         git commit -m "This is release $$(admin/get_version.sh)";                               \
136         git tag -f -s -m "This is release $$(admin/get_version.sh)" $$(admin/get_version.sh);   \
137         git tag -f latest-release;
138
139
140 release:
141         git stash
142         @cd $(top_srcdir); admin/update_version.sh;
143         $(MAKE) release-tag
144         $(MAKE) dist
145         list='$(DIST_ARCHIVES)'; for i in $$list; do    \
146                 gpg -s $$i;                             \
147         done
148         git stash apply