aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKarel Zak <kzak@redhat.com>2024-04-16 11:21:56 +0200
committerKarel Zak <kzak@redhat.com>2024-04-16 11:21:56 +0200
commit3efa6038c39a35440943beea068f56440953cc90 (patch)
tree4a1467ab584c060cb2acc8e8b85a71cce8cc33bc
parent0501e39ad4168a2e2072b0eeb00a9b065ed99b24 (diff)
parent543f991f62659b9a3ff67f9cda3456b2a5bb3f98 (diff)
downloadutil-linux-3efa6038c39a35440943beea068f56440953cc90.tar.gz
Merge branch 'awk' of https://github.com/t-8ch/util-linux
* 'awk' of https://github.com/t-8ch/util-linux: all_errnos/all_syscalls: don't hardcode AWK invocation all_errnos/all_syscalls: don't warn during cleanup all_errnos/all_syscalls: fail if any step fails
-rw-r--r--configure.ac1
-rw-r--r--meson.build7
-rw-r--r--misc-utils/Makemodule.am4
-rwxr-xr-xtools/all_errnos7
-rwxr-xr-xtools/all_syscalls7
5 files changed, 18 insertions, 8 deletions
diff --git a/configure.ac b/configure.ac
index c302732e73..6293eb8528 100644
--- a/configure.ac
+++ b/configure.ac
@@ -132,6 +132,7 @@ AC_PROG_CC
AM_PROG_CC_C_O
AC_PROG_MKDIR_P
AC_PROG_YACC
+AC_PROG_AWK
# Don't use autotools integrated LEX/YACC support for libsmartcols
AC_PATH_PROG([FLEX], [flex])
diff --git a/meson.build b/meson.build
index 99126f7aad..9476ec2dee 100644
--- a/meson.build
+++ b/meson.build
@@ -904,6 +904,7 @@ conf.set('USE_TTY_GROUP', have ? 1 : false)
bison = find_program('bison')
flex = find_program('flex')
+awk = find_program('gawk', 'mawk', 'nawk', 'awk')
build_hwclock = not get_option('build-hwclock').disabled()
bison_gen = generator(
@@ -2776,7 +2777,8 @@ endif
errnos_h = custom_target('errnos.h',
input : 'tools/all_errnos',
output : 'errnos.h',
- command : ['tools/all_errnos', cc.cmd_array(), get_option('c_args')],
+ command : ['tools/all_errnos', awk.full_path(),
+ cc.cmd_array(), get_option('c_args')],
)
opt = not get_option('build-lsfd').require(lib_rt.found()).disabled()
@@ -3093,7 +3095,8 @@ endif
syscalls_h = custom_target('syscalls.h',
input : 'tools/all_syscalls',
output : 'syscalls.h',
- command : ['tools/all_syscalls', cc.cmd_array(), get_option('c_args')],
+ command : ['tools/all_syscalls', awk.full_path(),
+ cc.cmd_array(), get_option('c_args')],
)
if cc.compiles(fs.read('include/audit-arch.h'), name : 'has AUDIT_ARCH_NATIVE')
diff --git a/misc-utils/Makemodule.am b/misc-utils/Makemodule.am
index 7622a5d7be..841275eb6e 100644
--- a/misc-utils/Makemodule.am
+++ b/misc-utils/Makemodule.am
@@ -1,6 +1,6 @@
errnos.h: $(top_srcdir)/tools/all_errnos
@echo ' GEN $@'
- @$(top_srcdir)/tools/all_errnos $(CC) $(CFLAGS)
+ @$(top_srcdir)/tools/all_errnos "$(AWK)" $(CC) $(CFLAGS)
-include errnos.h.deps
CLEANFILES += errnos.h errnos.h.deps
@@ -338,7 +338,7 @@ misc-utils/enosys.c: syscalls.h errnos.h
syscalls.h: $(top_srcdir)/tools/all_syscalls
@echo ' GEN $@'
- @$(top_srcdir)/tools/all_syscalls $(CC) $(CFLAGS)
+ @$(top_srcdir)/tools/all_syscalls "$(AWK)" $(CC) $(CFLAGS)
-include syscalls.h.deps
CLEANFILES += syscalls.h syscalls.h.deps
diff --git a/tools/all_errnos b/tools/all_errnos
index 2cfb14bc3a..137713d401 100755
--- a/tools/all_errnos
+++ b/tools/all_errnos
@@ -3,15 +3,18 @@
# Derrived from all_syscalls.
set -e
+set -o pipefail
+AWK="$1"
+shift
OUTPUT=errnos.h
ERRNO_INCLUDES="
#include <sys/errno.h>
"
-trap 'rm $OUTPUT $OUTPUT.deps' ERR
+trap 'rm -f $OUTPUT $OUTPUT.deps' ERR
"$@" -MD -MF "$OUTPUT.deps" <<< "$ERRNO_INCLUDES" -dM -E - \
- | gawk 'match($0, /^#[ \t]*define[ \t]*E([^ ]+)/, res) { print "UL_ERRNO(\"E" res[1] "\", E" res[1] ")" }' \
+ | "$AWK" 'match($0, /^#[ \t]*define[ \t]*E([^ ]+)/, res) { print "UL_ERRNO(\"E" res[1] "\", E" res[1] ")" }' \
| sort \
> "$OUTPUT"
diff --git a/tools/all_syscalls b/tools/all_syscalls
index 9c147786cf..15984e5287 100755
--- a/tools/all_syscalls
+++ b/tools/all_syscalls
@@ -1,15 +1,18 @@
#!/bin/bash
set -e
+set -o pipefail
+AWK="$1"
+shift
OUTPUT=syscalls.h
SYSCALL_INCLUDES="
#include <sys/syscall.h>
"
-trap 'rm $OUTPUT $OUTPUT.deps' ERR
+trap 'rm -f $OUTPUT $OUTPUT.deps' ERR
"$@" -MD -MF "$OUTPUT.deps" <<< "$SYSCALL_INCLUDES" -dM -E - \
- | gawk 'match($0, /^#define __NR_([^ ]+)/, res) { print "UL_SYSCALL(\"" res[1] "\", __NR_" res[1] ")" }' \
+ | "$AWK" 'match($0, /^#define __NR_([^ ]+)/, res) { print "UL_SYSCALL(\"" res[1] "\", __NR_" res[1] ")" }' \
| sort \
> "$OUTPUT"