WHY2/build.sh

45 lines
651 B
Bash
Raw Normal View History

2022-04-22 18:36:35 +02:00
#!/bin/bash
2022-03-20 18:12:25 +01:00
2022-04-27 18:37:15 +02:00
####################
# Remove previous output & versions.json
rm -rf out/*
rm -f versions.json
2022-04-27 18:37:15 +02:00
# Variables
files="
src/test/main.c
src/*.c
include/*.h
"
2022-03-20 18:12:25 +01:00
2022-04-27 18:37:15 +02:00
compiler="cc"
output="out/why2"
flags="-ljson-c -lcurl"
# Check for debug flag
2022-03-20 18:12:25 +01:00
if [ "$1" == "debug" ]; then
2022-04-27 18:37:15 +02:00
flags="$flags -g"
echo "Using debug flag"
fi
2022-04-27 18:37:15 +02:00
###
echo "Using '$compiler' as default compiler. (Flags: $flags)"
echo "Compiling..."
###
# Compile
$compiler $files $flags -o $output
if [[ $? -ne 0 ]]; then
echo -e "\nCompilation failed. Did you run 'configure.sh' first?"
exit 1
fi
2022-04-27 18:37:15 +02:00
###
echo "Output generated as '$output'"
###