Skip to content

Commit

Permalink
build.sh updated to check for C soltuons when generating main.s/.cpp
Browse files Browse the repository at this point in the history
  • Loading branch information
martinbond7 committed Oct 8, 2024
1 parent d32929d commit 112798b
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -69,11 +69,19 @@ EOT
function main_template {
LANG="${1:-}"
if [[ -z $LANG ]]; then
if [[ $HOSTNAME == *c-* ]]; then
LANG=cpp
if [[ $HOSTNAME == *c-* ]]; then
LANG=c
elif test -d *c-*_exercises; then
LANG=c
else
for dir in solutions/01* exercises/solutions/01*; do
if [[ -f $dir/main.c || -f $dir/src/main.c ]]; then
LANG=c
else
LANG=cpp
fi
break
fi
done
fi
fi
if [[ $LANG = c ]]; then
echo "Generating src/main.c"
Expand Down

0 comments on commit 112798b

Please sign in to comment.