Fix out-of-source-tree invocation of version.sh
[platform/upstream/openconnect.git] / Makefile.am
1
2 SUBDIRS =
3 if BUILD_WWW
4 SUBDIRS += www
5 endif
6 if USE_NLS
7 SUBDIRS += po
8 endif
9
10 lib_LTLIBRARIES = libopenconnect.la
11 bin_PROGRAMS = openconnect
12 man8_MANS = openconnect.8
13
14 openconnect_SOURCES = xml.c main.c dtls.c cstp.c mainloop.c tun.c
15
16 openconnect_CFLAGS = $(OPENSSL_CFLAGS) $(LIBXML2_CFLAGS) $(LIBPROXY_CFLAGS) $(ZLIB_CFLAGS)
17 openconnect_LDADD = libopenconnect.la $(OPENSSL_LIBS) $(LIBXML2_LIBS) $(LIBPROXY_LIBS) $(ZLIB_LIBS)
18
19 libopenconnect_la_SOURCES = ssl.c http.c version.c auth.c library.c
20 libopenconnect_la_CFLAGS = $(OPENSSL_CFLAGS) $(LIBXML2_CFLAGS) $(LIBPROXY_CFLAGS)
21 libopenconnect_la_LIBADD = $(OPENSSL_LIBS) $(LIBXML2_LIBS) $(LIBPROXY_LIBS)
22 libopenconnect_la_LDFLAGS = -version-number 1:2
23 noinst_HEADERS = openconnect-internal.h openconnect.h
24 include_HEADERS = openconnect.h
25
26 pkgconfigdir = $(libdir)/pkgconfig
27 pkgconfig_DATA = openconnect.pc
28
29 EXTRA_DIST = version.sh openconnect.html openconnect.8 COPYING.LGPL
30
31 DISTCLEANFILES = $(pkgconfig_DATA) version.c
32
33 version.c: $(filter-out version.c, $(libopenconnect_la_SOURCES)) \
34            $(openconnect_SOURCES) Makefile.am configure.ac \
35            openconnect.h openconnect-internal.h version.sh \
36            $(wildcard .git/index .git/refs/tags)
37         @$(srcdir)/version.sh
38
39 tmp-dist: uncommitted-check
40         $(MAKE) $(AM_MAKEFLAGS) VERSION=$(patsubst v%,%,$(shell git describe --tags)) NODISTHOOK=1 dist
41
42 uncommitted-check:
43         @if ! git update-index --refresh --unmerged || \
44             ! git diff-index --name-only --exit-code HEAD; then \
45                 echo "*** ERROR: Uncommitted changes in above files"; exit 1; fi
46
47 dist-hook: uncommitted-check
48  ifndef NODISTHOOK
49         @if ! git rev-parse --verify v$(VERSION) &> /dev/null; then \
50                 echo "*** ERROR: Version v$(VERSION) is not tagged"; exit 1; fi
51         @if ! git diff --name-only --exit-code v$(VERSION) HEAD > /dev/null; then \
52                 echo "*** ERROR: Git checkout not at version v$(VERSION)"; exit 1; fi
53  endif
54
55 tag: uncommitted-check
56         @if git rev-parse --verify v$(VERSION) &> /dev/null; then \
57                 echo "*** ERROR: Version v$(VERSION) is already tagged"; exit 1; fi
58         @sed 's/AC_INIT.*/AC_INIT(openconnect, $(VERSION))/' -i configure.ac
59         @sed 's/^v=.*/v="v$(VERSION)"/' -i version.sh
60         @( echo '1,/<!-- latest-release-start -->/p' ;\
61            echo '/<!-- latest-release-end -->/,$$p' ;\
62            echo  '/<!-- latest-release-start -->/a\' ;\
63            echo  'The latest release is <a href="ftp://ftp.infradead.org/pub/openconnect/openconnect-$(VERSION).tar.gz">OpenConnect v$(VERSION)</a>, released on $(shell date +%Y-%m-%d) with the following changelog:</p>\' ;\
64            sed '0,/<b>OpenConnect HEAD/d;/<\/ul><br\/>/,$$d;s/$$/\\/' www/changelog.xml ;\
65            echo '     </ul>' ) | \
66          sed -n -f - -i www/download.xml
67         @( echo "s/Last modified: .*/Last modified: $(shell date)/" ;\
68            echo '/  <li><b>OpenConnect HEAD/a\' ;\
69            echo '     <ul>\' ;\
70            echo '       <li><i>No changelog entries yet</i></li>\';\
71            echo '     </ul><br/>\' ;  echo '  </li>\' ;\
72            echo '  <li><b><a href="ftp://ftp.infradead.org/pub/openconnect/openconnect-$(VERSION).tar.gz">OpenConnect v$(VERSION)</a></b> &#8212; $(shell date +%Y-%m-%d)' ) | \
73                 sed -f - -i www/changelog.xml
74 # stupid syntax highlighting '
75         @git commit -s -m "Tag version $(VERSION)" configure.ac version.sh www/download.xml www/changelog.xml
76         @git tag v$(VERSION)
77         @./autogen.sh
78
79 update-translations:
80         @if ! git diff-index --name-only --exit-code HEAD -- po/; then \
81                 echo "*** ERROR: Uncommitted changes in above files"; exit 1; fi
82         @tx pull -af
83         @git commit -s -m "Update translations from Transifex" -- po/
84