diff options
author | Dmitry Eremin-Solenikov <dbaryshkov@gmail.com> | 2018-11-06 14:34:18 +0300 |
---|---|---|
committer | Dmitry Eremin-Solenikov <dbaryshkov@gmail.com> | 2018-11-10 00:24:31 +0300 |
commit | db18d40f1fefca9becdab70f85c6332ae85e44a7 (patch) | |
tree | b5a19d44f7b6f236e3efa18fbfbe85218bd42343 | |
parent | 57f8035ac0158318e30b94134d8dbeb4c0c5e4e9 (diff) | |
download | gnutls-db18d40f1fefca9becdab70f85c6332ae85e44a7.tar.gz |
src: update .bak files during -args.c/.h regeneration
To ease updating of .bak files, update them when regenerating
Autogen'erated source files.
Signed-off-by: Dmitry Eremin-Solenikov <dbaryshkov@gmail.com>
-rw-r--r-- | src/Makefile.am | 28 | ||||
-rwxr-xr-x | src/args-bak-upd.sh | 37 |
2 files changed, 52 insertions, 13 deletions
diff --git a/src/Makefile.am b/src/Makefile.am index 3df3d939f4..be313f47ea 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -28,12 +28,14 @@ BUILT_SOURCES = srptool-args.c srptool-args.h \ tpmtool-args.c tpmtool-args.h systemkey-args.c systemkey-args.h \ mech-list.h -DISTCLEANFILES =$(BUILT_SOURCES) \ +ARGS_STAMPS = \ certtool-args.stamp cli-debug-args.stamp cli-args.stamp tpmtool-args.stamp \ systemkey-args.stamp srptool-args.stamp ocsptool-args.stamp p11tool-args.stamp \ danetool-args.stamp serv-args.stamp psktool-args.stamp -EXTRA_DIST = gen-mech-list.sh +DISTCLEANFILES = $(BUILT_SOURCES) $(ARGS_STAMPS) + +EXTRA_DIST = gen-mech-list.sh args-bak-upd.sh AM_CFLAGS = $(WARN_CFLAGS) $(WERROR_CFLAGS) AM_CPPFLAGS = \ @@ -250,36 +252,42 @@ ocsptool-args.h: ocsptool-args.stamp ocsptool-args.c: ocsptool-args.stamp ocsptool-args.stamp: $(srcdir)/ocsptool-args.def args-std.def -$(AUTOGEN) $< + -$(srcdir)/args-bak-upd.sh $@ $(srcdir) touch $@ tpmtool-args.h: tpmtool-args.stamp tpmtool-args.c: tpmtool-args.stamp tpmtool-args.stamp: $(srcdir)/tpmtool-args.def args-std.def -$(AUTOGEN) $< + -$(srcdir)/args-bak-upd.sh $@ $(srcdir) touch $@ p11tool-args.h: p11tool-args.stamp p11tool-args.c: p11tool-args.stamp p11tool-args.stamp: $(srcdir)/p11tool-args.def args-std.def -$(AUTOGEN) $< + -$(srcdir)/args-bak-upd.sh $@ $(srcdir) touch $@ psktool-args.h: psktool-args.stamp psktool-args.c: psktool-args.stamp psktool-args.stamp: $(srcdir)/psktool-args.def args-std.def -$(AUTOGEN) $< + -$(srcdir)/args-bak-upd.sh $@ $(srcdir) touch $@ cli-debug-args.h: cli-debug-args.stamp cli-debug-args.c: cli-debug-args.stamp cli-debug-args.stamp: $(srcdir)/cli-debug-args.def args-std.def -$(AUTOGEN) $< + -$(srcdir)/args-bak-upd.sh $@ $(srcdir) touch $@ cli-args.h: cli-args.stamp cli-args.c: cli-args.stamp cli-args.stamp: $(srcdir)/cli-args.def args-std.def -$(AUTOGEN) $< + -$(srcdir)/args-bak-upd.sh $@ $(srcdir) touch $@ serv-args.h: serv-args.stamp @@ -292,18 +300,21 @@ srptool-args.h: srptool-args.stamp srptool-args.c: srptool-args.stamp srptool-args.stamp: $(srcdir)/srptool-args.def args-std.def -$(AUTOGEN) $< + -$(srcdir)/args-bak-upd.sh $@ $(srcdir) touch $@ certtool-args.h: certtool-args.stamp certtool-args.c: certtool-args.stamp certtool-args.stamp: $(srcdir)/certtool-args.def args-std.def -$(AUTOGEN) $< + -$(srcdir)/args-bak-upd.sh $@ $(srcdir) touch $@ systemkey-args.h: systemkey-args.stamp systemkey-args.c: systemkey-args.stamp systemkey-args.stamp: $(srcdir)/systemkey-args.def args-std.def -$(AUTOGEN) $< + -$(srcdir)/args-bak-upd.sh $@ $(srcdir) touch $@ mech-list.h: gen-mech-list.sh @@ -313,16 +324,7 @@ mech-list.h: gen-mech-list.sh maintainer-clean-local: rm -f *.stamp mech-list.h -files-update: +files-update: $(ARGS_STAMPS) @echo "******************************************************************************************" - @echo "updating autogen files in src/" + @echo "updated autogen files in src/" @echo "******************************************************************************************" - for i in *-args.c *-args.h;do \ - if ! test -h "$$i" ; then \ - if test "$(srcdir)" = "." ; then \ - cp "$$i" "$$i.bak" ; \ - else \ - sed -e "s!$(srcdir)/!!g" "$$i" > $(srcdir)/`basename "$$i"`.bak ; \ - fi; \ - fi; \ - done diff --git a/src/args-bak-upd.sh b/src/args-bak-upd.sh new file mode 100755 index 0000000000..2da5eb5b93 --- /dev/null +++ b/src/args-bak-upd.sh @@ -0,0 +1,37 @@ +#!/bin/sh + +# Copyright (C) 2018 Dmitry Eremin-Solenikov +# +# This file is part of GnuTLS. +# +# GnuTLS is free software; you can redistribute it and/or modify it +# under the terms of the GNU General Public License as published by the +# Free Software Foundation; either version 3 of the License, or (at +# your option) any later version. +# +# GnuTLS is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see <http://www.gnu.org/licenses/>. + +# Usage: args-bak-upd.sh file.stamp srcdir + +# update_file file srcdir +update_file() { + if ! test -h "$1" + then + if test "$2" = "." + then + cp "$1" "$1".bak + else + sed -e "s!$2/!!g" "$1" > "$2"/"$1".bak + fi + fi +} + +BASENAME="`basename "$1" .stamp`" +update_file "${BASENAME}.c" "$2" +update_file "${BASENAME}.c" "$2" |