6.16. awk 20251225
awk provides the One True Awk implementation for POSIX text-processing scripts in the target userspace.
Input assumption:
awk-20251225.tar.gz is already present in LBI_SOURCES from the chapter 4 source staging step.
Licenses:
- Lucent Technologies permissive license
Dependencies:
- musl (libc)
- make
- bison (or another yacc-compatible parser generator)
- host C compiler (for the
maketabbuild helper)
awk is a POSIX awk language interpreter from the One True Awk project. we need it to provide awk for text processing and script compatibility in later chapters.
Extract and Enter the Source Tree
cd "$LBI_SOURCES"
tar -xf awk-20251225.tar.gz
cd awk-20251225
Build awk
Configure note: this package does not ship a
configure script, so lbi_configure is not supported here. Build settings are passed directly to make.
make $LWI_MAKE_FLAGS \
HOSTCC="cc -g -Wall -pedantic -Wcast-qual" \
CC="$LBI_ROOT/system/tools/bin/$LBI_TARGET-clang --target=$LBI_TARGET --sysroot=$LBI_ROOT $LWI_CFLAGS $LBI_CUSTOM_LDFLAGS"
Install awk
install -Dm755 a.out "$LBI_ROOT/system/binaries/awk"
install -Dm644 awk.1 "$LBI_ROOT/system/documentation/man-pages/man1/awk.1"
Command Explanations
make $LWI_MAKE_FLAGS: Builds awk with the shared make parallelism setting.HOSTCC="cc -g -Wall -pedantic -Wcast-qual": Builds themaketabhelper with the host C compiler because that helper must run during the build.CC="$LBI_ROOT/system/tools/bin/$LBI_TARGET-clang --target=$LBI_TARGET --sysroot=$LBI_ROOT ...": Builds the final awk binary for the target triple and sysroot.$LWI_CFLAGSand$LBI_CUSTOM_LDFLAGS: Preserve the local compile and link tuning selected in the build environment.install -Dm755 a.out "$LBI_ROOT/system/binaries/awk": Installs the generated awk executable under the expected command name and creates parent directories as needed.install -Dm644 awk.1 ...: Installs the manual page into the book's man-page tree.