EXTRA_DIST += $(shell cd "$(top_srcdir)" && \
git ls-tree HEAD -r --name-only -- android/ java/ trojans/ bash/ 2>/dev/null)
-DISTCLEANFILES = $(pkgconfig_DATA)
+DISTCLEANFILES = $(pkgconfig_DATA) version.c
pkglibexec_SCRIPTS = trojans/csd-post.sh trojans/csd-wrapper.sh trojans/tncc-wrapper.py \
trojans/hipreport.sh trojans/hipreport-android.sh trojans/tncc-emulate.py
ACLOCAL_AMFLAGS = -I m4
if BUILD_NSIS
-# Automatically find DLL dependencies, transitively.
-#
-# Each .d file is auto-generated on demand when Make tries to include
-# it. It is generated by a pattern rule from the corresponding DLL
-# binary, either in the local .libs directory or in the MinGw sys-root
-# which ought to be $(bindir).
-#
-# The Makefile snippet in each generated file adds the full DLL
-# pathname to $(DLLS), adds the .d file itself to the dependencies of
-# file-list.txt, and then includes more .d files for each other DLL
-# that this DLL links to.
-#
-# Because we use -include, we just skip any DLLs we can't find, which
-# will mostly be Windows system runtime stuff like kernel32.dll.
-#
-# The result, after manually -including the top-level .openconnect.exe.d,
-# is that we have a full transitive list of required non-system DLLs
-# in the $(DLLS) variable. Which will contain duplicates, hence the
-# use of $(sort) when writing it out to file-list.txt.
-.%.d: .libs/% Makefile
- ( echo "DLLS += $<" ; \
- echo "file-list.txt: $@" ; \
- mingw-objdump -p "$<" | sed -n '/DLL Name:/{s%^.*DLL Name: %-include .%;s/$$/.d/;p}' | tr A-Z a-z ) > $@
-
-.%.d: $(bindir)/% Makefile
- ( echo "DLLS += $<" ; \
- echo "file-list.txt: $@" ; \
- mingw-objdump -p "$<" | sed -n '/DLL Name:/{s%^.*DLL Name: %-include .%;s/$$/.d/;p}' | tr A-Z a-z ) > $@
-
--include .openconnect.exe.d
+DISTCLEANFILES += .*.dll.d .*.exe.d file-list*.txt instfiles.nsh uninstfiles.nsh vpnc-script-win.js openconnect.nsi openconnect-installer.exe
if OPENCONNECT_WINTUN
--include .wintun.dll.d
+WINTUN_DLL = .libs/wintun.dll
+DISTCLEANFILES += $(WINTUN_DLL)
endif
-file-list.txt: Makefile tap-windows-9.21.2.exe vpnc-script-win.js
- for dll in $(sort $(DLLS)); do echo "$${dll}"; done > $@
+export V AM_DEFAULT_VERBOSITY bindir OBJDUMP
+
+# This Makefile has no rules to create these, just uses them to track
+# dependencies on file-list.txt if it already exists.
+-include .openconnect.exe.d
+-include .wintun.dll.d
+
+file-list.txt: Makefile.dlldeps openconnect$(EXEEXT) libopenconnect.la $(WINTUN_DLL)
+ @$(MAKE) --no-print-directory -f $< $@
# OpenVPN TAP driver for Windows Vista/2003 and newer
# (see https://community.openvpn.net/openvpn/wiki/GettingTapWindows)
# Rather than trying to get clever in NSIS and iterate over lists,
# just emit raw snippets to be included separately in the install
# and uninstall sections.
-instfiles.nsh: file-list.txt file-list-vpnc-script-win.js.txt file-list-tap-windows-9.21.2.exe.txt
- sed 's%\(.*\)%File "\1"%' $^ | tee $@
+instfiles.nsh: file-list.txt file-list-vpnc-script-win.js.txt file-list-$(TAPDRIVER).txt
+ $(AM_V_GEN) cat $^ | while read FILE; do echo "File \"$${FILE}\"" ; done > $@
-uninstfiles.nsh: file-list.txt file-list-vpnc-script-win.js.txt file-list-tap-windows-9.21.2.exe.txt
- sed 's%.*/\(.*\)%Delete /rebootok "$$INSTDIR\\\\\1"%' $^ > $@
+uninstfiles.nsh: file-list.txt file-list-vpnc-script-win.js.txt file-list-$(TAPDRIVER).txt
+ $(AM_V_GEN) cat $^ | while read FILE; do echo "Delete /rebootok \"\$$INSTDIR\\\\$${FILE##*/}\"" ; done > $@
# Theoretically makensis can define symbols with the -D command line
# option and much of this could just be done that way, but I couldn't
# get it to work and life's too short.
openconnect.nsi: version.c
- VERSION=$$(cut -f2 -d\" version.c); \
+ $(AM_V_GEN) VERSION=$$(cut -f2 -d\" version.c); \
PROD_VERSION=$$(echo "$$VERSION" | perl -ne 'm|v(\d+)\.(\d+)(?:\.git\.\|\-)?(\d+)?(?:-g.+\|.*)|; print "$$1.$$2." . ($$3 or "0") . ".0"'); \
if egrep -q '^#define OPENCONNECT_GNUTLS' config.h; then \
TLS_LIBRARY=GnuTLS; \
echo "VIAddVersionKey Comments \"OpenConnect multi-protocol VPN client for Windows (command-line version, built with $$TLS_LIBRARY). For more information, visit http://www.infradead.org/openconnect/\""; \
echo "!include $(srcdir)/openconnect.nsi.in" ) > $@
-openconnect-installer.exe: openconnect.nsi instfiles.nsh uninstfiles.nsh $(srcdir)/openconnect.nsi.in openconnect$(EXEEXT) libopenconnect.la html-recursive tap-windows-9.21.2.exe vpnc-script-win.js
- $(MAKENSIS) $<
+AM_V_MAKENSIS = $(am__v_MAKENSIS_$(V))
+am__v_MAKENSIS_ = $(am__v_MAKENSIS_$(AM_DEFAULT_VERBOSITY))
+am__v_MAKENSIS_0 = @echo " MAKENSIS " $@;
+am__v_MAKENSIS_1 =
+
+openconnect-installer.exe: openconnect.nsi instfiles.nsh uninstfiles.nsh $(srcdir)/openconnect.nsi.in html-recursive
+ $(AM_V_MAKENSIS) $(MAKENSIS) $<
endif
--- /dev/null
+# SPDX-License-Identifier: BSD-2-Clause
+#
+# Automatically find DLL dependencies, transitively.
+#
+# Copyright © 2021 David Woodhouse <dwmw2@infradead.org>
+#
+# Each .d file is auto-generated on demand when make tries to include
+# it. It is generated by a pattern rule from the corresponding DLL
+# binary, either in the local .libs directory or in the MinGw sys-root
+# which ought to be $(bindir).
+#
+# The Makefile snippet in each generated file adds the full DLL
+# pathname to $(DLLS), adds the .d file itself to the dependencies of
+# file-list.txt, and then includes more .d files for each other DLL
+# that this DLL links to.
+#
+# Because we use -include, we just skip any DLLs we can't find, which
+# will mostly be Windows system runtime stuff like kernel32.dll.
+#
+# The result, after manually -including the top-level .openconnect.exe.d,
+# is that we have a full transitive list of required non-system DLLs
+# in the $(DLLS) variable. Which will contain duplicates, hence the
+# use of $(sort) when writing it out to file-list.txt.
+
+AM_V_LISTDLLS = $(am__v_LISTDLLS_$(V))
+am__v_LISTDLLS_ = $(am__v_LISTDLLS_$(AM_DEFAULT_VERBOSITY))
+am__v_LISTDLLS_0 = @echo " LISTDLLS" $<;
+am__v_LISTDLLS_1 =
+
+LISTDLLS_CMD = $(AM_V_LISTDLLS) \
+ ( echo "DLLS += $<" ; echo "file-list.txt: $@" ; \
+ $(OBJDUMP) -p "$<" | sed -n '/DLL Name:/{s%^.*DLL Name: %-include .%;s/$$/.d/;p}' | tr A-Z a-z ) > $@
+
+.%.d: .libs/%
+ $(LISTDLLS_CMD)
+
+.%.d: $(bindir)/%
+ $(LISTDLLS_CMD)
+
+-include .openconnect.exe.d
+-include .wintun.dll.d
+
+AM_V_GEN = $(am__v_GEN_$(V))
+am__v_GEN_ = $(am__v_GEN_$(AM_DEFAULT_VERBOSITY))
+am__v_GEN_0 = @echo " GEN " $@;
+am__v_GEN_1 =
+
+file-list.txt:
+ $(AM_V_GEN) for dll in $(sort $(DLLS)); do echo "$${dll}"; done > $@