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.5 KiB

#!/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
if [[ $# = 0 ]]; then
echo "Entering directory: src"
pushd src >/dev/null
mkdir -p ../build
echo -n "Compiling main.c..."
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
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
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
echo " Done. Built ../build/test"
echo "Leaving directory: test"
popd >/dev/null
elif [[ $1 = "clean" ]]; then
rm build/*
else
echo "No such target '$1'"
fi
echo "Leaving project directory"
popd >/dev/null