чување b47825ba932940be020be37b96714d7cafaff962
родитељ 0f762f98c66dd86acd857f5954e5521c0666c426
Аутор: Страхиња Радић <contact@strahinja.org>
Датум: Thu, 28 Sep 2023 14:32:30 +0200
Make config.redo behave more like config.mk; synchronize build script changes
with sled
Signed-off-by: Страхиња Радић <contact@strahinja.org>
Diffstat:
измењених датотека: 8, додавања: 14(+), брисања: 24(-)
diff --git a/.gitignore b/.gitignore
@@ -15,7 +15,6 @@ nohup.out
*.xz
*.pdf
*.1
-config.redo
ufold
ufold.1
date
diff --git a/INSTALL b/INSTALL
@@ -1,7 +1,7 @@
Prerequisites
=============
-* C compiler (GCC-compatible) - ${UFOLD_CC:-gcc -g}
+* C compiler - defaults in config.redo
* gzip
@@ -24,7 +24,6 @@ if you don't:
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.
+The file config.redo will be sourced when building targets which also accept
+configuration through environment variables. For example, CC and PREFIX
+are specified in config.redo.
diff --git a/config.redo b/config.redo
@@ -0,0 +1,4 @@
+PREFIX=${PREFIX:-/usr/local}
+CC=${CC:-gcc -g -Wall -pedantic -std=c99 -D_POSIX_C_SOURCE=200809L \
+-D_XOPEN_SOURCE=700 -D_DEFAULT_SOURCE}
+STRIP=${STRIP:-:}
diff --git a/default.o.do b/default.o.do
@@ -1,8 +1,6 @@
-if [ -r ./config.redo ]; then
- . ./config.redo
-fi
+. ./config.redo
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
+${CC} -c $2.c -o $3
diff --git a/install.do b/install.do
@@ -1,8 +1,5 @@
redo-ifchange all
-if [ -r ./config.redo ]; then
- . ./config.redo
-fi
-PREFIX=${PREFIX:-/usr/local}
+. ./config.redo
BINDIR=$PREFIX/bin
MANDIR=$PREFIX/share/man/man1
install -d $BINDIR $MANDIR
diff --git a/ufold.c b/ufold.c
@@ -2,8 +2,6 @@
* any later version. Copyright (C) 2021-2023 Страхиња Радић.
* See the file LICENSE for exact copyright and license details. */
-#define _POSIX_C_SOURCE 200809L
-
#include <errno.h>
#include <stdarg.h>
#include <stdio.h>
diff --git a/ufold.do b/ufold.do
@@ -1,6 +1,4 @@
-if [ -r ./config.redo ]; then
- . ./config.redo
-fi
+. ./config.redo
for f in *.h.in; do
echo $f | sed -e's/\.in$//g'
done | xargs redo-ifchange
@@ -8,4 +6,4 @@ for f in *.h *.c; do
echo $f
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
+${CC} -o $3 ufold.o utf8.o
diff --git a/uninstall.do b/uninstall.do
@@ -1,8 +1,5 @@
redo-always
-if [ -r ./config.redo ]; then
- . ./config.redo
-fi
-PREFIX=${PREFIX:-/usr/local}
+. ./config.redo
BINDIR=$PREFIX/bin
MANDIR=$PREFIX/share/man/man1
rm -f $BINDIR/ufold $MANDIR/ufold.1.gz