#!/bin/sh -ef

mkdir -p "$1/usr/bin"

cp -R etc "$1"
cp -R lib "$1/usr/lib"

# Disable warning as CFLAGS must work this way.
# shellcheck disable=2086
for bin in kpow kall; do
    "${CC:-cc}" -o "$1/usr/bin/$bin" "bin/$bin.c" $CFLAGS -static
    install -Dm644 "bin/$bin.c" "$1/usr/share/doc/kiss/init/$bin.c"
done
