From 450abeefdc72c715a6f400a912f0a10b9d6e5581 Mon Sep 17 00:00:00 2001 From: Chris Tallon Date: Wed, 15 Oct 2025 20:08:01 +0100 Subject: [PATCH] Add make-commands script. Remove compiler.sample. Use -z noexecstack for linker --- CMakeLists.txt | 2 + cmake.config.sample | 2 +- compiler.sample | 7 ---- make-commands | 91 +++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 94 insertions(+), 8 deletions(-) delete mode 100755 compiler.sample create mode 100755 make-commands diff --git a/CMakeLists.txt b/CMakeLists.txt index 97edaf4..f07078f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -251,6 +251,8 @@ target_link_directories(vomp PRIVATE ${CMAKE_SYSROOT}/opt/vc/lib ${CMAKE_SYSROOT}/usr/lib/arm-linux-gnueabihf) +set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -z noexecstack") + add_custom_command( OUTPUT pngs.o WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/res/images diff --git a/cmake.config.sample b/cmake.config.sample index f285c43..3613640 100644 --- a/cmake.config.sample +++ b/cmake.config.sample @@ -4,7 +4,7 @@ set(CONFIG_CROSS_COMPILE no) # Set cross compiler. Options: gcc clang set(CONFIG_CROSS_COMPILER gcc) -# Set compiler launcher e.g. for distcc or ccache +# Set compiler launcher e.g. for distcc or ccache (NOT ON RASPIOS 10) # set(CONFIG_COMPILER_LAUNCHER /usr/bin/distcc) # Use mold for linker? (Only possible if compiler is clang) diff --git a/compiler.sample b/compiler.sample deleted file mode 100755 index 50bc258..0000000 --- a/compiler.sample +++ /dev/null @@ -1,7 +0,0 @@ -#!/bin/bash - -# Enable one compiler - -/usr/bin/clang-11 "$@" -# /usr/bin/distcc /usr/bin/clang-11 "$@" - diff --git a/make-commands b/make-commands new file mode 100755 index 0000000..f9ebcf8 --- /dev/null +++ b/make-commands @@ -0,0 +1,91 @@ +#!/bin/bash + +# f clean +# c cmake +# b build +# i install +# r run +# a all + + +if test $# -eq 0 +then + echo Usage: + echo ./go.sh [f] [c] [b] [i] [r] [a] + echo f - clean + echo c - cmake + echo b - build + echo i - install + echo r - run + echo a - all +fi + +CLEAN=0 +CMAKE=0 +BUILD=0 +INSTALL=0 +RUN=0 +MAKERESULT=0 + +while test $# -gt 0 +do + case "$1" in + f) CLEAN=1 + ;; + c) CMAKE=1 + ;; + b) BUILD=1 + ;; + i) INSTALL=1 + ;; + r) RUN=1 + ;; + a) + CLEAN=1 + CMAKE=1 + BUILD=1 + INSTALL=1 + RUN=1 + ;; + esac + shift +done + + +if [ $CLEAN -eq 1 ] +then + rm -rf build +fi + + +if [ $CMAKE -eq 1 ] +then + if [ ! -d "build" ]; then + mkdir build + cmake -B build -S git + fi +fi + + +if [ $BUILD -eq 1 ] +then + (cd build; make -j16) + MAKERESULT=$? +fi + +if [ $MAKERESULT -ne 0 ] && { [ $INSTALL -eq 1 ] || [ $RUN -eq 1 ]; } +then + echo Install / Run aborted due to make errors + exit +fi + +if [ $INSTALL -eq 1 ] +then + echo Insert install commands here +fi + + +if [ $RUN -eq 1 ] +then + build/vomp +fi -- 2.39.5