37 lines
739 B
Bash
37 lines
739 B
Bash
|
#!/bin/sh
|
||
|
|
||
|
i_dir=99999
|
||
|
|
||
|
flags="-Wall -Wextra -pedantic -Wno-unused-variable -Wno-unused-but-set-variable -Werror=return-type -Wno-reorder -Wno-missing-field-initializers"
|
||
|
flags="$flags -g --std c++14 -D _GLIBCXX_DEBUG"
|
||
|
|
||
|
usage(){
|
||
|
echo "Usage: regexis024_build_system.sh [bs script (cpp file)]"
|
||
|
}
|
||
|
|
||
|
if [ $# -gt 1 ]; then usage; exit 1; fi
|
||
|
|
||
|
SCRIPT="./building/main.cpp"
|
||
|
|
||
|
is_cpp(){
|
||
|
case "$1" in *.cpp) true;; *) false;; esac;
|
||
|
}
|
||
|
|
||
|
if [ $# -ge 1 ]; then
|
||
|
SCRIPT="$1"
|
||
|
fi
|
||
|
|
||
|
if [ \! \( -f "$SCRIPT" \) ]; then
|
||
|
echo "No such file $SCRIPT"; exit 1;
|
||
|
fi
|
||
|
|
||
|
if ! is_cpp "$SCRIPT"; then
|
||
|
echo "Script file does not end in .cpp"; exit 1
|
||
|
fi
|
||
|
|
||
|
# Todo: rewrite with sed
|
||
|
COMPILED="${SCRIPT%.cpp}"
|
||
|
|
||
|
g++ $flags -I "$i_dir" -o "$COMPILED" "$SCRIPT"
|
||
|
|