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.
33 lines
896 B
33 lines
896 B
3 years ago
|
#!/bin/bash
|
||
|
|
||
|
set -e
|
||
|
set -x
|
||
|
|
||
|
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )"
|
||
|
pushd $SCRIPT_DIR
|
||
|
|
||
|
if [[ $# = 0 ]]; then
|
||
|
pushd src
|
||
|
mkdir -p ../build
|
||
|
gcc main.c -g -O0 -o ../build/trace -Wall -Wextra -Wno-unused-variable -Wno-unused-function -Wno-switch # -fsanitize=address
|
||
|
popd
|
||
|
elif [[ $1 = "examples" ]]; then
|
||
|
pushd res
|
||
|
gcc -g -o 001-simple 001-simple.c
|
||
|
gcc -g -o 002-compilation-units 002-compilation-units.c 002-compilation-units-impl.c
|
||
|
gcc -g -o 003-recursion 003-recursion.c
|
||
|
gcc -g -o 004-scoped-variables 004-scoped-variables.c
|
||
|
gcc -g -o 005-base-types 005-base-types.c
|
||
|
gcc -g -o 006-composite-types 006-composite-types.c
|
||
|
popd
|
||
|
elif [[ $1 = "tests" ]]; then
|
||
|
pushd test/
|
||
|
gcc test_main.c -g -o ../build/test -Wall -Wextra -Wno-unused-function -Wno-unused-variable
|
||
|
popd
|
||
|
elif [[ $1 = "clean" ]]; then
|
||
|
rm build/*
|
||
|
else
|
||
|
echo "No such target '$1'"
|
||
|
fi
|
||
|
|
||
|
popd
|