47 lines
1.2 KiB
Bash
Executable File
47 lines
1.2 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
set -euo pipefail
|
|
|
|
cd "$(dirname "$0")"
|
|
|
|
# LinuxCNC source basis: CMake source-set listers expose only project bridge,
|
|
# shim, and adapter files declared in core/CMakeLists.txt for source-backed
|
|
# LinuxCNC probe builds; functional CNC behavior still comes from LinuxCNC
|
|
# manifests or wrapped LinuxCNC kinematics/canon/RS274 sources.
|
|
if [[ "$#" -lt 1 || "$#" -gt 2 ]]; then
|
|
echo "usage: $0 <cmake-set-name> [relative-prefix]" >&2
|
|
exit 1
|
|
fi
|
|
|
|
set_name=$1
|
|
relative_prefix=${2:-}
|
|
|
|
awk -v set_name="$set_name" -v relative_prefix="$relative_prefix" '
|
|
$0 ~ "^[[:space:]]*set\\(" set_name "([[:space:]]|$)" {
|
|
found_set = 1
|
|
in_list = 1
|
|
next
|
|
}
|
|
in_list && /^[[:space:]]*\)/ {
|
|
exit
|
|
}
|
|
in_list {
|
|
line = $0
|
|
sub(/^[[:space:]]*/, "", line)
|
|
sub(/[[:space:]]*$/, "", line)
|
|
if (line == "") {
|
|
next
|
|
}
|
|
sub(/^\$\{CMAKE_CURRENT_SOURCE_DIR\}\//, "core/", line)
|
|
if (line !~ /^core\// && relative_prefix != "") {
|
|
line = relative_prefix line
|
|
}
|
|
print line
|
|
}
|
|
END {
|
|
if (!found_set) {
|
|
print "missing CMake source set: " set_name > "/dev/stderr"
|
|
exit 1
|
|
}
|
|
}
|
|
' core/CMakeLists.txt
|