Repository navigation
Expand file tree
/
Copy pathMakefile
More file actions
119 lines (107 loc) · 4.41 KB
/
Copy pathMakefile
File metadata and controls
119 lines (107 loc) · 4.41 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
# **************************************************************************** #
# #
# ::: :::::::: #
# Makefile :+: :+: :+: #
# +:+ +:+ +:+ #
# By: danfern3 <danfern3@student.42.fr> +#+ +:+ +#+ #
# +#+#+#+#+#+ +#+ #
# Created: 2026/10/17 13:37:19 by danfern3 #+# #+# #
# Updated: 2026/10/17 13:53:23 by danfern3 ### ########.fr #
# #
# **************************************************************************** #
SHELL := /usr/bin/bash
.SHELLFLAGS := -ec
BLUE := $(shell printf '\033[0;34m')
GREEN := $(shell printf '\033[0;32m')
YELLOW := $(shell printf '\033[0;33m')
RESET := $(shell printf '\033[0m')
CYAN := $(shell printf '\033[0;36m')
ORANGE := $(shell printf '\033[0;31m')
RED := $(shell printf '\033[0;31m')
SUCCESS := $(GREEN)✓
FAIL := $(RED)✗
INFO := $(CYAN)ℹ
WARN := $(YELLOW)⚠
PRINT_BANNER := ./bash/print_banner.sh
PRINT_SUCCESS := ./bash/print_success.sh
PRINT_FAIL := ./bash/print_fail.sh
PRINT_INFO := ./bash/print_info.sh
PRINT_WARN := ./bash/print_warning.sh
RUN_AND_LOG := ./bash/run_and_log.sh
# * Top row (╭━━━╮) - round corners, full-span
# * Bottom row (╰━━━╯) - round corners, full-span
# * Merge row (┣━━━┫) - full-span, left/right T junctions
# * Merge-bottom (╰━━━╯) - alias for kind 3
# * Column cross (┣━╋━┫) - cross junctions (columns above/below)
# * Column open (┣━┳━┫) - T-down (columns start below)
# * Column close (┣━┻━┫) - T-up (columns end above)
TOP_LEFT_CORNER := $(ORANGE)╭$(RESET)
TOP_RIGHT_CORNER := $(ORANGE)╮$(RESET)
BOTTOM_LEFT_CORNER := $(ORANGE)╰$(RESET)
BOTTOM_RIGHT_CORNER := $(ORANGE)╯$(RESET)
HORIZONTAL_LINE := $(ORANGE)━$(RESET)
VERTICAL_LINE := $(ORANGE)┃$(RESET)
LEFT_JUNCTION := $(ORANGE)┣$(RESET)
RIGHT_JUNCTION := $(ORANGE)┫$(RESET)
CROSS_JUNCTION := $(ORANGE)┣$(RESET)$(ORANGE)━$(RESET)$(ORANGE)┫$(RESET)
OPEN_JUNCTION := $(ORANGE)┣$(RESET)$(ORANGE)━$(RESET)$(ORANGE)┫$(RESET)
CLOSE_JUNCTION := $(ORANGE)┣$(RESET)$(ORANGE)━$(RESET)$(ORANGE)┫$(RESET)
.DEFAULT_GOAL := help
.PHONY: help
# ── Utils
help: ## Show available targets
@$(PRINT_BANNER) "Available Makefile Targets"
@LC_ALL=C.UTF-8 awk '\
function trim(s) { \
sub(/^[[:space:]]+/, "", s); \
sub(/[[:space:]]+$$/, "", s); \
return s \
} \
/^# ──[[:space:]]+/ { \
title = $$0; \
sub(/^# ──[[:space:]]+/, "", title); \
sub(/[[:space:]]*─+[[:space:]]*$$/, "", title); \
title = trim(title); \
n++; kind[n] = "section"; text[n] = title; \
next \
} \
/^[a-zA-Z_-]+:.*## / { \
name = $$0; sub(/:.*/, "", name); \
msg = $$0; sub(/^[^#]*## /, "", msg); \
n++; kind[n] = "target"; names[n] = name; msgs[n] = msg; \
if (length(name) > name_width) name_width = length(name); \
next \
} \
END { \
for (i = 1; i <= n; i++) \
if (kind[i] == "target") { \
line = 2 + name_width + 1 + length(msgs[i]); \
if (line > line_width) line_width = line \
} \
for (i = 1; i <= n; i++) \
if (kind[i] == "section") { \
label = "── " text[i] " "; \
pad = line_width - length(label); \
if (pad < 1) pad = 1; \
dashes = ""; \
for (j = 0; j < pad; j++) dashes = dashes "─"; \
printf "%s%s\n", label, dashes \
} else \
printf " $(CYAN)%-*s$(RESET) %s\n", name_width, names[i], msgs[i] \
}' Makefile
.PHONY: lint-bash-scripts
lint-bash-scripts: ## Lint all bash scripts in the repository
@$(PRINT_BANNER) "Linting Bash Scripts"
@$(RUN_AND_LOG) -c "./bash/lint_bash_scripts.sh"
@$(PRINT_SUCCESS) "Bash scripts linted successfully!"
.PHONY: lint-python-scripts
lint-python-scripts: ## Lint all Python scripts in the repository
@$(call print_banner,Linting Python Scripts)
@./python/lint_python_scripts.py
@$(PRINT_SUCCESS) "Python scripts linted successfully!"
.PHONY: lint
lint: ## Lint all bash and Python scripts
@$(PRINT_BANNER) "Linting All Scripts"
@$(MAKE) -s lint-bash-scripts
@$(MAKE) -s lint-python-scripts
@$(PRINT_SUCCESS) "All scripts linted successfully!"