Modular Makefile (#1288)

Signed-off-by: Ali Mehraji <a.mehraji75@gmail.com>
Co-authored-by: houseme <housemecn@gmail.com>
This commit is contained in:
Ali Mehraji
2025-12-28 17:27:44 +03:30
committed by GitHub
parent 71c59d1187
commit c7e2b4d8e7
14 changed files with 404 additions and 372 deletions

26
scripts/makefile-header.sh Executable file
View File

@@ -0,0 +1,26 @@
#!/usr/bin/env bash
# Total width of the whole line
WIDTH=100 # adjust if you want longer/shorter lines
print_heading() {
local title="$1"
local prefix="## —— "
local suffix=" "
local dash="-"
# length of the visible title block
local block_len=$(( ${#prefix} + ${#title} + ${#suffix} ))
# number of dashes needed
local dash_count=$(( WIDTH - block_len ))
# build dash line
local dashes
dashes=$(printf "%*s" "$dash_count" "" | tr ' ' "$dash")
# print the final heading
printf "%s%s%s%s\n" "$prefix" "$title" "$suffix" "$dashes"
}
print_heading "$1"