From d72aa0c8098fe2a427e50355250f473d70886502 Mon Sep 17 00:00:00 2001 From: Timerix22 Date: Wed, 29 Mar 2023 19:57:00 +0600 Subject: [PATCH] INCLUDE --- CHANGELOG.md | 1 + default.config | 3 +++ functions.sh | 10 ++++++---- 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 44cfa00..a4d9736 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,7 @@ + `build_profile` task was split to `profile` and `gprof` + added task `sanitize` + default C++ standard set to `c++11` ++ added `INCLUDE` to `default.config` # v5 + added task `clean` diff --git a/default.config b/default.config index 2765dbb..695b15a 100644 --- a/default.config +++ b/default.config @@ -28,10 +28,13 @@ case "$OS" in WINDOWS) EXEC_FILE="$PROJECT.exe" SHARED_LIB_FILE="$PROJECT.dll" + # example: "-I./" + INCLUDE="" ;; LINUX) EXEC_FILE="$PROJECT" SHARED_LIB_FILE="$PROJECT.so" + INCLUDE="" ;; *) error "operating system $OS has no configuration variants" diff --git a/functions.sh b/functions.sh index 2d28d25..a8c747a 100755 --- a/functions.sh +++ b/functions.sh @@ -32,14 +32,16 @@ function compile { myprint "${BLUE}warnings: ${GRAY}$warn" local args="$4" myprint "${BLUE}args: ${GRAY}$args" - local sources="$5" + local include="$5" + myprint "${BLUE}include dirs: ${GRAY}$include" + local sources="$6" myprint "${BLUE}sources: ${GRAY}$sources" local compilation_error=0 for srcfile in $sources do ( local object="$OBJDIR/objects/$(basename $srcfile).o" - if ! $($cmp -std=$std $warn $args -c -o $object $srcfile) + if ! $($cmp -std=$std $warn $args $include -c -o $object $srcfile) then error "some error happened" #TODO parallel variable assignement doesnt work in bash @@ -58,13 +60,13 @@ function compile { # (args, sources) function compile_c { myprint "${CYAN}-------------[compile_c]--------------" - compile "$CMP_C" "$STD_C" "$WARN_C" "$1" "$2" + compile "$CMP_C" "$STD_C" "$WARN_C" "$1" "$INCLUDE" "$2" } # (args, sources) function compile_cpp { myprint "${CYAN}------------[compile_cpp]-------------" - compile "$CMP_CPP" "$STD_CPP" "$WARN_CPP" "$1" "$2" + compile "$CMP_CPP" "$STD_CPP" "$WARN_CPP" "$1" "$INCLUDE" "$2" } # (args, outfile)