bison = find_program('bison')
flex = find_program('flex')
-awk = find_program('gawk', 'mawk', 'nawk', 'awk')
+sed = find_program('sed')
build_hwclock = not get_option('build-hwclock').disabled()
bison_gen = generator(
errnos_h = custom_target('errnos.h',
input : 'tools/all_errnos',
output : 'errnos.h',
- command : ['tools/all_errnos', awk.full_path(),
+ command : ['tools/all_errnos', sed.full_path(),
cc.cmd_array(), get_option('c_args')],
)
syscalls_h = custom_target('syscalls.h',
input : 'tools/all_syscalls',
output : 'syscalls.h',
- command : ['tools/all_syscalls', awk.full_path(),
+ command : ['tools/all_syscalls', sed.full_path(),
cc.cmd_array(), get_option('c_args')],
)
errnos.h: $(top_srcdir)/tools/all_errnos
@echo ' GEN $@'
- @$(top_srcdir)/tools/all_errnos "$(AWK)" $(CC) $(CFLAGS)
+ @$(top_srcdir)/tools/all_errnos "$(SED)" $(CC) $(CFLAGS)
-include errnos.h.deps
CLEANFILES += errnos.h errnos.h.deps
syscalls.h: $(top_srcdir)/tools/all_syscalls
@echo ' GEN $@'
- @$(top_srcdir)/tools/all_syscalls "$(AWK)" $(CC) $(CFLAGS)
+ @$(top_srcdir)/tools/all_syscalls "$(SED)" $(CC) $(CFLAGS)
-include syscalls.h.deps
CLEANFILES += syscalls.h syscalls.h.deps
set -e
set -o pipefail
-AWK="$1"
+SED="$1"
shift
OUTPUT=errnos.h
ERRNO_INCLUDES="
trap 'rm -f $OUTPUT $OUTPUT.deps' ERR
"$@" -MD -MF "$OUTPUT.deps" <<< "$ERRNO_INCLUDES" -dM -E - \
- | "$AWK" 'match($0, /^#[ \t]*define[ \t]*E([^ ]+)/, res) { print "UL_ERRNO(\"E" res[1] "\", E" res[1] ")" }' \
+ | "$SED" -n -e 's/^[ \t]*#define[ \t]*E\([^ ]*\).*$/UL_ERRNO("E\1", E\1)/p' \
| sort \
> "$OUTPUT"
set -e
set -o pipefail
-AWK="$1"
+SED="$1"
shift
OUTPUT=syscalls.h
SYSCALL_INCLUDES="
trap 'rm -f $OUTPUT $OUTPUT.deps' ERR
"$@" -MD -MF "$OUTPUT.deps" <<< "$SYSCALL_INCLUDES" -dM -E - \
- | "$AWK" 'match($0, /^#define __NR_([^ ]+)/, res) { print "UL_SYSCALL(\"" res[1] "\", __NR_" res[1] ")" }' \
+ | "$SED" -n -e 's/^#define __NR_\([^ ]*\).*$/UL_SYSCALL("\1", __NR_\1)/p' \
| sort \
> "$OUTPUT"