diff options
| author | Richard Qin <richard.qin.x@gmail.com> | 2026-07-10 23:20:03 +0800 |
|---|---|---|
| committer | Richard Qin <richard.qin.x@gmail.com> | 2026-07-10 23:20:03 +0800 |
| commit | 48ef95c24e9ac3d11200b61af617a01b10b507d1 (patch) | |
| tree | 57f0e26ab98e795b19839b6eece98ca58a4b702d /scripts/build/generate-autoconf.sh | |
| parent | b9ff206e6bd3f4d67851263a6f2acb5f575cf3b0 (diff) | |
| download | lume-48ef95c24e9ac3d11200b61af617a01b10b507d1.tar.gz lume-48ef95c24e9ac3d11200b61af617a01b10b507d1.tar.xz | |
build: introduce declarative non-recursive build graph
Diffstat (limited to 'scripts/build/generate-autoconf.sh')
| -rwxr-xr-x | scripts/build/generate-autoconf.sh | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/scripts/build/generate-autoconf.sh b/scripts/build/generate-autoconf.sh new file mode 100755 index 0000000..493d630 --- /dev/null +++ b/scripts/build/generate-autoconf.sh @@ -0,0 +1,29 @@ +#!/bin/sh +# SPDX-License-Identifier: GPL-2.0-or-later + +set -eu +output=$1 +shift +tmp="$output.tmp.$$" +mkdir -p "$(dirname "$output")" +{ + echo '/* AUTO-GENERATED — DO NOT EDIT */' + echo '#pragma once' + while [ "$#" -gt 0 ]; do + name=$1 + value=$2 + kind=$3 + shift 3 + if [ "$kind" = bool ]; then + [ "$value" = y ] && echo "#define $name 1" + else + echo "#define $name $value" + fi + done +} > "$tmp" +if [ -e "$output" ] && cmp -s "$tmp" "$output"; then + rm -f "$tmp" +else + mv -f "$tmp" "$output" +fi + |
