From 641f953d942cbdab5bf0c52265bcc68dbf29e4aa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=A1=D1=82=D1=80=D0=B0=D1=85=D0=B8=D1=9A=D0=B0=20=D0=A0?= =?UTF-8?q?=D0=B0=D0=B4=D0=B8=D1=9B?= Date: Sun, 9 Apr 2023 14:31:33 +0200 Subject: [PATCH] Add config.redo, a persistent build configuration file MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Страхиња Радић --- .gitignore | 2 +- INSTALL | 9 +++++++++ default.o.do | 4 +++- install.do | 4 +++- ufold.do | 4 +++- uninstall.do | 4 +++- 6 files changed, 22 insertions(+), 5 deletions(-) diff --git a/.gitignore b/.gitignore index a6d44fe..27ceaa0 100644 --- a/.gitignore +++ b/.gitignore @@ -15,9 +15,9 @@ nohup.out *.xz *.pdf *.1 +config.redo ufold ufold.1 date version version.h - diff --git a/INSTALL b/INSTALL index 2c7e620..93e0d04 100644 --- a/INSTALL +++ b/INSTALL @@ -4,6 +4,7 @@ Prerequisites * C compiler (GCC-compatible) - ${UFOLD_CC:-gcc -g} * gzip + Install ------- @@ -19,3 +20,11 @@ if you don't: # ./do install + +Persistent build configuration file +----------------------------------- + +If a file config.redo exists in the build directory, it will be sourced when +building targets which also accept configuration through environment variables. +For example, UFOLD_CC and PREFIX can be specified in config.redo, eliminating +the need to pass them with each build. diff --git a/default.o.do b/default.o.do index 7ed6aa9..1d073cb 100644 --- a/default.o.do +++ b/default.o.do @@ -1,6 +1,8 @@ +if [ -r config.redo ]; then + . config.redo +fi for f in *.h; do echo $f done | xargs redo-ifchange redo-ifchange $2.c ${UFOLD_CC:-gcc -g} -Wall -std=c99 -c $2.c -o $3 - diff --git a/install.do b/install.do index 526b09c..515c50c 100644 --- a/install.do +++ b/install.do @@ -1,8 +1,10 @@ redo-ifchange all +if [ -r config.redo ]; then + . config.redo +fi PREFIX=${PREFIX:-/usr/local} BINDIR=$PREFIX/bin MANDIR=$PREFIX/share/man/man1 install -d $BINDIR $MANDIR install -m 0755 ufold $BINDIR install -m 0644 ufold.1.gz $MANDIR - diff --git a/ufold.do b/ufold.do index c11e17b..433cc3b 100644 --- a/ufold.do +++ b/ufold.do @@ -1,3 +1,6 @@ +if [ -r config.redo ]; then + . config.redo +fi for f in *.h.in; do echo $f | sed -e's/\.in$//g' done | xargs redo-ifchange @@ -6,4 +9,3 @@ for f in *.h *.c; do echo $f | sed -e's/\.c$/.o/g' done | xargs redo-ifchange ${UFOLD_CC:-gcc -g} -Wall -std=c99 -o $3 ufold.o utf8.o - diff --git a/uninstall.do b/uninstall.do index 5a69eea..161cc46 100644 --- a/uninstall.do +++ b/uninstall.do @@ -1,6 +1,8 @@ redo-always +if [ -r config.redo ]; then + . config.redo +fi PREFIX=${PREFIX:-/usr/local} BINDIR=$PREFIX/bin MANDIR=$PREFIX/share/man/man1 rm -f $BINDIR/ufold $MANDIR/ufold.1.gz - -- 2.45.2