#!/bin/sh TARGET=$1 ROOT=$(echo "$TARGET" | sed 's/\.h$//') if test "$MAKE" = ""; then # shellcheck disable=SC2209 MAKE=make fi echo "Looking for usable alternative for $TARGET" rm -f "$ROOT"-test for x in "$ROOT"*.h; do echo "Trying build with $x" rm -f "$TARGET" (echo '/******** GENERATED FILE ********/'; cat "$x") > "$TARGET" $MAKE "$ROOT"-test && break echo "Failed build with $x" rm -f "$TARGET" done rm -f "$ROOT"-test test -f "$TARGET"