summaryrefslogtreecommitdiffstats
path: root/build/flags-if.sh
diff options
context:
space:
mode:
authorTavian Barnes <tavianator@tavianator.com>2024-08-28 17:13:54 -0400
committerTavian Barnes <tavianator@tavianator.com>2024-08-28 17:33:19 -0400
commit8ca167ee93d4a79f1f24bd959de8b85183577064 (patch)
tree1a9299832a004eff16bbdedcab6b00e45061f7af /build/flags-if.sh
parentbfbe6851afd2eb5b40b23dcb7ce6a9422b0f17fa (diff)
downloadbfs-8ca167ee93d4a79f1f24bd959de8b85183577064.tar.xz
build: Move per-file flag support into cc.sh
Diffstat (limited to 'build/flags-if.sh')
-rwxr-xr-xbuild/flags-if.sh10
1 files changed, 7 insertions, 3 deletions
diff --git a/build/flags-if.sh b/build/flags-if.sh
index 76e1c34..81eb345 100755
--- a/build/flags-if.sh
+++ b/build/flags-if.sh
@@ -7,11 +7,15 @@
set -eu
+build/cc.sh "$@" || exit 1
+
+# If the build succeeded, print any lines like
+#
+# /// _CFLAGS += -foo
+#
+# (unless they're already set)
OLD_FLAGS="$XCC $XCPPFLAGS $XCFLAGS $XLDFLAGS $XLDLIBS"
-NEW_FLAGS=$(sed -n '\|^///|{s|^/// ||; s|[^=]*= ||; p;}' "$1")
-build/cc.sh "$@" $NEW_FLAGS || exit 1
-# De-duplicate against the existing flags
while IFS="" read -r line; do
case "$line" in
///*=*)