Skip to content

Commit

Permalink
.make: also don't compile C++ projects if can't compile standalone C+…
Browse files Browse the repository at this point in the history
…+ programs
  • Loading branch information
XPhyro committed Aug 18, 2024
1 parent 2c661e9 commit d540a97
Showing 1 changed file with 34 additions and 34 deletions.
68 changes: 34 additions & 34 deletions .make
Original file line number Diff line number Diff line change
Expand Up @@ -237,6 +237,23 @@ install() {
' --
)

printf "\n%s\n" \
"Installing external C and C++ libraries:"

(
# shellcheck disable=SC2069
printf "%s\0" \
"$rootdir/lib/hedley/hedley.h" \
"$rootdir/lib/pstreams/pstream.h" \
"$rootdir/lib/imtui-xphyro/include/imtui/" \
"$rootdir/lib/lyra-xphyro/include/lyra/" \
| xargs -r0 -n 1 -P "${MAKE_JOBS:-0}" sh -c '
fl="$1"
printf " %s -> %s\n" "${fl##"$rootdir/lib/"}" "$includeprefix/${fl##*/}" >&2
cp -rf -t "$includeprefix" -- "$fl"
' --
)

printf "\n%s\n" \
"Preparing to install C++ programs:"

Expand Down Expand Up @@ -306,45 +323,28 @@ install() {
"$(printf "%s\n" "$ldflags" | tr -d "\n" | sed "s/^\s\+//;s/\s\+$//;s/\s\+/ /g")"
'"$CXX"' '"$CXXFLAGS"' $flags $extraflags "$1" '"$CXXLDFLAGS"' $ldflags -o "$installprefix/$out"
' --
)

printf "\n%s\n" \
"Installing external C and C++ libraries:"

(
# shellcheck disable=SC2069
printf "%s\0" \
"$rootdir/lib/hedley/hedley.h" \
"$rootdir/lib/pstreams/pstream.h" \
"$rootdir/lib/imtui-xphyro/include/imtui/" \
"$rootdir/lib/lyra-xphyro/include/lyra/" \
| xargs -r0 -n 1 -P "${MAKE_JOBS:-0}" sh -c '
fl="$1"
printf " %s -> %s\n" "${fl##"$rootdir/lib/"}" "$includeprefix/${fl##*/}" >&2
cp -rf -t "$includeprefix" -- "$fl"
' --
)

printf "\n%s\n" \
"Installing C++ projects:"
printf "\n%s\n" \
"Installing C++ projects:"

(
cd cpp/project
(
cd project

for dir in */; do
(
cd "$dir"
name="${dir%/}"
for dir in */; do
(
cd "$dir"
name="${dir%/}"

[ -f ".no-runner" ] && [ -d "/home/runner" ] && {
printf " %s\n" "Runner detected, not compiling $name."
exit 0
}
[ -f ".no-runner" ] && [ -d "/home/runner" ] && {
printf " %s\n" "Runner detected, not compiling $name."
exit 0
}

make -j"$CPU_PROC" "$name"
cp -f -t "$binprefix" -- "$name"
)
done
make -j"$CPU_PROC" "$name"
cp -f -t "$binprefix" -- "$name"
)
done
)
)

printf "\n%s\n" \
Expand Down

0 comments on commit d540a97

Please sign in to comment.