Fix: Stop makefile from throwing errors on no build artifacts (+ other minor things)
Makefile throws errors and exits on no build artifacts.
Specifically, rm
in makefile
(invoked from recompile.sh
)
Here's a sample diff that silences the errors.
N.B. Maybe rm ... || true
might be a better option for compatibility.
diff --git a/makefile b/makefile
index c6b3c7f..4767b8f 100755
--- a/makefile
+++ b/makefile
@@ -59,7 +54,7 @@ endif
# Compile:
all: $(CPP_SOURCES) $(PROFILE_DEPENDENCIES) $(EXECUTABLE)
- rm -f $(OBJECTS_PROFILE) $(EXECUTABLE_PROFILE) *.gcda */*.gcda
+ -rm -f $(OBJECTS_PROFILE) $(EXECUTABLE_PROFILE) *.gcda */*.gcda
true
true oo o
true oo ooo
@@ -71,7 +66,7 @@ all: $(CPP_SOURCES) $(PROFILE_DEPENDENCIES) $(EXECUTABLE)
# Clean the build environment by deleting any object files:
clean:
- rm -f *.o */*.o *.op */*.op *.gdca */*.gcda *.profraw *.profdata $(EXECUTABLE)
+ -rm -f *.o */*.o *.op */*.op *.gdca */*.gcda *.profraw *.profdata $(EXECUTABLE)
echo Clean done
$(EXECUTABLE): $(OBJECTS)
Note: I have tabs expanded to 2 spaces so this diff may break... in yours. (I just put it for info purposes)
recompile.sh
more portable
Make This change makes recompile.sh
POSIX-compliant (to make it work with busybox sh
)
(Just FWIW. Not expecting this diff to be merged.)
diff --git a/recompile.sh b/recompile.sh
index 2493670..bdfc3a6 100755
--- a/recompile.sh[silence-errors.diff.txt](/uploads/b37f4460354ead0317cd39f80fc55b2b/silence-errors.diff.txt)
+++ b/recompile.sh
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/bin/sh
set -e
chmod 755 *.sh
@@ -18,7 +18,7 @@ mingwarg=`echo "$@" | grep -o "\\-\\-mingw" | sed "s/\\-\\-mingw/u/"`
gpuarg=`echo "$@" | grep -o "\\-\\-cuda" | sed "s/\\-\\-cuda/u/"`
immarg=`echo "$@" | grep -o "\\-\\-immediate" | sed "s/\\-\\-immediate/u/"`
-if ((${#symmarg} != 0)); then
+if [ ${#symmarg} -ne 0 ]; then
if [ "${symmarg:0:1}" = "G" ]; then
gpuarg="true"
elif [ "${symmarg:0:1}" = "H" ]; then
@@ -26,12 +26,12 @@ gpuarg="true"
fi
fi
-if ((${#mingwarg} != 0)); then
+if [ ${#mingwarg} -ne 0 ]; then
export USE_MINGW=1
fi
-if ((${#profilearg} != 0)); then
-if ((${#gpuarg} != 0)); then
+if [ ${#profilearg} -ne 0 ]; then
+if [${#gpuarg} -ne 0]; then
printf "\033[31;1mWarning: --cuda and --profile are incompatible; omitting the latter.\033[0m\n"
else
export PROFILE_APGLUXE=1
@@ -42,19 +42,19 @@ fi
bash update-lifelib.sh
rm -rf "lifelib/avxlife/lifelogic" | true
-if ((${#rulearg} == 0)); then
+if [ ${#rulearg} -eq 0 ]; then
rulearg="b3s23"
echo "Rule unspecified; assuming b3s23."
fi
-if ((${#symmarg} == 0)); then
+if [ ${#symmarg} -eq 0 ]; then
symmarg="C1"
echo "Symmetry unspecified; assuming C1."
fi
gpuarg2="false"
-if ((${#gpuarg} != 0)); then
+if [ ${#gpuarg} -ne 0 ]; then
export USE_GPU=1
gpuarg2="true"
@@ -71,14 +71,14 @@ else
fi
make
-if ((${#mingwarg} != 0)); then
+if [ ${#mingwarg} -ne 0 ]; then
exit 0
fi
symmarg="$( grep 'SYMMETRY' 'includes/params.h' | grep -o '".*"' | tr '\n' '"' | sed 's/"//g' )"
rulearg="$( grep 'RULESTRING' 'includes/params.h' | grep -o '".*"' | tr '\n' '"' | sed 's/"//g' )"
-if ((${#immarg} != 0)); then
+if [ ${#immarg} -ne 0 ]; then
./apgluxe --rule $rulearg --symmetry $symmarg "$@"
else
./apgluxe --rule $rulearg --symmetry $symmarg
Personal compiler tweaks
diff --git a/makefile b/makefile
index c6b3c7f..b3b9c57 100755
--- a/makefile
+++ b/makefile
@@ -10,8 +10,8 @@ ifeq "$(shell uname -s | grep -o CYGWIN)" "CYGWIN"
CPP_COMPILER=x86_64-w64-mingw32-g++
C_COMPILER=x86_64-w64-mingw32-gcc
else
-CPP_COMPILER=x86_64-w64-mingw32-g++-posix
-C_COMPILER=x86_64-w64-mingw32-gcc-posix
+CPP_COMPILER=x86_64-w64-mingw32-g++-posix # `x86_64-w64-mingw32-g++` works in bare windows
+C_COMPILER=x86_64-w64-mingw32-gcc-posix # `x86_64-w64-mingw32-gcc` works in bare windows
endif
EXTRA_LIBS=-static -lwinpthread -lwsock32 -lws2_32 -static-libstdc++
else
Edited by Ghost User