commit 4216817df6e357ecf6a21b8fb8afd790ecaad438
parent 3585b32d16f633130d478eb7e66af8e105f760b2
Author: Vincent Forest <vincent.forest@meso-star.com>
Date: Tue, 25 Jul 2023 16:43:20 +0200
Update build variable handling
Make them directly controllable through the config.mk file. The
BUILD_TYPE and LIB_TYPE are therefore no longer shell variables but
Makefile macros resolved during the execution of make. The new USE_SIMD
macro controls whether or not SIMD instruction sets are used; by
default, they are disabled.
Diffstat:
19 files changed, 45 insertions(+), 73 deletions(-)
diff --git a/Makefile b/Makefile
@@ -41,9 +41,9 @@ $(DEP): $(BUILD) src/prereq.sh
@PATH="src:$${PATH}" $(SHELL) src/prereq.sh "$(MK) $(DEP)" $(BUILD) > $@
# Generate the Makefile of the build
-$(MK): $(BUILD) src/build.sh
+$(MK): $(BUILD) src/build.sh config.mk
@echo "Setup $@"
- @PATH="src:$${PATH}" $(SHELL) $(BUILD) > $@
+ @PATH="src:$${PATH}" USE_SIMD=$(USE_SIMD) $(SHELL) $(BUILD) > $@
# Update the build timestamp to force regeneration of its Makefile when its
# prerequistes are updated
diff --git a/config.mk b/config.mk
@@ -21,6 +21,16 @@ REPO = https://gitlab.com/meso-star
REPO_BIN = https://www.meso-star.com/packages/v0.4/
REPO_VAPLV = https://gitlab.com/vaplv
-# Project to build
+# Project to build. To see the available projects, list the shell scripts in
+# the src directory:
+# find src/ -name "*.sh" ! -name "prereq.sh" ! -name "build.sh"
BUILD = src/sgs.sh
-#BUILD = src/star-engine.sh
+
+# Type of library to build, either SHARED or STATIC
+LIB_TYPE = SHARED
+
+# How to build programs and libraries, typically in RELEASE or in DEBUG
+BUILD_TYPE = RELEASE
+
+# Are SIMD instruction sets enabled?
+USE_SIMD = 0
diff --git a/src/aw.sh b/src/aw.sh
@@ -21,12 +21,9 @@ export AW_SH=1
. "build.sh"
. "rsys.sh"
-[ -z "${BUILD_TYPE}" ] && BUILD_TYPE="RELEASE"
-[ -z "${LIB_TYPE}" ] && LIB_TYPE="SHARED"
-
name="aw"
url="$\(REPO_VAPLV\)/loader_aw.git"
tag="origin/feature_posix_make"
dep="rsys"
-opt="BUILD_TYPE=${BUILD_TYPE} LIB_TYPE=${LIB_TYPE}"
+opt="BUILD_TYPE=$\(BUILD_TYPE\) LIB_TYPE=$\(LIB_TYPE\)"
git_repo
diff --git a/src/polygon.sh b/src/polygon.sh
@@ -21,12 +21,9 @@ export POLYGON_SH=1
. "build.sh"
. "rsys.sh"
-[ -z "${BUILD_TYPE}" ] && BUILD_TYPE="RELEASE"
-[ -z "${LIB_TYPE}" ] && LIB_TYPE="SHARED"
-
name="polygon"
url="$\(REPO_VAPLV\)/polygon.git"
tag="origin/feature_posix_make"
dep="rsys"
-opt="BUILD_TYPE=${BUILD_TYPE} LIB_TYPE=${LIB_TYPE}"
+opt="BUILD_TYPE=$\(BUILD_TYPE\) LIB_TYPE=$\(LIB_TYPE\)"
git_repo
diff --git a/src/rsimd.sh b/src/rsimd.sh
@@ -22,12 +22,9 @@ export RSIMD_SH=1
. "rsys.sh"
. "sleef_3.5.2-r0.sh"
-[ -z "${BUILD_TYPE}" ] && BUILD_TYPE="RELEASE"
-[ -z "${LIB_TYPE}" ] && LIB_TYPE="SHARED"
-
name="rsimd"
url="$\(REPO_VAPLV\)/rsimd.git"
tag="origin/feature_posix_make"
dep="rsys sleef"
-opt="BUILD_TYPE=${BUILD_TYPE} LIB_TYPE=${LIB_TYPE}"
+opt="BUILD_TYPE=$\(BUILD_TYPE\) LIB_TYPE=$\(LIB_TYPE\)"
git_repo
diff --git a/src/rsys.sh b/src/rsys.sh
@@ -20,11 +20,8 @@ export RSYS_SH=1
. "build.sh"
-[ -z "${BUILD_TYPE}" ] && BUILD_TYPE="RELEASE"
-[ -z "${LIB_TYPE}" ] && LIB_TYPE="SHARED"
-
name="rsys"
url="$\(REPO_VAPLV\)/rsys.git"
tag="origin/feature_posix_make"
-opt="BUILD_TYPE=${BUILD_TYPE} LIB_TYPE=${LIB_TYPE}"
+opt="BUILD_TYPE=$\(BUILD_TYPE\) LIB_TYPE=$\(LIB_TYPE\)"
git_repo
diff --git a/src/star-2d.sh b/src/star-2d.sh
@@ -22,12 +22,9 @@ export STAR_2D_SH=1
. "embree_4.0.1.sh"
. "rsys.sh"
-[ -z "${BUILD_TYPE}" ] && BUILD_TYPE="RELEASE"
-[ -z "${LIB_TYPE}" ] && LIB_TYPE="SHARED"
-
name="star-2d"
url="$\(REPO\)/star-2d.git"
tag="origin/feature_posix_make"
dep="rsys embree4"
-opt="BUILD_TYPE=${BUILD_TYPE} LIB_TYPE=${LIB_TYPE}"
+opt="BUILD_TYPE=$\(BUILD_TYPE\) LIB_TYPE=$\(LIB_TYPE\)"
git_repo
diff --git a/src/star-3d.sh b/src/star-3d.sh
@@ -22,12 +22,9 @@ export STAR_3D_SH=1
. "embree_4.0.1.sh"
. "rsys.sh"
-[ -z "${BUILD_TYPE}" ] && BUILD_TYPE="RELEASE"
-[ -z "${LIB_TYPE}" ] && LIB_TYPE="SHARED"
-
name="star-3d"
url="$\(REPO\)/star-3d.git"
tag="origin/feature_posix_make"
dep="rsys embree4"
-opt="BUILD_TYPE=${BUILD_TYPE} LIB_TYPE=${LIB_TYPE}"
+opt="BUILD_TYPE=$\(BUILD_TYPE\) LIB_TYPE=$\(LIB_TYPE\)"
git_repo
diff --git a/src/star-3daw.sh b/src/star-3daw.sh
@@ -19,18 +19,14 @@
export STAR_3DAW_SH=1
. "build.sh"
-
. "aw.sh"
. "polygon.sh"
. "rsys.sh"
. "star-3d.sh"
-[ -z "${BUILD_TYPE}" ] && BUILD_TYPE="RELEASE"
-[ -z "${LIB_TYPE}" ] && LIB_TYPE="SHARED"
-
name="star-3daw"
url="$\(REPO\)/star-3daw.git"
tag="origin/feature_posix_make"
dep="aw polygon rsys star-3d"
-opt="BUILD_TYPE=${BUILD_TYPE} LIB_TYPE=${LIB_TYPE}"
+opt="BUILD_TYPE=$\(BUILD_TYPE\) LIB_TYPE=$\(LIB_TYPE\)"
git_repo
diff --git a/src/star-3dstl.sh b/src/star-3dstl.sh
@@ -23,12 +23,9 @@ export STAR_3DSTL_SH=1
. "star-3d.sh"
. "star-stl.sh"
-[ -z "${BUILD_TYPE}" ] && BUILD_TYPE="RELEASE"
-[ -z "${LIB_TYPE}" ] && LIB_TYPE="SHARED"
-
name="star-3dstl"
url="$\(REPO\)/star-3dstl.git"
tag="origin/feature_posix_make"
dep="rsys star-3d star-stl"
-opt="BUILD_TYPE=${BUILD_TYPE} LIB_TYPE=${LIB_TYPE}"
+opt="BUILD_TYPE=$\(BUILD_TYPE\) LIB_TYPE=$\(LIB_TYPE\)"
git_repo
diff --git a/src/star-3dut.sh b/src/star-3dut.sh
@@ -21,12 +21,9 @@ export STAR_3DUT_SH=1
. "build.sh"
. "rsys.sh"
-[ -z "${BUILD_TYPE}" ] && BUILD_TYPE="RELEASE"
-[ -z "${LIB_TYPE}" ] && LIB_TYPE="SHARED"
-
name="star-3dut"
url="$\(REPO\)/star-3dut.git"
tag="origin/feature_posix_make"
dep="rsys"
-opt="BUILD_TYPE=${BUILD_TYPE} LIB_TYPE=${LIB_TYPE}"
+opt="BUILD_TYPE=$\(BUILD_TYPE\) LIB_TYPE=$\(LIB_TYPE\)"
git_repo
diff --git a/src/star-engine.sh b/src/star-engine.sh
@@ -18,9 +18,10 @@
[ -n "${STAR_ENGINE_SH}" ] && return
export STAR_ENGINE_SH=1
+[ -z "${USE_SIMD}" ] && USE_SIMD="0"
+
. "aw.sh"
. "polygon.sh"
-. "rsimd.sh"
. "rsys.sh"
. "star-2d.sh"
. "star-3d.sh"
@@ -34,4 +35,6 @@ export STAR_ENGINE_SH=1
. "star-uvm.sh"
. "star-vx.sh"
+[ "${USE_SIMD}" != "0" ] && . "rsimd.sh"
+
profile star-engine.profile
diff --git a/src/star-mc.sh b/src/star-mc.sh
@@ -22,12 +22,9 @@ export STAR_MC_SH=1
. "rsys.sh"
. "star-sp.sh"
-[ -z "${BUILD_TYPE}" ] && BUILD_TYPE="RELEASE"
-[ -z "${LIB_TYPE}" ] && LIB_TYPE="SHARED"
-
name="star-mc"
url="$\(REPO\)/star-mc.git"
tag="origin/feature_posix_make"
dep="star-sp rsys"
-opt="BUILD_TYPE=${BUILD_TYPE} LIB_TYPE=${LIB_TYPE}"
+opt="BUILD_TYPE=$\(BUILD_TYPE\) LIB_TYPE=$\(LIB_TYPE\)"
git_repo
diff --git a/src/star-mesh.sh b/src/star-mesh.sh
@@ -22,12 +22,9 @@ export STAR_MESH_SH=1
. "rsys.sh"
# TODO add scdoc
-[ -z "${BUILD_TYPE}" ] && BUILD_TYPE="RELEASE"
-[ -z "${LIB_TYPE}" ] && LIB_TYPE="SHARED"
-
name="star-mesh"
url="$\(REPO\)/star-mesh.git"
tag="origin/feature_posix_make"
dep="rsys"
-opt="BUILD_TYPE=${BUILD_TYPE} LIB_TYPE=${LIB_TYPE}"
+opt="BUILD_TYPE=$\(BUILD_TYPE\) LIB_TYPE=$\(LIB_TYPE\)"
git_repo
diff --git a/src/star-sf.sh b/src/star-sf.sh
@@ -19,16 +19,22 @@
export STAR_SF_SH=1
. "build.sh"
-. "rsimd.sh"
. "rsys.sh"
. "star-sp.sh"
-[ -z "${BUILD_TYPE}" ] && BUILD_TYPE="RELEASE"
-[ -z "${LIB_TYPE}" ] && LIB_TYPE="SHARED"
+[ -z "${USE_SIMD}" ] && USE_SIMD="0"
+[ "${USE_SIMD}" != 0 ] && . "rsimd.sh"
name="star-sf"
url="$\(REPO\)/star-sf.git"
tag="origin/feature_posix_make"
-dep="rsimd rsys star-sp"
-opt="BUILD_TYPE=${BUILD_TYPE} LIB_TYPE=${LIB_TYPE}"
+dep="rsys star-sp"
+opt="BUILD_TYPE=$\(BUILD_TYPE\) LIB_TYPE=$\(LIB_TYPE\)"
+
+if [ "${USE_SIMD}" = "0" ]; then
+ opt="${opt} SIMD_WIDTH=NONE"
+else
+ dep="${dep} rsimd"
+fi
+
git_repo
diff --git a/src/star-sp.sh b/src/star-sp.sh
@@ -22,12 +22,9 @@ export STAR_SP_SH=1
. "random123_1.14.0.sh"
. "rsys.sh"
-[ -z "${BUILD_TYPE}" ] && BUILD_TYPE="RELEASE"
-[ -z "${LIB_TYPE}" ] && LIB_TYPE="SHARED"
-
name="star-sp"
url="$\(REPO\)/star-sp.git"
tag="origin/feature_posix_make"
dep="random123 rsys"
-opt="BUILD_TYPE=${BUILD_TYPE} LIB_TYPE=${LIB_TYPE}"
+opt="BUILD_TYPE=$\(BUILD_TYPE\) LIB_TYPE=$\(LIB_TYPE\)"
git_repo
diff --git a/src/star-stl.sh b/src/star-stl.sh
@@ -21,12 +21,9 @@ export STAR_STL_SH=1
. "build.sh"
. "rsys.sh"
-[ -z "${BUILD_TYPE}" ] && BUILD_TYPE="RELEASE"
-[ -z "${LIB_TYPE}" ] && LIB_TYPE="SHARED"
-
name="star-stl"
url="$\(REPO\)/star-stl.git"
tag="origin/feature_posix_make"
dep="rsys"
-opt="BUILD_TYPE=${BUILD_TYPE} LIB_TYPE=${LIB_TYPE}"
+opt="BUILD_TYPE=$\(BUILD_TYPE\) LIB_TYPE=$\(LIB_TYPE\)"
git_repo
diff --git a/src/star-uvm.sh b/src/star-uvm.sh
@@ -21,14 +21,10 @@ export STAR_UVM_SH=1
. "build.sh"
. "embree_4.0.1.sh"
. "rsys.sh"
-. "star-mesh.sh"
-
-[ -z "${BUILD_TYPE}" ] && BUILD_TYPE="RELEASE"
-[ -z "${LIB_TYPE}" ] && LIB_TYPE="SHARED"
name="star-uvm"
url="$\(REPO\)/star-uvm.git"
tag="origin/feature_posix_make"
-dep="embree4 rsys star-mesh"
-opt="BUILD_TYPE=${BUILD_TYPE} LIB_TYPE=${LIB_TYPE}"
+dep="embree4 rsys"
+opt="BUILD_TYPE=$\(BUILD_TYPE\) LIB_TYPE=$\(LIB_TYPE\)"
git_repo
diff --git a/src/star-vx.sh b/src/star-vx.sh
@@ -21,12 +21,9 @@ export STAR_VX_SH=1
. "build.sh"
. "rsys.sh"
-[ -z "${BUILD_TYPE}" ] && BUILD_TYPE="RELEASE"
-[ -z "${LIB_TYPE}" ] && LIB_TYPE="SHARED"
-
name="star-vx"
url="$\(REPO\)/star-vx.git"
tag="origin/feature_posix_make"
dep="rsys"
-opt="BUILD_TYPE=${BUILD_TYPE} LIB_TYPE=${LIB_TYPE}"
+opt="BUILD_TYPE=$\(BUILD_TYPE\) LIB_TYPE=$\(LIB_TYPE\)"
git_repo