From f4ed73a2a47bb8c06313ae65de4f30b0433c0cb6 Mon Sep 17 00:00:00 2001 From: Timerix Date: Fri, 19 Jul 2024 00:05:48 +0300 Subject: [PATCH] cbuild v2.0 --- .gitmodules | 3 -- Makefile | 75 --------------------------------------------- cbuild | 1 - default.config | 38 ++++++++++++----------- kerep | 2 +- libkerep-dbg.config | 10 ++++++ libkerep.config | 10 ++++++ 7 files changed, 41 insertions(+), 98 deletions(-) delete mode 100644 Makefile delete mode 160000 cbuild create mode 100644 libkerep-dbg.config create mode 100644 libkerep.config diff --git a/.gitmodules b/.gitmodules index c2a7e3a..c9e9276 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,6 +1,3 @@ [submodule "kerep"] path = kerep url = https://timerix.ddns.net:3322/Timerix/kerep.git -[submodule "cbuild"] - path = cbuild - url = https://timerix.ddns.net:3322/Timerix/cbuild.git diff --git a/Makefile b/Makefile deleted file mode 100644 index d647993..0000000 --- a/Makefile +++ /dev/null @@ -1,75 +0,0 @@ -###################################### -###### Build tasks ####### -###################################### - -all: build_exec_dbg - -# creates executable using profiling info generated by profile -build_exec: profile - @cbuild/call_task.sh build_exec 2>&1 | tee -a make_raw.log - -# creates executable with debug info and no optimizations -build_exec_dbg: - @cbuild/call_task.sh build_exec_dbg 2>&1 | tee make_raw.log - -# recompile libkerep.a in the next build task -rebuild_kerep: - @cbuild/rebuild_dep.sh libkerep.a 2>&1 | tee make_raw.log - -#rebuild_all: rebuild_kerep - -###################################### -###### Launch tasks ####### -###################################### - -# executes $EXEC_FILE -exec: build_exec - @cbuild/call_task.sh exec 2>&1 | tee -a make_raw.log - -# executes $EXEC_FILE -exec_dbg: build_exec_dbg - @cbuild/call_task.sh exec 2>&1 | tee -a make_raw.log - -# executes $EXEC_FILE with valgrind memory checker -valgrind: build_exec_dbg - @cbuild/call_task.sh valgrind 2>&1 | tee -a make_raw.log - -# generates profiling info -profile: - @cbuild/call_task.sh profile 2>&1 | tee make_raw.log - -# compiles program with -pg and runs it with gprof -# uses gprof2dot python script to generate function call tree (pip install gprof2dot) -# requires graphviz (https://www.graphviz.org/download/source/) -gprof: - @cbuild/call_task.sh gprof 2>&1 | tee make_raw.log - -# compiles program and runs it with callgrind (part of valgrind) -# uses gprof2dot python script to generate function call tree (pip install gprof2dot) -# requires graphviz (https://www.graphviz.org/download/source/) -# P.S. detailed results can be viewed in KCacheGrind -callgrind: - @cbuild/call_task.sh callgrind 2>&1 | tee make_raw.log - -# compiles executable with sanitizers and executes it to find errors and warnings -sanitize: - @cbuild/call_task.sh sanitize 2>&1 | tee make_raw.log - -###################################### -###### Other tasks ####### -###################################### - -# deletes generated files -clean: - @cbuild/call_task.sh clean 2>&1 | tee make_raw.log - -# removes all unreadable characters copied from stdio -fix_log: - sed 's/[^[:blank:][:print:]]//g' make_raw.log \ - | sed 's/\[0;[0-9][0-9]m//g' \ - | sed 's/\[0;[0-9]m//g' \ - | sed 's/\[[0-9][0-9]m//g' \ - | sed 's/\[[0-9]m//g' \ - | sed 's/ H //g' \ - | sed 's/\[3gH //g' \ - > make_fixed.log diff --git a/cbuild b/cbuild deleted file mode 160000 index 6d285a8..0000000 --- a/cbuild +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 6d285a88d869e7710a196aaa91a162658fe0efc0 diff --git a/default.config b/default.config index f443241..6b769d0 100644 --- a/default.config +++ b/default.config @@ -1,6 +1,6 @@ -#!/bin/bash -CBUILD_VERSION=7 -CONFIG_VERSION=1 +#!/usr/bin/env bash +CBUILD_VERSION=2.0.2 +CONFIG_VERSION=2 PROJECT="port-tunnel" CMP_C="gcc" @@ -14,20 +14,17 @@ SRC_CPP="$( find src -name '*.cpp')" #TESTS_C="$( find tests -name '*.c')" #TESTS_CPP="$(find tests -name '*.cpp')" -# dir with dependeicy dirs -DEPS_BASEDIR="." -# EXAMPLE: "dependency_dir='build_task out_dir lib_file' -# other_depndency_dir=..." -# Dependencies must be declared on separate lines -# Values can be override by resetting one of dependencies: -# DEPS="$DEPS -# dependency_dir='...'" -DEPS="kerep='build_static_lib bin libkerep.a'" +# Directory with dependency configs. +# See cbuild/example_dependency_configs +DEPENDENCY_CONFIGS_DIR='.' +# List of dependency config files in DEPENDENCY_CONFIGS_DIR separated by space. +ENABLED_DEPENDENCIES='libkerep' # 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 +# ├── objects/ - Compiled object files. Cleans on each call of build task +# ├── static_libs/ - Symbolic links to static libraries used by linker. Cleans on each call of build task. +# ├── static_libs/ - Symbolic links to dynamic libraries used by linker. Cleans on each call of build task. +# └── profile/ - gcc *.gcda profiling info files OBJDIR="obj" OUTDIR="bin" STATIC_LIB_FILE="lib$PROJECT.a" @@ -74,8 +71,7 @@ case "$TASK" in PRE_TASK_SCRIPT= TASK_SCRIPT=cbuild/default_tasks/build_exec.sh POST_TASK_SCRIPT= - DEPS="$DEPS - kerep='build_static_lib_dbg bin libkerep.a'" + ENABLED_DEPENDENCIES="libkerep-dbg" ;; # executes $EXEC_FILE exec) @@ -83,7 +79,7 @@ case "$TASK" in ;; # executes $EXEC_FILE with valgrind memory checker valgrind) - VALGRIND_ARGS="-s --read-var-info=yes --track-origins=yes --fullpath-after=$PROJECT/ --leak-check=full --show-leak-kinds=all" + VALGRIND_ARGS="-s --read-var-info=yes --track-origins=yes --fullpath-after=$(pwd) --leak-check=full --show-leak-kinds=all" TASK_SCRIPT=cbuild/default_tasks/valgrind.sh ;; # generates profiling info @@ -139,6 +135,12 @@ case "$TASK" in TASK_SCRIPT=cbuild/default_tasks/exec.sh POST_TASK_SCRIPT= ;; + # rebuilds specified dependencies + # EXAMPLE: `cbuild rebuild_dependencies=libexample1,fonts` + # 'all' can be specified to rebuild all dependencies + rebuild_dependencies) + TASK_SCRIPT=cbuild/default_tasks/rebuild_dependencies.sh + ;; # deletes generated files clean) TASK_SCRIPT=cbuild/default_tasks/clean.sh diff --git a/kerep b/kerep index 2d98bd7..b1299eb 160000 --- a/kerep +++ b/kerep @@ -1 +1 @@ -Subproject commit 2d98bd7719fd305985999722526f27feacb78ffb +Subproject commit b1299ebd311789887031523ec4a768f9eefb4bce diff --git a/libkerep-dbg.config b/libkerep-dbg.config new file mode 100644 index 0000000..e3d026c --- /dev/null +++ b/libkerep-dbg.config @@ -0,0 +1,10 @@ +#!/usr/bin/env bash +DEP_WORKING_DIR='kerep' +DEP_PRE_BUILD_COMMAND='' +DEP_BUILD_COMMAND='cbuild build_static_lib' +DEP_POST_BUILD_COMMAND='' +DEP_CLEAN_COMMAND='cbuild clean' +# won't be copied to project $OUTDIR +DEP_STATIC_OUT_FILES='bin/libkerep.a' +# will be copied tp project $OUTDIR +DEP_DYNAMIC_OUT_FILES='' diff --git a/libkerep.config b/libkerep.config new file mode 100644 index 0000000..e3d026c --- /dev/null +++ b/libkerep.config @@ -0,0 +1,10 @@ +#!/usr/bin/env bash +DEP_WORKING_DIR='kerep' +DEP_PRE_BUILD_COMMAND='' +DEP_BUILD_COMMAND='cbuild build_static_lib' +DEP_POST_BUILD_COMMAND='' +DEP_CLEAN_COMMAND='cbuild clean' +# won't be copied to project $OUTDIR +DEP_STATIC_OUT_FILES='bin/libkerep.a' +# will be copied tp project $OUTDIR +DEP_DYNAMIC_OUT_FILES=''