diff --git a/default.config b/default.config index 407332d..db6ac8d 100644 --- a/default.config +++ b/default.config @@ -7,7 +7,7 @@ CMP_C="gcc" CMP_CPP="g++" STD_C="c11" STD_CPP="c++11" -WARN_C="-Wall -Wno-ignored-qualifiers -Wextra -Wno-unused-parameter" +WARN_C="-Wall -Wno-discarded-qualifiers -Wextra -Wno-unused-parameter" WARN_CPP="-Wall -Wextra -Wno-unused-parameter" SRC_C="$( find src -name '*.c')" SRC_CPP="$( find src -name '*.cpp')" @@ -15,10 +15,9 @@ TESTS_C="$( find tests -name '*.c')" TESTS_CPP="$(find tests -name '*.cpp')" # OBJDIR structure: -# ├── objects - dir where compiled *.o files are stored. cleans every call of build task -# ├── profile - dir where gcc *.gcda profiling info files stored -# ├── libs - there you can put static libs and linker will find them -# └── out - output files are created here and then copied to OUTDIR +# ├── objects/ - dir where compiled *.o files are stored. cleans every call of build task +# ├── profile/ - dir where gcc *.gcda profiling info files stored +# └── libs/ - there you can put static libs and linker will find them OBJDIR="obj" OUTDIR="bin" STATIC_LIB_FILE="$PROJECT.a" diff --git a/functions.sh b/functions.sh index e589ff6..bba1d3f 100755 --- a/functions.sh +++ b/functions.sh @@ -83,16 +83,14 @@ function link { local args="$1" myprint "${BLUE}args: ${GRAY}$args" local outfile="$2" - clean_dir $OBJDIR/out myprint "${BLUE}outfile: ${GRAY}$outfile" local objects="$(find $OBJDIR/objects -name '*.o') $(find $OBJDIR/libs -name '*.a')" myprint "${BLUE}objects: ${GRAY}$objects" - local command="$CMP_CPP $(echo "$objects" | tr '\n' ' ') $args -o $OBJDIR/out/$outfile" + local command="$CMP_CPP $(echo "$objects" | tr '\n' ' ') $args -o $OUTDIR/$outfile" myprint "$command" if $command then - cp "$OBJDIR/out/$outfile" "$OUTDIR/$outfile" myprint "${GREEN}file $CYAN$outfile ${GREEN}created" else error "some error happened" @@ -107,9 +105,8 @@ function pack_static_lib { local objects="$(find $OBJDIR/objects -name *.o) $(find $OBJDIR/libs -name '*.a')" myprint "${BLUE}objects: ${GRAY}$objects" - if gcc-ar rcs -o "$OBJDIR/out/$outfile" $(echo "$objects" | tr '\n' ' ') + if ar rcs "$OUTDIR/$outfile" $(echo "$objects" | tr '\n' ' ') then - cp "$OBJDIR/out/$outfile" "$OUTDIR/$outfile" myprint "${GREEN}file $CYAN$outfile ${GREEN}created" else error "some error happened" diff --git a/init.sh b/init.sh index 83893bc..0b5bf8d 100755 --- a/init.sh +++ b/init.sh @@ -69,7 +69,6 @@ mkdir -p "$OUTDIR" mkdir -p "$OBJDIR/libs" mkdir -p "$OBJDIR/objects" mkdir -p "$OBJDIR/profile" -mkdir -p "$OBJDIR/out" # dont thorw error on undefined variable set +u