DWARF stuff...
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

46 lines
1.6 KiB

3 years ago
#!/bin/bash
set -e
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )"
echo "Entering project directory: $SCRIPT_DIR"
pushd $SCRIPT_DIR >/dev/null
3 years ago
if [[ $# = 0 ]]; then
echo "Entering directory: src"
pushd src >/dev/null
3 years ago
mkdir -p ../build
echo -n "Compiling main.c..."
3 years ago
gcc main.c -g -O0 -o ../build/trace -Wall -Wextra -Wno-unused-variable -Wno-unused-function -Wno-switch # -fsanitize=address
echo " Done. Built ../build/trace"
echo "Leaving directory: src"
popd >/dev/null
3 years ago
elif [[ $1 = "examples" ]]; then
echo "Entering directory: res"
pushd res >/dev/null
echo -n "Compiling examples"
gcc -g -o 001-simple 001-simple.c && echo -n "."
gcc -g -o 002-compilation-units 002-compilation-units.c 002-compilation-units-impl.c && echo -n "."
gcc -g -o 003-recursion 003-recursion.c && echo -n "."
gcc -g -o 004-scoped-variables 004-scoped-variables.c && echo -n "."
gcc -g -o 005-base-types 005-base-types.c && echo -n "."
gcc -g -o 006-composite-types 006-composite-types.c && echo -n "."
echo " Done"
echo "Leaving directory: res"
popd >/dev/null
3 years ago
elif [[ $1 = "tests" ]]; then
echo "Entering directory: test"
pushd test >/dev/null
echo -n "Compiling test_main.c..."
gcc test_main.c -g -o ../build/test -Wall -Wextra -Wno-unused-function -Wno-unused-variable -Wno-switch # -fsanitize=address
echo " Done. Built ../build/test"
echo "Leaving directory: test"
popd >/dev/null
3 years ago
elif [[ $1 = "clean" ]]; then
rm build/*
else
echo "No such target '$1'. Try one of: [empty], examples, tests, clean"
3 years ago
fi
echo "Leaving project directory"
popd >/dev/null