1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
#!/bin/sh # Copyright © Tavian Barnes <tavianator@tavianator.com> # SPDX-License-Identifier: 0BSD # Add flags to a makefile if a build succeeds set -eu FLAGS=$(sed -n '\|^///|{s|^/// ||; s|[^=]*= ||; p}' "$1") if build/cc.sh "$@" $FLAGS; then sed -n 's|^/// \(.*=.*\)|\1|p' "$1" else exit 1 fi