Makefile.am 6.46 KB
Newer Older
1

2 3 4 5
SUBDIRS =
if BUILD_WWW
SUBDIRS += www
endif
6
if USE_NLS
7
SUBDIRS += po
8
endif
9 10

lib_LTLIBRARIES = libopenconnect.la
11
sbin_PROGRAMS = openconnect
12 13
man8_MANS = openconnect.8

14
AM_CPPFLAGS = -DLOCALEDIR="\"$(localedir)\""
15 16
openconnect_SOURCES = xml.c main.c dtls.c cstp.c mainloop.c tun.c

17 18
openconnect_CFLAGS = $(SSL_CFLAGS) $(DTLS_SSL_CFLAGS) $(LIBXML2_CFLAGS) $(LIBPROXY_CFLAGS) $(ZLIB_CFLAGS) $(LIBSTOKEN_CFLAGS)
openconnect_LDADD = libopenconnect.la $(SSL_LIBS) $(DTLS_SSL_LIBS) $(LIBXML2_LIBS) $(LIBPROXY_LIBS) $(ZLIB_LIBS) $(LIBINTL) $(LIBSTOKEN_LIBS)
19

20
library_srcs = ssl.c http.c auth.c library.c compat.c
21
lib_srcs_gnutls = gnutls.c gnutls_pkcs12.c gnutls_tpm.c
22
lib_srcs_openssl = openssl.c
23 24 25

POTFILES = $(openconnect_SOURCES) $(lib_srcs_openssl) $(lib_srcs_gnutls) $(library_srcs)

26 27 28 29 30 31
if OPENCONNECT_GNUTLS
library_srcs += $(lib_srcs_gnutls)
endif
if OPENCONNECT_OPENSSL
library_srcs += $(lib_srcs_openssl)
endif
32
libopenconnect_la_SOURCES = version.c $(library_srcs)
33 34
libopenconnect_la_CFLAGS = $(SSL_CFLAGS) $(LIBXML2_CFLAGS) $(LIBPROXY_CFLAGS) $(P11KIT_CFLAGS) $(TSS_CFLAGS) $(LIBSTOKEN_CFLAGS)
libopenconnect_la_LIBADD = $(SSL_LIBS) $(LIBXML2_LIBS) $(LIBPROXY_LIBS) $(LIBINTL) $(P11KIT_LIBS) $(TSS_LIBS) $(LIBSTOKEN_LIBS)
35 36 37 38 39 40 41 42 43
if OPENBSD_LIBTOOL
# OpenBSD's libtool doesn't have -version-number, but its -version-info arg
# does what GNU libtool's -version-number does. Which arguably is what the
# GNU -version-info arg ought to do too. I hate libtool.
LT_VER_ARG = -version-info
else
LT_VER_ARG = -version-number
endif
libopenconnect_la_LDFLAGS = $(LT_VER_ARG) @APIMAJOR@:@APIMINOR@
44
noinst_HEADERS = openconnect-internal.h openconnect.h gnutls.h
45
include_HEADERS = openconnect.h
46
if HAVE_SYMBOL_VERSIONING
47
libopenconnect_la_LDFLAGS += -Wl,@VERSION_SCRIPT_ARG@,libopenconnect.map
48 49
libopenconnect_la_DEPENDENCIES = libopenconnect.map
endif
50 51 52

pkgconfig_DATA = openconnect.pc

53
EXTRA_DIST = version.sh COPYING.LGPL $(lib_srcs_openssl) $(lib_srcs_gnutls) Android.mk
54

55
DISTCLEANFILES = $(pkgconfig_DATA)
56

57
main.o: version.c
58 59
version.c: $(library_srcs) $(lib_openssl_srcs) $(lib_gnutls_srcs) \
	   $(openconnect_SOURCES) Makefile.am configure.ac \
60
	   openconnect.h openconnect-internal.h version.sh @GITVERSIONDEPS@
61
	@cd $(srcdir) && ./version.sh $(abs_builddir)/version.c
62

63
tmp-dist: uncommitted-check
64
	$(MAKE) $(AM_MAKEFLAGS) VERSION=$(patsubst v%,%,$(shell git describe --tags)) DISTHOOK=0 dist
65 66 67 68

uncommitted-check:
	@if ! git update-index --refresh --unmerged || \
	    ! git diff-index --name-only --exit-code HEAD; then \
69
		echo "*** ERROR: Uncommitted changes in above files"; exit 1; fi
70

71
DISTHOOK=1
72
dist-hook: uncommitted-check
73 74 75 76 77 78
	@if [ $(DISTHOOK) = 1 ]; then \
	    if ! git rev-parse --verify v$(VERSION) &> /dev/null; then \
		echo "*** ERROR: Version v$(VERSION) is not tagged"; exit 1; fi ; \
	    if ! git diff --name-only --exit-code v$(VERSION) HEAD > /dev/null; then \
		echo "*** ERROR: Git checkout not at version v$(VERSION)"; exit 1; fi ; \
	fi
79

80 81 82 83 84
sign-dist: dist
	@for a in $(DIST_ARCHIVES); do \
		gpg --default-key 67E2F359 --detach-sign -a $$a ; \
	done

85
tag: uncommitted-check
86
	@if git rev-parse --verify v$(VERSION) &> /dev/null; then \
87
		echo "*** ERROR: Version v$(VERSION) is already tagged"; exit 1; fi
88 89
	@sed 's/AC_INIT.*/AC_INIT(openconnect, $(VERSION))/' -i $(srcdir)/configure.ac
	@sed 's/^v=.*/v="v$(VERSION)"/' -i $(srcdir)/version.sh
90 91 92
	@( echo '1,/<!-- latest-release-start -->/p' ;\
	   echo '/<!-- latest-release-end -->/,$$p' ;\
	   echo  '/<!-- latest-release-start -->/a\' ;\
93 94 95
	   echo  'The latest release is <a href="ftp://ftp.infradead.org/pub/openconnect/openconnect-$(VERSION).tar.gz">OpenConnect v$(VERSION)</a>\' ;\
	   echo  '<i>(<a href="ftp://ftp.infradead.org/pub/openconnect/openconnect-$(VERSION).tar.gz.asc">PGP signature</a>)</i>,\' ;\
	   echo 'released on $(shell date +%Y-%m-%d) with the following changelog:</p>\' ;\
96
	   sed '0,/<b>OpenConnect HEAD/d;/<\/ul><br\/>/,$$d;s/$$/\\/' $(srcdir)/www/changelog.xml ;\
97
	   echo '     </ul>' ) | \
98
	 sed -n -f - -i $(srcdir)/www/download.xml
99
	@( echo "s/Last modified: .*/Last modified: $(shell date)/" ;\
100 101 102 103
	   echo '/  <li><b>OpenConnect HEAD/a\' ;\
	   echo '     <ul>\' ;\
	   echo '       <li><i>No changelog entries yet</i></li>\';\
	   echo '     </ul><br/>\' ;  echo '  </li>\' ;\
104 105
	   echo '  <li><b><a href="ftp://ftp.infradead.org/pub/openconnect/openconnect-$(VERSION).tar.gz">OpenConnect v$(VERSION)</a></b>\' ;\
	   echo '     <i>(<a href="ftp://ftp.infradead.org/pub/openconnect/openconnect-$(VERSION).tar.gz.asc">PGP signature</a>)</i> &#8212; $(shell date +%Y-%m-%d)' ) | \
106
		sed -f - -i $(srcdir)/www/changelog.xml
107
# stupid syntax highlighting '
108
	@cd $(srcdir) && git commit -s -m "Tag version $(VERSION)" configure.ac version.sh www/download.xml www/changelog.xml
109
	@git tag v$(VERSION)
110
	@cd $(srcdir) && ./autogen.sh
111

112
update-translations: po/$(PACKAGE).pot
113 114 115
	@cd $(top_srcdir); if ! git diff-index --name-only --exit-code HEAD -- po/; then \
		echo "*** ERROR: Uncommitted changes in above files"; exit 1; \
	else \
116
		for a in po/*.po; do \
117
			msgmerge -q -N -F $$a $(abs_builddir)/po/$(PACKAGE).pot | sed '0,/^#:/d' > $$a.old ; \
118
		done && \
119 120
		tx pull -af && \
		for a in po/*.po; do \
121 122
			msgmerge -q -N -F $$a $(abs_builddir)/po/$(PACKAGE).pot > $$a.new ; \
			sed '0,/^#:/d' $$a.new > $$a.new.cmp ; \
123 124 125
			if ! git ls-tree --name-only HEAD $$a | grep -q $$a; then \
				echo New file $$a ; \
				git add $$a ; \
126
			elif ! diff -u $$a.old $$a.new.cmp; then \
127 128 129 130 131
				echo New changes for $$a; \
				mv $$a.new $$a; \
			else \
				git checkout -f HEAD $$a ; \
			fi ; \
132
			rm -f $$a.old $$a.new $$a.new.cmp ; \
133
		done && \
134 135 136 137 138 139 140
		ls po/*.po | sed 's%^po/\(.*\)\.po%\1%' > po/LINGUAS ; \
		if ! git update-index -q --refresh --unmerged || \
		   ! git diff-index --name-only --exit-code HEAD -- po/ >/dev/null; then \
			git commit -s -m "Update translations from Transifex" -- po/ ; \
		else \
			echo No changes to commit ; \
		fi ; \
141
	fi
142

143 144
upload-pot: po/$(PACKAGE).pot
	@if [ ${abs_top_builddir} != $(abs_top_srcdir) ]; then \
145
		ln -sf ${abs_top_srcdir}/.tx .tx; fi
146 147 148 149 150 151 152 153 154
	@tx push -s

po/$(PACKAGE).pot: $(POTFILES) Makefile
	@echo "Regenerating $@" ; rm -f $@ && \
	xgettext --directory=$(top_srcdir) --from-code=UTF-8 \
	  --add-comments --keyword=_ --keyword=N_ \
	  --package-name="@PACKAGE@" --package-version="@VERSION@" \
	  --msgid-bugs-address=openconnect-devel@lists.infradead.org \
	  -o $@ $(POTFILES)
155 156 157 158 159 160

Android.mk: Makefile.am
	@for a in openconnect_SOURCES library_srcs lib_srcs_openssl noinst_HEADERS; do \
		FILES=`grep "^$$a = " $(top_srcdir)/Makefile.am`; \
		sed "s/^$$a = .*/$$FILES/" -i $(top_srcdir)/Android.mk;  \
	done