This commit is contained in:
Timerix22 2023-03-29 19:57:00 +06:00
parent d64b1f3e9b
commit d72aa0c809
3 changed files with 10 additions and 4 deletions

View File

@ -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`

View File

@ -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"

View File

@ -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)