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
|
|
|
####################
|
|
|
|
|
2022-04-29 17:16:32 +02:00
|
|
|
# Remove previous output
|
2022-04-27 18:37:15 +02:00
|
|
|
rm -rf out/*
|
2022-04-22 18:35:27 +02:00
|
|
|
|
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-04-30 15:58:57 +02:00
|
|
|
if [[ "$1" == "debug" ]]; then
|
2022-04-27 18:37:15 +02:00
|
|
|
flags="$flags -g"
|
|
|
|
echo "Using debug flag"
|
2022-04-22 18:35:27 +02:00
|
|
|
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
|
|
|
|
|
2022-04-27 18:47:33 +02:00
|
|
|
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'"
|
|
|
|
###
|
|
|
|
|
|
|
|
|