Browse Source

rewrite sed logic used in Makefiles and move into dosubst awk script.

include 'bin' and its files in dist files, this is where dosubst is located.

While the invocation (passing of the variables)
is not optimal (yet, will be changed), this
will in the end allow sharing code between Makefiles better,
and maybe drop sed usage in the future.
ng0 4 years ago
parent
commit
c8e5e28048
36 changed files with 118 additions and 95 deletions
  1. 2 2
      Makefile.am
  2. 6 0
      bin/Makefile.am
  3. 47 0
      bin/dosubst.awk
  4. 1 0
      configure.ac
  5. 2 4
      contrib/scripts/Makefile.am
  6. 2 6
      doc/man/Makefile.am
  7. 2 2
      doc/man/produce_html.sh.in
  8. 2 4
      src/arm/Makefile.am
  9. 1 1
      src/arm/test_gnunet_arm.py.in
  10. 1 3
      src/consensus/Makefile.am
  11. 1 1
      src/consensus/consensus-simulation.py.in
  12. 1 7
      src/dht/Makefile.am
  13. 2 2
      src/dht/test_dht_tools.py.in
  14. 4 6
      src/fs/Makefile.am
  15. 1 1
      src/fs/test_gnunet_fs_idx.py.in
  16. 1 1
      src/fs/test_gnunet_fs_psd.py.in
  17. 1 1
      src/fs/test_gnunet_fs_rec.py.in
  18. 2 7
      src/gns/Makefile.am
  19. 10 10
      src/gns/gnunet-gns-proxy-setup-ca.in
  20. 3 3
      src/gns/test_gnunet_gns.sh.in
  21. 9 11
      src/integration-tests/Makefile.am
  22. 1 1
      src/integration-tests/gnunet_pyexpect.py.in
  23. 1 1
      src/integration-tests/gnunet_testing.py.in
  24. 1 1
      src/integration-tests/test_integration_bootstrap_and_connect.py.in
  25. 1 1
      src/integration-tests/test_integration_clique.py.in
  26. 1 1
      src/integration-tests/test_integration_disconnect.py.in
  27. 1 1
      src/integration-tests/test_integration_disconnect_nat.py.in
  28. 1 1
      src/integration-tests/test_integration_reconnect.py.in
  29. 1 1
      src/integration-tests/test_integration_reconnect_nat.py.in
  30. 1 3
      src/peerinfo-tool/Makefile.am
  31. 1 1
      src/peerinfo-tool/test_gnunet_peerinfo.py.in
  32. 1 3
      src/revocation/Makefile.am
  33. 1 1
      src/revocation/test_local_revocation.py.in
  34. 2 4
      src/statistics/Makefile.am
  35. 1 1
      src/statistics/test_gnunet_statistics.py.in
  36. 2 2
      src/transport/gnunet-transport-certificate-creation.in

+ 2 - 2
Makefile.am

@@ -3,9 +3,9 @@ AM_CPPFLAGS = -I$(top_srcdir)/src/include
 
 # only documentation (ALL of the documentation)
 if DOCUMENTATION_ONLY
-  SUBDIRS = doc
+  SUBDIRS = bin doc
 else
-  SUBDIRS = m4 src po pkgconfig
+  SUBDIRS = m4 bin src po pkgconfig
 endif
 
 # documentation on / off switch (affects all of the documentation)

+ 6 - 0
bin/Makefile.am

@@ -0,0 +1,6 @@
+EXTRA_DIST = \
+  dosubst.awk \
+  grephdr.sh \
+  grepsrc.sh \
+  pogen.sh \
+  rename.sh

+ 47 - 0
bin/dosubst.awk

@@ -0,0 +1,47 @@
+# Dedicated to the public domain.
+# SPDX-License-Identifier: 0BSD
+#
+# awk script to substitute variables in scripts and applications.
+#
+# You can pass these variables to it in Makefiles or on the
+# commandline:
+#  bdir="$(bindir)"
+#  py="$(PYTHON)"
+#  awkay="$(AWK_BINARY)"
+#  pfx="$(prefix)"
+#  prl="$(PERL)"
+#  sysconfdirectory="$(sysconfdir)"
+#  pkgdatadirectory="$(pkgdatadir)"
+
+{
+
+  if (/@bindirectory@/) {
+    gsub("@bindirectory@",bdir) ;
+  }
+
+  if (/@PYTHONEXE@/) {
+    gsub("@PYTHONEXE@",py) ;
+  }
+
+  if (/@AWKEXE@/) {
+    gsub("@AWKEXE@",awkay) ;
+  }
+
+  if (/@SUBSTPREFIX@/) {
+    gsub("@SUBSTPREFIX@",pfx) ;
+  }
+
+  if (/@PERLEXE@/) {
+    gsub("@PERLEXE@",prl) ;
+  }
+
+  if (/@SYSCONFDIR@/) {
+    gsub("@SYSCONFDIR@",sysconfdirectory) ;
+  }
+
+  if (/@PKGDATADIRECTORY@/) {
+    gsub("@PKGDATADIRECTORY@",pkgdatadirectory) ;
+  }
+
+  print $0 ;
+}

+ 1 - 0
configure.ac

@@ -1832,6 +1832,7 @@ AC_DEFINE_UNQUOTED(VCS_VERSION, [$vcs_version], [VCS revision/hash or tarball ve
 
 AC_CONFIG_FILES([
 Makefile
+bin/Makefile
 contrib/Makefile
 contrib/hellos/Makefile
 contrib/services/Makefile

+ 2 - 4
contrib/scripts/Makefile.am

@@ -39,8 +39,6 @@ EXTRA_DIST = \
 CLEANFILES = \
   $(noinst_SCRIPTS)
 
-do_subst = $(AWK) -v py="$(PYTHON)" -v awkay="$(AWK_BINARY)" '{if (/@AWKEXE@/) { gsub("@AWKEXE@",awkay)}; gsub("@PYTHONEXE@",py); print $$0}'
-
 # Use SUFFIX Extension rules, they are more portable for every
 # implementation of 'make'.
 # You'll also run into the "'%' is a GNU make extension warning"
@@ -54,11 +52,11 @@ do_subst = $(AWK) -v py="$(PYTHON)" -v awkay="$(AWK_BINARY)" '{if (/@AWKEXE@/) {
 SUFFIXES = .py.in .py
 
 .py.in.py:
-	$(do_subst) < $< > $@
+	$(AWK) -v bdir="$(bindir)" -v py="$(PYTHON)" -v awkay="$(AWK_BINARY)" -v pfx="$(prefix)" -v prl="$(PERL)" -v sysconfdirectory="$(sysconfdir)" -v pkgdatadirectory="$(pkgdatadir)" -f $(top_srcdir)/bin/dosubst.awk < $< > $@
 	chmod +x $@
 
 if HAVE_AWK
 check-texinfo.awk: check-texinfo.awk.in Makefile
-	$(do_subst) < $(srcdir)/check-texinfo.awk.in > check-texinfo.awk
+	$(AWK) -v bdir="$(bindir)" -v py="$(PYTHON)" -v awkay="$(AWK_BINARY)" -v pfx="$(prefix)" -v prl="$(PERL)" -v sysconfdirectory="$(sysconfdir)" -v pkgdatadirectory="$(pkgdatadir)" -f $(top_srcdir)/bin/dosubst.awk < $(srcdir)/check-texinfo.awk.in > check-texinfo.awk
 	chmod +x check-texinfo.awk
 endif

+ 2 - 6
doc/man/Makefile.am

@@ -1,11 +1,7 @@
 # This Makefile.am is in the public domain
 
-do_subst = $(SED) -e 's,[@]SYSCONFDIR[@],$(sysconfdir),g'
-
 gnunet.conf.5: gnunet.conf.5.in Makefile
-	$(do_subst) < $(srcdir)/gnunet.conf.5.in > gnunet.conf.5
-
-do_subst_pkgdatadir = $(SED) -e 's,[@]pkgdatadir[@],$(pkgdatadir),g'
+	$(AWK) -v bdir="$(bindir)" -v py="$(PYTHON)" -v awkay="$(AWK_BINARY)" -v pfx="$(prefix)" -v prl="$(PERL)" -v sysconfdirectory="$(sysconfdir)" -v pkgdatadirectory="$(pkgdatadir)" -f $(top_srcdir)/bin/dosubst.awk < $(srcdir)/gnunet.conf.5.in > $(srcdir)/gnunet.conf.5
 
 CLEANFILES = gnunet.conf.5
 
@@ -28,7 +24,7 @@ if HAVE_MANDOC
 # I want and that the alternatives are depressing and
 # nonfunctional.
 produce_html.sh: produce_html.sh.in Makefile
-	$(do_subst_pkgdatadir) < $(srcdir)/produce_html.sh.in > produce_html.sh
+	$(AWK) -v bdir="$(bindir)" -v py="$(PYTHON)" -v awkay="$(AWK_BINARY)" -v pfx="$(prefix)" -v prl="$(PERL)" -v sysconfdirectory="$(sysconfdir)" -v pkgdatadirectory="$(pkgdatadir)" -f $(top_srcdir)/bin/dosubst.awk < $(srcdir)/produce_html.sh.in > produce_html.sh
 	@chmod +x produce_html.sh
 
 CLEANFILES += produce_html.sh

+ 2 - 2
doc/man/produce_html.sh.in

@@ -1,8 +1,8 @@
 #!/bin/sh
 
-if test -e @pkgdatadir@/existence.sh
+if test -e @PKGDATADIRECTORY@/existence.sh
 then
-    . @pkgdatadir@/existence.sh
+    . @PKGDATADIRECTORY@/existence.sh
 else
     . $dir/../../contrib/build-common/sh/lib.sh/existence.sh
 fi

+ 2 - 4
src/arm/Makefile.am

@@ -88,15 +88,13 @@ test_gnunet_service_arm_SOURCES = \
   libgnunetarm.la \
   $(top_builddir)/src/util/libgnunetutil.la
 
-do_subst = $(SED) -e 's,[@]PYTHON[@],$(PYTHON),g'
-
 SUFFIXES = .py.in .py
 .py.in.py:
-	$(do_subst) < $(srcdir)/$< > $@
+	$(AWK) -v bdir="$(bindir)" -v py="$(PYTHON)" -v awkay="$(AWK_BINARY)" -v pfx="$(prefix)" -v prl="$(PERL)" -v sysconfdirectory="$(sysconfdir)" -v pkgdatadirectory="$(pkgdatadir)" -f $(top_srcdir)/bin/dosubst.awk < $(srcdir)/$< > $@
 	chmod +x $@
 
 test_gnunet_arm.py: test_gnunet_arm.py.in Makefile
-	$(do_subst) < $(srcdir)/test_gnunet_arm.py.in > test_gnunet_arm.py
+	$(AWK) -v bdir="$(bindir)" -v py="$(PYTHON)" -v awkay="$(AWK_BINARY)" -v pfx="$(prefix)" -v prl="$(PERL)" -v sysconfdirectory="$(sysconfdir)" -v pkgdatadirectory="$(pkgdatadir)" -f $(top_srcdir)/bin/dosubst.awk < $(srcdir)/test_gnunet_arm.py.in > test_gnunet_arm.py
 	chmod +x test_gnunet_arm.py
 
 EXTRA_DIST = \

+ 1 - 1
src/arm/test_gnunet_arm.py.in

@@ -1,4 +1,4 @@
-#!@PYTHON@
+#!@PYTHONEXE@
 
 import os
 import sys

+ 1 - 3
src/consensus/Makefile.am

@@ -23,12 +23,10 @@ libexec_PROGRAMS += \
  gnunet-service-evil-consensus
 endif
 
-do_subst = $(SED) -e 's,[@]PYTHON[@],$(PYTHON),g'
-
 SUFFIXES = .py.in .py
 
 .py.in.py:
-	$(do_subst) < $< > $@
+	$(AWK) -v bdir="$(bindir)" -v py="$(PYTHON)" -v awkay="$(AWK_BINARY)" -v pfx="$(prefix)" -v prl="$(PERL)" -v sysconfdirectory="$(sysconfdir)" -v pkgdatadirectory="$(pkgdatadir)" -f $(top_srcdir)/bin/dosubst.awk < $< > $@
 	chmod +x $@
 
 check-python-style:

+ 1 - 1
src/consensus/consensus-simulation.py.in

@@ -1,4 +1,4 @@
-#!@PYTHON@
+#!@PYTHONEXE@
 # This file is part of GNUnet
 # (C) 2013, 2018 Christian Grothoff (and other contributing authors)
 #

+ 1 - 7
src/dht/Makefile.am

@@ -220,13 +220,7 @@ check_SCRIPTS = \
   test_dht_tools.py
 endif
 
-do_subst = $(SED) -e 's,[@]PYTHON[@],$(PYTHON),g' -e 's,[@]bindir[@],$(bindir),g'
-
 SUFFIXES = .py.in .py
 .py.in.py:
-	$(do_subst) < $(srcdir)/$< > $@
+	$(AWK) -v bdir="$(bindir)" -v py="$(PYTHON)" -v awkay="$(AWK_BINARY)" -v pfx="$(prefix)" -v prl="$(PERL)" -v sysconfdirectory="$(sysconfdir)" -v pkgdatadirectory="$(pkgdatadir)" -f $(top_srcdir)/bin/dosubst.awk < $(srcdir)/$< > $@
 	chmod +x $@
-
-test_dht_tools.py: test_dht_tools.py.in Makefile
-	$(do_subst) < $(srcdir)/test_dht_tools.py.in > test_dht_tools.py
-	chmod +x test_dht_tools.py

+ 2 - 2
src/dht/test_dht_tools.py.in

@@ -1,4 +1,4 @@
-#!@PYTHON@
+#!@PYTHONEXE@
 #
 # This testcase simply checks that the DHT command-line tools work.
 # It launches a single peer, stores a value "testdata" under "testkey",
@@ -20,7 +20,7 @@ import subprocess
 import time
 import tempfile
 
-os.environ["PATH"] = "@bindir@" + ":" + os.environ["PATH"]
+os.environ["PATH"] = "@bindirectory@" + ":" + os.environ["PATH"]
 
 if os.name == "nt":
     tmp = os.getenv("TEMP")

+ 4 - 6
src/fs/Makefile.am

@@ -525,22 +525,20 @@ perf_gnunet_service_fs_p2p_respect_LDADD = \
   $(top_builddir)/src/util/libgnunetutil.la
 
 
-do_subst = $(SED) -e 's,[@]PYTHON[@],$(PYTHON),g'
-
 test_gnunet_fs_psd.py: test_gnunet_fs_psd.py.in Makefile
-	$(do_subst) < $(srcdir)/test_gnunet_fs_psd.py.in > test_gnunet_fs_psd.py
+	$(AWK) -v bdir="$(bindir)" -v py="$(PYTHON)" -v awkay="$(AWK_BINARY)" -v pfx="$(prefix)" -v prl="$(PERL)" -v sysconfdirectory="$(sysconfdir)" -v pkgdatadirectory="$(pkgdatadir)" -f $(top_srcdir)/bin/dosubst.awk < $(srcdir)/test_gnunet_fs_psd.py.in > test_gnunet_fs_psd.py
 	chmod +x test_gnunet_fs_psd.py
 
 test_gnunet_fs_rec.py: test_gnunet_fs_rec.py.in Makefile
-	$(do_subst) < $(srcdir)/test_gnunet_fs_rec.py.in > test_gnunet_fs_rec.py
+	$(AWK) -v bdir="$(bindir)" -v py="$(PYTHON)" -v awkay="$(AWK_BINARY)" -v pfx="$(prefix)" -v prl="$(PERL)" -v sysconfdirectory="$(sysconfdir)" -v pkgdatadirectory="$(pkgdatadir)" -f $(top_srcdir)/bin/dosubst.awk < $(srcdir)/test_gnunet_fs_rec.py.in > test_gnunet_fs_rec.py
 	chmod +x test_gnunet_fs_rec.py
 
 test_gnunet_fs_ns.py: test_gnunet_fs_ns.py.in Makefile
-	$(do_subst) < $(srcdir)/test_gnunet_fs_ns.py.in > test_gnunet_fs_ns.py
+	$(AWK) -v bdir="$(bindir)" -v py="$(PYTHON)" -v awkay="$(AWK_BINARY)" -v pfx="$(prefix)" -v prl="$(PERL)" -v sysconfdirectory="$(sysconfdir)" -v pkgdatadirectory="$(pkgdatadir)" -f $(top_srcdir)/bin/dosubst.awk < $(srcdir)/test_gnunet_fs_ns.py.in > test_gnunet_fs_ns.py
 	chmod +x test_gnunet_fs_ns.py
 
 test_gnunet_fs_idx.py: test_gnunet_fs_idx.py.in Makefile
-	$(do_subst) < $(srcdir)/test_gnunet_fs_idx.py.in > test_gnunet_fs_idx.py
+	$(AWK) -v bdir="$(bindir)" -v py="$(PYTHON)" -v awkay="$(AWK_BINARY)" -v pfx="$(prefix)" -v prl="$(PERL)" -v sysconfdirectory="$(sysconfdir)" -v pkgdatadirectory="$(pkgdatadir)" -f $(top_srcdir)/bin/dosubst.awk < $(srcdir)/test_gnunet_fs_idx.py.in > test_gnunet_fs_idx.py
 	chmod +x test_gnunet_fs_idx.py
 
 

+ 1 - 1
src/fs/test_gnunet_fs_idx.py.in

@@ -1,4 +1,4 @@
-#!@PYTHON@
+#!@PYTHONEXE@
 #    This file is part of GNUnet.
 #    (C) 2010 Christian Grothoff (and other contributing authors)
 #

+ 1 - 1
src/fs/test_gnunet_fs_psd.py.in

@@ -1,4 +1,4 @@
-#!@PYTHON@
+#!@PYTHONEXE@
 #    This file is part of GNUnet.
 #    (C) 2010, 2018 Christian Grothoff (and other contributing authors)
 #

+ 1 - 1
src/fs/test_gnunet_fs_rec.py.in

@@ -1,4 +1,4 @@
-#!@PYTHON@
+#!@PYTHONEXE@
 #    This file is part of GNUnet.
 #    (C) 2010 Christian Grothoff (and other contributing authors)
 #

+ 2 - 7
src/gns/Makefile.am

@@ -103,17 +103,12 @@ plugin_LTLIBRARIES = \
 bin_SCRIPTS = \
   gnunet-gns-proxy-setup-ca
 
-# See: https://www.gnu.org/software/automake/manual/html_node/Scripts.html#Scripts
-do_subst = $(SED) -e 's,[@]pkgdatadir[@],$(pkgdatadir),g'
-
 gnunet-gns-proxy-setup-ca: gnunet-gns-proxy-setup-ca.in Makefile
-	$(do_subst) < $(srcdir)/gnunet-gns-proxy-setup-ca.in > gnunet-gns-proxy-setup-ca
+	$(AWK) -v bdir="$(bindir)" -v py="$(PYTHON)" -v awkay="$(AWK_BINARY)" -v pfx="$(prefix)" -v prl="$(PERL)" -v sysconfdirectory="$(sysconfdir)" -v pkgdatadirectory="$(pkgdatadir)" -f $(top_srcdir)/bin/dosubst.awk < $(srcdir)/gnunet-gns-proxy-setup-ca.in > gnunet-gns-proxy-setup-ca
 	@chmod +x gnunet-gns-proxy-setup-ca
 
-do_subst_pkgdatadir = $(SED) -e 's,[@]pkgdatadir[@],$(pkgdatadir),g'
-
 test_gnunet_gns.sh: test_gnunet_gns.sh.in Makefile
-	$(do_subst_pkgdatadir) < $(srcdir)/test_gnunet_gns.sh.in > test_gnunet_gns.sh
+	$(AWK) -v bdir="$(bindir)" -v py="$(PYTHON)" -v awkay="$(AWK_BINARY)" -v pfx="$(prefix)" -v prl="$(PERL)" -v sysconfdirectory="$(sysconfdir)" -v pkgdatadirectory="$(pkgdatadir)" -f $(top_srcdir)/bin/dosubst.awk < $(srcdir)/test_gnunet_gns.sh.in > test_gnunet_gns.sh
 	@chmod +x test_gnunet_gns.sh
 
 CLEANFILES = test_gnunet_gns.sh

+ 10 - 10
src/gns/gnunet-gns-proxy-setup-ca.in

@@ -48,30 +48,30 @@
 
 dir=$(dirname "$0")
 
-if test -e @pkgdatadir@/progname.sh
+if test -e @PKGDATADIRECTORY@/progname.sh
 then
-    . @pkgdatadir@/progname.sh
+    . @PKGDATADIRECTORY@/progname.sh
 else
     . $dir/../../contrib/build-common/sh/lib.sh/progname.sh
 fi
 
-if test -e @pkgdatadir@/existence.sh
+if test -e @PKGDATADIRECTORY@/existence.sh
 then
-    . @pkgdatadir@/existence.sh
+    . @PKGDATADIRECTORY@/existence.sh
 else
     . $dir/../../contrib/build-common/sh/lib.sh/existence.sh
 fi
 
-if test -e @pkgdatadir@/msg.sh
+if test -e @PKGDATADIRECTORY@/msg.sh
 then
-    . @pkgdatadir@/msg.sh
+    . @PKGDATADIRECTORY@/msg.sh
 else
     . $dir/../../contrib/build-common/sh/lib.sh/msg.sh
 fi
 
-if test -e @pkgdatadir@/version_gnunet.sh
+if test -e @PKGDATADIRECTORY@/version_gnunet.sh
 then
-    . @pkgdatadir@/version_gnunet.sh
+    . @PKGDATADIRECTORY@/version_gnunet.sh
 else
     . $dir/../../contrib/build-common/sh/lib.sh/version_gnunet.sh
 fi
@@ -143,8 +143,8 @@ generate_ca()
 
     # ------------- openssl
 
-    GNUTLS_CA_TEMPLATE=@pkgdatadir@/gnunet-gns-proxy-ca.template
-    OPENSSLCFG=@pkgdatadir@/openssl.cnf
+    GNUTLS_CA_TEMPLATE=@PKGDATADIRECTORY@/gnunet-gns-proxy-ca.template
+    OPENSSLCFG=@PKGDATADIRECTORY@/openssl.cnf
     CERTTOOL=""
     OPENSSL=0
     if test -x $(existence gnunet-certtool)

+ 3 - 3
src/gns/test_gnunet_gns.sh.in

@@ -8,9 +8,9 @@
 # but this works for now.
 dir=$(dirname "$0")
 
-if test -e @pkgdatadir@/existence.sh
+if test -e @PKGDATADIRECTORY@/existence.sh
 then
-    . @pkgdatadir@/existence.sh
+    . @PKGDATADIRECTORY@/existence.sh
 else
     . $dir/../../contrib/build-common/sh/lib.sh/existence.sh
 fi
@@ -22,7 +22,7 @@ fi
 $LOCATION --version
 if test $? != 0
 then
-    echo "GNUnet command line tools cannot be found, check environmental variables PATH and GNUNET_PREFIX" 
+    echo "GNUnet command line tools cannot be found, check environmental variables PATH and GNUNET_PREFIX"
     exit 77
 fi
 

+ 9 - 11
src/integration-tests/Makefile.am

@@ -36,43 +36,41 @@ endif
 endif
 endif
 
-do_subst = $(SED) -e 's,[@]PYTHON[@],$(PYTHON),g'
-
 SUFFIXES = .py.in .py
 .py.in.py:
-	$(do_subst) < $(srcdir)/$< > $@
+	$(AWK) -v bdir="$(bindir)" -v py="$(PYTHON)" -v awkay="$(AWK_BINARY)" -v pfx="$(prefix)" -v prl="$(PERL)" -v sysconfdirectory="$(sysconfdir)" -v pkgdatadirectory="$(pkgdatadir)" -f $(top_srcdir)/bin/dosubst.awk < $(srcdir)/$< > $@
 	chmod +x $@
 
 gnunet_testing.py: gnunet_testing.py.in Makefile
-	$(do_subst) < $(srcdir)/gnunet_testing.py.in > gnunet_testing.py
+	$(AWK) -v bdir="$(bindir)" -v py="$(PYTHON)" -v awkay="$(AWK_BINARY)" -v pfx="$(prefix)" -v prl="$(PERL)" -v sysconfdirectory="$(sysconfdir)" -v pkgdatadirectory="$(pkgdatadir)" -f $(top_srcdir)/bin/dosubst.awk < $(srcdir)/gnunet_testing.py.in > gnunet_testing.py
 	chmod +x gnunet_testing.py
 
 gnunet_pyexpect.py: gnunet_pyexpect.py.in Makefile
-	$(do_subst) < $(srcdir)/gnunet_pyexpect.py.in > gnunet_pyexpect.py
+	$(AWK) -v bdir="$(bindir)" -v py="$(PYTHON)" -v awkay="$(AWK_BINARY)" -v pfx="$(prefix)" -v prl="$(PERL)" -v sysconfdirectory="$(sysconfdir)" -v pkgdatadirectory="$(pkgdatadir)" -f $(top_srcdir)/bin/dosubst.awk < $(srcdir)/gnunet_pyexpect.py.in > gnunet_pyexpect.py
 	chmod +x gnunet_pyexpect.py
 
 test_integration_bootstrap_and_connect.py: test_integration_bootstrap_and_connect.py.in Makefile
-	$(do_subst) < $(srcdir)/test_integration_bootstrap_and_connect.py.in > test_integration_bootstrap_and_connect.py
+	$(AWK) -v bdir="$(bindir)" -v py="$(PYTHON)" -v awkay="$(AWK_BINARY)" -v pfx="$(prefix)" -v prl="$(PERL)" -v sysconfdirectory="$(sysconfdir)" -v pkgdatadirectory="$(pkgdatadir)" -f $(top_srcdir)/bin/dosubst.awk < $(srcdir)/test_integration_bootstrap_and_connect.py.in > test_integration_bootstrap_and_connect.py
 	chmod +x test_integration_bootstrap_and_connect.py
 
 test_integration_disconnect.py: test_integration_disconnect.py.in Makefile
-	$(do_subst) < $(srcdir)/test_integration_disconnect.py.in > test_integration_disconnect.py
+	$(AWK) -v bdir="$(bindir)" -v py="$(PYTHON)" -v awkay="$(AWK_BINARY)" -v pfx="$(prefix)" -v prl="$(PERL)" -v sysconfdirectory="$(sysconfdir)" -v pkgdatadirectory="$(pkgdatadir)" -f $(top_srcdir)/bin/dosubst.awk < $(srcdir)/test_integration_disconnect.py.in > test_integration_disconnect.py
 	chmod +x test_integration_disconnect.py
 
 test_integration_disconnect_nat.py: test_integration_disconnect_nat.py.in Makefile
-	$(do_subst) < $(srcdir)/test_integration_disconnect_nat.py.in > test_integration_disconnect_nat.py
+	$(AWK) -v bdir="$(bindir)" -v py="$(PYTHON)" -v awkay="$(AWK_BINARY)" -v pfx="$(prefix)" -v prl="$(PERL)" -v sysconfdirectory="$(sysconfdir)" -v pkgdatadirectory="$(pkgdatadir)" -f $(top_srcdir)/bin/dosubst.awk < $(srcdir)/test_integration_disconnect_nat.py.in > test_integration_disconnect_nat.py
 	chmod +x test_integration_disconnect_nat.py
 
 test_integration_reconnect.py: test_integration_reconnect.py.in Makefile
-	$(do_subst) < $(srcdir)/test_integration_reconnect.py.in > test_integration_reconnect.py
+	$(AWK) -v bdir="$(bindir)" -v py="$(PYTHON)" -v awkay="$(AWK_BINARY)" -v pfx="$(prefix)" -v prl="$(PERL)" -v sysconfdirectory="$(sysconfdir)" -v pkgdatadirectory="$(pkgdatadir)" -f $(top_srcdir)/bin/dosubst.awk < $(srcdir)/test_integration_reconnect.py.in > test_integration_reconnect.py
 	chmod +x test_integration_reconnect.py
 
 test_integration_reconnect_nat.py: test_integration_reconnect_nat.py.in Makefile
-	$(do_subst) < $(srcdir)/test_integration_reconnect_nat.py.in > test_integration_reconnect_nat.py
+	$(AWK) -v bdir="$(bindir)" -v py="$(PYTHON)" -v awkay="$(AWK_BINARY)" -v pfx="$(prefix)" -v prl="$(PERL)" -v sysconfdirectory="$(sysconfdir)" -v pkgdatadirectory="$(pkgdatadir)" -f $(top_srcdir)/bin/dosubst.awk < $(srcdir)/test_integration_reconnect_nat.py.in > test_integration_reconnect_nat.py
 	chmod +x test_integration_reconnect_nat.py
 
 test_integration_clique.py: test_integration_clique.py.in Makefile
-	$(do_subst) < $(srcdir)/test_integration_clique.py.in > test_integration_clique.py
+	$(AWK) -v bdir="$(bindir)" -v py="$(PYTHON)" -v awkay="$(AWK_BINARY)" -v pfx="$(prefix)" -v prl="$(PERL)" -v sysconfdirectory="$(sysconfdir)" -v pkgdatadirectory="$(pkgdatadir)" -f $(top_srcdir)/bin/dosubst.awk < $(srcdir)/test_integration_clique.py.in > test_integration_clique.py
 	chmod +x test_integration_clique.py
 
 

+ 1 - 1
src/integration-tests/gnunet_pyexpect.py.in

@@ -1,4 +1,4 @@
-#!@PYTHON@
+#!@PYTHONEXE@
 #    This file is part of GNUnet.
 #    (C) 2010 Christian Grothoff (and other contributing authors)
 #

+ 1 - 1
src/integration-tests/gnunet_testing.py.in

@@ -1,4 +1,4 @@
-#!@PYTHON@
+#!@PYTHONEXE@
 #    This file is part of GNUnet.
 #    (C) 2010, 2017, 2018 Christian Grothoff (and other contributing authors)
 #

+ 1 - 1
src/integration-tests/test_integration_bootstrap_and_connect.py.in

@@ -1,4 +1,4 @@
-#!@PYTHON@
+#!@PYTHONEXE@
 #    This file is part of GNUnet.
 #    (C) 2010, 2018 Christian Grothoff (and other contributing authors)
 #

+ 1 - 1
src/integration-tests/test_integration_clique.py.in

@@ -1,4 +1,4 @@
-#!@PYTHON@
+#!@PYTHONEXE@
 #    This file is part of GNUnet.
 #    (C) 2010, 2018 Christian Grothoff (and other contributing authors)
 #

+ 1 - 1
src/integration-tests/test_integration_disconnect.py.in

@@ -1,4 +1,4 @@
-#!@PYTHON@
+#!@PYTHONEXE@
 #    This file is part of GNUnet.
 #    (C) 2010, 2017 Christian Grothoff (and other contributing authors)
 #

+ 1 - 1
src/integration-tests/test_integration_disconnect_nat.py.in

@@ -1,4 +1,4 @@
-#!@PYTHON@
+#!@PYTHONEXE@
 #    This file is part of GNUnet.
 #    (C) 2010, 2018 Christian Grothoff (and other contributing authors)
 #

+ 1 - 1
src/integration-tests/test_integration_reconnect.py.in

@@ -1,4 +1,4 @@
-#!@PYTHON@
+#!@PYTHONEXE@
 #    This file is part of GNUnet.
 #    (C) 2010, 2017 Christian Grothoff (and other contributing authors)
 #

+ 1 - 1
src/integration-tests/test_integration_reconnect_nat.py.in

@@ -1,4 +1,4 @@
-#!@PYTHON@
+#!@PYTHONEXE@
 #    This file is part of GNUnet.
 #    (C) 2010, 2018 Christian Grothoff (and other contributing authors)
 #

+ 1 - 3
src/peerinfo-tool/Makefile.am

@@ -56,10 +56,8 @@ AM_TESTS_ENVIRONMENT=export GNUNET_PREFIX=$${GNUNET_PREFIX:-@libdir@};export PAT
 TESTS = $(check_SCRIPTS)
 endif
 
-do_subst = $(SED) -e 's,[@]PYTHON[@],$(PYTHON),g'
-
 test_gnunet_peerinfo.py: test_gnunet_peerinfo.py.in Makefile
-	$(do_subst) < $(srcdir)/test_gnunet_peerinfo.py.in > test_gnunet_peerinfo.py
+	$(AWK) -v bdir="$(bindir)" -v py="$(PYTHON)" -v awkay="$(AWK_BINARY)" -v pfx="$(prefix)" -v prl="$(PERL)" -v sysconfdirectory="$(sysconfdir)" -v pkgdatadirectory="$(pkgdatadir)" -f $(top_srcdir)/bin/dosubst.awk < $(srcdir)/test_gnunet_peerinfo.py.in > test_gnunet_peerinfo.py
 	chmod +x test_gnunet_peerinfo.py
 
 EXTRA_DIST = \

+ 1 - 1
src/peerinfo-tool/test_gnunet_peerinfo.py.in

@@ -1,4 +1,4 @@
-#!@PYTHON@
+#!@PYTHONEXE@
 #    This file is part of GNUnet.
 #    (C) 2010, 2018 Christian Grothoff (and other contributing authors)
 #

+ 1 - 3
src/revocation/Makefile.am

@@ -90,10 +90,8 @@ if ENABLE_TEST_RUN
  $(check_PROGRAMS)
 endif
 
-do_subst = $(SED) -e 's,[@]PYTHON[@],$(PYTHON),g'
-
 test_local_revocation.py: test_local_revocation.py.in Makefile
-	$(do_subst) < $(srcdir)/test_local_revocation.py.in > test_local_revocation.py
+	$(AWK) -v bdir="$(bindir)" -v py="$(PYTHON)" -v awkay="$(AWK_BINARY)" -v pfx="$(prefix)" -v prl="$(PERL)" -v sysconfdirectory="$(sysconfdir)" -v pkgdatadirectory="$(pkgdatadir)" -f $(top_srcdir)/bin/dosubst.awk < $(srcdir)/test_local_revocation.py.in > test_local_revocation.py
 	chmod +x test_local_revocation.py
 
 EXTRA_DIST = test_revocation.conf \

+ 1 - 1
src/revocation/test_local_revocation.py.in

@@ -1,4 +1,4 @@
-#!@PYTHON@
+#!@PYTHONEXE@
 #    This file is part of GNUnet.
 #    (C) 2010, 2018 Christian Grothoff (and other contributing authors)
 #

+ 2 - 4
src/statistics/Makefile.am

@@ -84,15 +84,13 @@ check_SCRIPTS = \
   test_gnunet_statistics.py
 endif
 
-do_subst = $(SED) -e 's,[@]PYTHON[@],$(PYTHON),g'
-
 SUFFIXES = .py.in .py
 .py.in.py:
-	$(do_subst) < $(srcdir)/$< > $@
+	$(AWK) -v bdir="$(bindir)" -v py="$(PYTHON)" -v awkay="$(AWK_BINARY)" -v pfx="$(prefix)" -v prl="$(PERL)" -v sysconfdirectory="$(sysconfdir)" -v pkgdatadirectory="$(pkgdatadir)" -f $(top_srcdir)/bin/dosubst.awk < $(srcdir)/$< > $@
 	chmod +x $@
 
 test_gnunet_statistics.py: test_gnunet_statistics.py.in Makefile
-	$(do_subst) < $(srcdir)/test_gnunet_statistics.py.in > test_gnunet_statistics.py
+	$(AWK) -v bdir="$(bindir)" -v py="$(PYTHON)" -v awkay="$(AWK_BINARY)" -v pfx="$(prefix)" -v prl="$(PERL)" -v sysconfdirectory="$(sysconfdir)" -v pkgdatadirectory="$(pkgdatadir)" -f $(top_srcdir)/bin/dosubst.awk < $(srcdir)/test_gnunet_statistics.py.in > test_gnunet_statistics.py
 	chmod +x test_gnunet_statistics.py
 
 EXTRA_DIST = \

+ 1 - 1
src/statistics/test_gnunet_statistics.py.in

@@ -1,4 +1,4 @@
-#!@PYTHON@
+#!@PYTHONEXE@
 
 import os
 import sys

+ 2 - 2
src/transport/gnunet-transport-certificate-creation.in

@@ -101,9 +101,9 @@ generate_cert_key()
 {
     echo ""
     infomsg "Generating Cert and Key"
-   
+
     CERTTOOL=""
-    GNUTLS_CA_TEMPLATE=@pkgdatadir@/gnunet-gns-proxy-ca.template
+    GNUTLS_CA_TEMPLATE=@PKGDATADIRECTORY@/gnunet-gns-proxy-ca.template
     OPENSSL=0
     if test -z "`gnutls-certtool --version`" > /dev/null
     then