Add single header and single source entries for all components as well as the whole library #2

Merged
abdelrahman merged 5 commits from compilation-restructure into main 2025-02-23 15:19:15 +00:00
Showing only changes of commit df65850678 - Show all commits

38
compile
View File

@ -1,6 +1,17 @@
#!/bin/bash
BUILD_TYPE="debug"
COMPONENTS="all"
function join_array {
DELIM="$1"
shift
local IFS="$DELIM"
echo "$*"
}
SUPPORTED_COMPONENTS=("all" "testing" "os" "core")
COMPONENTS_STRING="$(join_array "|" ${SUPPORTED_COMPONENTS[@]})"
while [[ $# > 0 ]];do
case $1 in
@ -8,8 +19,14 @@ while [[ $# > 0 ]];do
BUILD_TYPE="release"
shift
;;
--components)
COMPONENTS="$2"
shift
shift
;;
*|-*|--*)
echo "Unknown option $1"
echo "Usage: $0 [--release] [--components $COMPONENTS_STRING (Default: all)]"
exit 1
;;
esac
@ -25,7 +42,26 @@ if [[ $CC == "gcc" ]]; then
fi
INCLUDE="$(find src -type d | xargs -I{} echo -n "-I{} ")"
SRC="$(find src -type f -name "*.c" | xargs -I{} echo -n "{} ")"
case $COMPONENTS in
all)
SRC="src/wapp.c"
;;
testing)
SRC="src/testing/wapp_testing.c"
;;
os)
SRC="src/os/wapp_os.c"
;;
core)
SRC="src/core/wapp_core.c"
;;
*)
echo "Unrecognised option for components: $COMPONENTS"
echo "Accepted options: $COMPONENTS_STRING"
exit 2
;;
esac
TEST_INCLUDE="$(find tests -type d | xargs -I{} echo -n "-I{} ")"
TEST_SRC="$(find tests -type f -name "*.c" | xargs -I{} echo -n "{} ")"