Fix dist-hook to enforce being at $(VERSION)
[platform/upstream/openconnect.git] / Makefile.am
1
2
3 lib_LTLIBRARIES = libopenconnect.la
4 bin_PROGRAMS = openconnect
5 man8_MANS = openconnect.8
6
7 openconnect_SOURCES = xml.c main.c dtls.c cstp.c mainloop.c tun.c
8
9 openconnect_CFLAGS = $(OPENSSL_CFLAGS) $(LIBXML2_CFLAGS) $(LIBPROXY_CFLAGS)
10 openconnect_LDADD = libopenconnect.la $(OPENSSL_LIBS) $(LIBXML2_LIBS) $(LIBPROXY_LIBS)
11
12 libopenconnect_la_SOURCES = ssl.c http.c version.c auth.c library.c
13 libopenconnect_la_CFLAGS = $(OPENSSL_CFLAGS) $(LIBXML2_CFLAGS) $(LIBPROXY_CFLAGS)
14 libopenconnect_la_LIBADD = $(OPENSSL_LIBS) $(LIBXML2_LIBS) $(LIBPROXY_LIBS)
15 libopenconnect_la_LDFLAGS = -version-number 1:2
16 noinst_HEADERS = openconnect-internal.h openconnect.h
17 include_HEADERS = openconnect.h
18
19 pkgconfigdir = $(libdir)/pkgconfig
20 pkgconfig_DATA = openconnect.pc
21
22 EXTRA_DIST = version.sh openconnect.html openconnect.8 COPYING.LGPL
23
24 DISTCLEANFILES = $(pkgconfig_DATA) version.c
25
26 version.c: $(filter-out version.c, $(libopenconnect_la_SOURCES)) \
27            $(openconnect_SOURCES) Makefile.am configure.ac \
28            openconnect.h openconnect-internal.h version.sh \
29            $(wildcard .git/index .git/refs/tags)
30         @./version.sh
31
32 dist-hook:
33         @if ! git rev-parse --verify v$(VERSION) > /dev/null; then \
34                 echo "*** ERROR: Version v$(VERSION) is not tagged"; exit 1; fi
35         @if ! git diff --name-only --exit-code v$(VERSION) HEAD > /dev/null; then \
36                 echo "*** ERROR: Git checkout not at version v$(VERSION)"; exit 1; fi
37         @git update-index --refresh --unmerged
38         @if ! git diff-index --name-only --exit-code HEAD; then \
39                 echo "*** ERROR: Uncommitted changes in above files"; exit 1; fi
40
41  ifdef VERSION
42 tag:
43         @git update-index --refresh --unmerged
44         @if ! git diff-index --name-only --exit-code HEAD; then \
45                 echo "*** ERROR: Uncommitted changes in above files"; exit 1; fi
46         @sed 's/AC_INIT.*/AC_INIT(openconnect, $(VERSION))/' -i configure.ac
47         @sed 's/^v=.*/v="v$(VERSION)"/' -i version.sh
48         @( echo "s/Last modified: .*/Last modified: $(shell date)/" ;\
49            echo '/  <LI><B>OpenConnect HEAD/a\' ;\
50            echo '     <UL>\' ;\
51            echo '       <LI><I>No changelog entries yet</I></LI>\';\
52            echo '     </UL><BR>\' ;  echo '  </LI>\' ;\
53            echo '  <LI><B><A HREF="ftp://ftp.infradead.org/pub/openconnect/openconnect-$(VERSION).tar.gz">OpenConnect v$(VERSION)</a></B> &mdash; $(shell date +%Y-%m-%d)<BR>' ) | \
54                 sed -f - -i openconnect.html
55 # stupid syntax highlighting '
56         @git commit -s -m "Tag version $(VERSION)" configure.ac version.sh openconnect.html
57         @git tag v$(VERSION)
58         @./autogen.sh
59
60  endif