summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.gitignore2
-rw-r--r--build_and_test.sh50
-rw-r--r--source/saw/_dep.c (renamed from source/saw/_impl.c)0
3 files changed, 27 insertions, 25 deletions
diff --git a/.gitignore b/.gitignore
index 18d5ae0..000224f 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,2 +1,2 @@
-/*build*/
+/out_*/
*.swp
diff --git a/build_and_test.sh b/build_and_test.sh
index ecab8e7..c490be9 100644
--- a/build_and_test.sh
+++ b/build_and_test.sh
@@ -2,10 +2,9 @@
# General build instructions
#
-FOLDER=build_gcc
+FOLDER=out_gcc
OS=Linux
COMPILE=gcc
-COMPILEPP=g++
OBJ_POSTFIX=.o
EXE_POSTFIX=
FLAGS=
@@ -14,24 +13,20 @@ FLAG_EXE="-o "
LINK_FLAGS="-lm -lX11 -lXi -lXcursor -lGL"
if [ "$2" = "gcc" ]; then
- FOLDER=build_gcc
+ FOLDER=out_gcc
COMPILE=gcc
- COMPILEPP=g++
elif [ "$2" = "clang" ]; then
- FOLDER=build_clang
+ FOLDER=out_clang
COMPILE=clang
- COMPILEPP=clang++
elif [ "$2" = "msvc" ]; then
- FOLDER=build_msvc
+ FOLDER=out_msvc
COMPILE=cl.exe
- COMPILEPP=cl.exe
OBJ_POSTFIX=.obj
FLAG_OBJ="-c -Fo"
FLAG_EXE="-Fe"
elif [ "$2" = "emcc" ]; then
- FOLDER=build_emcc
+ FOLDER=out_emcc
COMPILE=emcc
- COMPILEPP=em++
EXE_POSTFIX=.js
LINK_FLAGS="-sFULL_ES3=1"
elif [ "$2" != "" ]; then
@@ -60,7 +55,6 @@ if [ "$COMPILE" != "emcc" ]; then
if command -v clang >/dev/null 2>&1; then
echo "C compiler found - Clang"
COMPILE=clang
- COMPILEPP=clang++
elif command -v gcc >/dev/null 2>&1; then
echo "C compiler found - GCC"
else
@@ -76,7 +70,6 @@ if [ "$COMPILE" != "emcc" ]; then
if command -v cl.exe >/dev/null 2>&1; then
echo "C compiler found - MSVC"
COMPILE=cl.exe
- COMPILEPP=cl.exe
OBJ_POSTFIX=.obj
FLAG_OBJ="-c -Fo"
FLAG_EXE="-Fe"
@@ -85,7 +78,6 @@ if [ "$COMPILE" != "emcc" ]; then
elif command -v clang >/dev/null 2>&1; then
echo "C compiler found - Clang"
COMPILE=clang
- COMPILEPP=clang++
else
echo "C compiler not found"
exit 1
@@ -104,7 +96,6 @@ if [ "$COMPILE" != "emcc" ]; then
elif command -v clang >/dev/null 2>&1; then
echo "C compiler found - Clang"
COMPILE=clang
- COMPILEPP=clang++
else
echo "C compiler not found"
exit 1
@@ -114,7 +105,7 @@ if [ "$COMPILE" != "emcc" ]; then
esac
fi
-if [ "$COMPILE" = "gcc" ] || [ "$COMPILE" = "clang" ] || [ "$COMPILE" = "emcc" ]; then
+if [ "$COMPILE" = "gcc" ] || [ "$COMPILE" = "emcc" ]; then
if [ "$1" = "release" ]; then
FLAGS="-O3 -DNDEBUG"
elif [ "$COMPILE" = "gcc" ] && [ "$OS" != "Windows" ]; then
@@ -124,6 +115,12 @@ if [ "$COMPILE" = "gcc" ] || [ "$COMPILE" = "clang" ] || [ "$COMPILE" = "emcc" ]
else
FLAGS="-O0"
fi
+elif [ "$COMPILE" = "clang" ]; then
+ if [ "$1" = "release" ]; then
+ FLAGS="-O3 -DNDEBUG"
+ else
+ FLAGS="-O0"
+ fi
else
if [ "$1" = "release" ]; then
FLAGS="-O2 -DNDEBUG"
@@ -137,24 +134,29 @@ if [ ! -d "$FOLDER" ]; then
fi
echo ""
+echo "Compiler options: ${FLAGS}"
+echo "Link options: ${LINK_FLAGS}"
+echo ""
#
# Project-specific instructions
#
-echo "Build saw"
-if [ ! -f "$FOLDER/saw_impl${OBJ_POSTFIX}" ] || \
- [ "source/saw/_impl.c" -nt "$FOLDER/saw_impl${OBJ_POSTFIX}" ]; then
+if [ ! -f "$FOLDER/_dep${OBJ_POSTFIX}" ] || \
+ [ "source/saw/_dep.c" -nt "$FOLDER/_dep${OBJ_POSTFIX}" ]; then
+ echo "Rebuild dependencies"
$COMPILE ${FLAGS} \
- ${FLAG_OBJ}"$FOLDER/saw_impl${OBJ_POSTFIX}" \
- "source/saw/_impl.c"
+ ${FLAG_OBJ}"$FOLDER/_dep${OBJ_POSTFIX}" \
+ "source/saw/_dep.c"
if [ $? -ne 0 ]; then
exit 1
fi
fi
+
+echo "Build saw"
$COMPILE ${FLAGS} \
${FLAG_EXE}"$FOLDER/saw${EXE_POSTFIX}" \
- "$FOLDER/saw_impl${OBJ_POSTFIX}" \
+ "$FOLDER/_dep${OBJ_POSTFIX}" \
"source/saw/_exe.c" \
${LINK_FLAGS}
if [ $? -ne 0 ]; then
@@ -165,9 +167,9 @@ if [ "$COMPILE" = "emcc" ]; then
exit 0
fi
-echo "Build saw_test_suite"
+echo "Build test suite"
$COMPILE ${FLAGS} \
- ${FLAG_EXE}"$FOLDER/saw_test_suite${EXE_POSTFIX}" \
+ ${FLAG_EXE}"$FOLDER/test_suite${EXE_POSTFIX}" \
"source/tests/_exe.c" \
${LINK_FLAGS}
if [ $? -ne 0 ]; then
@@ -179,7 +181,7 @@ echo ""
STATUS=0
-"$FOLDER/saw_test_suite"
+"$FOLDER/test_suite"
if [ $? -ne 0 ]; then
STATUS=1
fi
diff --git a/source/saw/_impl.c b/source/saw/_dep.c
index c4c20ee..c4c20ee 100644
--- a/source/saw/_impl.c
+++ b/source/saw/_dep.c