commit: f22ffd1d5459ba441fc513e98295f758edd2a1a2
parent a29304e9950e334393bbc20c937d9e33c61c6a03
Author: Haelwenn (lanodan) Monnier <contact@hacktivis.me>
Date: Fri, 24 May 2024 00:56:45 +0200
configure: Turn target_filter into a variable
This allows to avoid depending on `grep -f <pattern_file>` while while
is part of POSIX, requires not-so-trivial dynamic memory allocation.
Diffstat:
1 file changed, 8 insertions(+), 9 deletions(-)
diff --git a/configure b/configure
@@ -2,6 +2,8 @@
# SPDX-FileCopyrightText: 2017 Haelwenn (lanodan) Monnier <contact+utils@hacktivis.me>
# SPDX-License-Identifier: MPL-2.0
+target_filter='-e cmd/expr.tab'
+
usage() {
cat <<END
Usage: [variables] configure [variables]
@@ -53,18 +55,18 @@ or_die() {
gen_targets() {
printf 'EXE = '
- printf '%s\n ' cmd/*.c cmd/*.y | grep -v -F -f target_filter | sed -e 's;\.c$;;' -e 's;\.y$;;' | tr -d '\n'
+ printf '%s\n ' cmd/*.c cmd/*.y | grep -v -F ${target_filter} | sed -e 's;\.c$;;' -e 's;\.y$;;' | tr -d '\n'
echo
printf 'MAN1SO = '
printf '%s\n' cmd/*.1.in \
- | grep -v -F -f target_filter \
+ | grep -v -F ${target_filter} \
| sed -e 's;\.in$;;' -e 's;^cmd/;build/cmd/;' \
| tr '\n' ' '
echo
printf 'MAN1 = ${MAN1SO} '
- printf '%s\n ' cmd/*.1 | grep -v -F -f target_filter | tr -d '\n'
+ printf '%s\n ' cmd/*.1 | grep -v -F ${target_filter} | tr -d '\n'
echo
}
@@ -156,9 +158,6 @@ MANDIR="${MANDIR:-${PREFIX}/share/man}"
# Add some extra CFLAGS
CFLAGS="${CFLAGS} ${EXTRA_CFLAGS}"
-printf 'Pruning old configurations ...'
-rm -f config.mk && echo 'cmd/expr.tab' > target_filter ; or_die
-
## System checks
# commands
check_cmd CC "$CC" || exit 1
@@ -208,12 +207,12 @@ echo
if ! check_header mntent.h; then
echo 'Disabling cmd/df'
- echo 'cmd/df' >> target_filter
+ target_filter="${target_filter} -e cmd/df"
fi
if ! check_header sys/sysmacros.h; then
echo 'Disabling cmd/mknod'
- echo 'cmd/mknod' >> target_filter
+ target_filter="${target_filter} -e cmd/mknod"
fi
check_conftest configure.d/splice.c && CFLAGS="${CFLAGS} -DHAS_SPLICE"
@@ -225,7 +224,7 @@ fi
if ! check_conftest configure.d/reallocarray.c; then
echo 'Disabling cmd/tr'
- echo 'cmd/tr.' >> target_filter
+ target_filter="${target_filter} -e cmd/tr."
fi
echo