forked from LosFuzzys/LosTemplates
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
95 lines (85 loc) · 3.12 KB
/
Makefile
File metadata and controls
95 lines (85 loc) · 3.12 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
.PHONY: versions patch test
SHELL := /bin/bash
NAME_LENGTH:=30
VERSION_LENGTH:=7
versions:
@rm -f .versions
$(eval NAME_SEPERATOR := $(shell printf -- '-%.0s' {2..$(NAME_LENGTH)}))
@printf "| %*s | %s |\n" -${NAME_LENGTH} "Name" "Version"
@printf "| :%s | :-----: |\n" $(NAME_SEPERATOR)
@for DIR_NAME in $(wildcard */); do \
if [ -f $$DIR_NAME/Makefile ]; then \
CLEANED_NAME=$$(realpath --relative-to . $$DIR_NAME); \
VERSION=$$(awk -F "=" '/export _VERSION = ([0-9.]+)/ {print $$2}' $$DIR_NAME/Makefile); \
echo $$CLEANED_NAME $$VERSION >> .versions ; \
printf "| %-$(NAME_LENGTH)s | %-$(VERSION_LENGTH)s |\n" $$CLEANED_NAME $$VERSION ; \
fi \
done
PATCH:=./name.patch
patch:
@if [ -f ${PATCH} ]; then \
for f in $(wildcard */) ; do \
if [[ -d "$$f" && -f "$$f/Makefile" ]]; then \
echo -e "\e[1;35m[+] Patching $$f with ${PATCH}\e[0m"; \
patch -d $$f --backup-if-mismatch -p2 < ${PATCH}; \
fi \
done \
else \
echo -e "\e[1;31m[+] ${PATCH} file does not exist"; \
fi
test:
@for DIR_NAME in $(wildcard */); do \
if [ -f $$DIR_NAME/Makefile ]; then \
echo -e "\e[1;35m------------------------------------------------\e[0m"; \
echo -e "\e[1;35m make -C $$DIR_NAME test \e[0m"; \
echo -e "\e[1;35m------------------------------------------------\e[0m"; \
make -C $$DIR_NAME test; \
echo -e "\e[1;35m------------------------------------------------\e[0m"; \
echo -e ""; \
fi \
done
TIMEOUT_DIST=30
dist-test:
@for DIR_NAME in $(wildcard */); do \
if [ -f $$DIR_NAME/Makefile ]; then \
echo -e "\e[1;35m------------------------------------------------\e[0m"; \
echo -e "\e[1;35m make -C $$DIR_NAME dist test \e[0m"; \
echo -e "\e[1;35m------------------------------------------------\e[0m"; \
echo -e "\e[1;34m[+] Generating dist... \e[0m"; \
timeout ${TIMEOUT_DIST} make -C $$DIR_NAME dist &>/dev/null; \
make -C $$DIR_NAME test; \
echo -e "\e[1;35m------------------------------------------------\e[0m"; \
echo -e ""; \
fi \
done
lint:
@for DIR_NAME in $(wildcard */); do \
if [ -f $$DIR_NAME/Makefile ]; then \
echo -e "\e[1;35m------------------------------------------------\e[0m"; \
echo -e "\e[1;35m make -C $$DIR_NAME lint \e[0m"; \
echo -e "\e[1;35m------------------------------------------------\e[0m"; \
make -C $$DIR_NAME lint; \
echo -e "\e[1;35m------------------------------------------------\e[0m"; \
echo -e ""; \
fi \
done
kill:
@for DIR_NAME in $(wildcard */); do \
if [ -f $$DIR_NAME/Makefile ]; then \
echo -e "\e[1;35m------------------------------------------------\e[0m"; \
echo -e "\e[1;35m make -C $$DIR_NAME kill \e[0m"; \
echo -e "\e[1;35m------------------------------------------------\e[0m"; \
make -C $$DIR_NAME kill; \
echo -e "\e[1;35m------------------------------------------------\e[0m"; \
echo -e ""; \
fi \
done
clean:
@for DIR_NAME in $(wildcard */); do \
if [ -f $$DIR_NAME/Makefile ]; then \
echo -e "\e[1;35m[+] Cleaning $$DIR_NAME \e[0m"; \
${RM} $$DIR_NAME/*.tar.gz; \
${RM} $$DIR_NAME/*.log; \
fi \
done
# vim:tabstop=2 softtabstop=2 shiftwidth=2 noexpandtab colorcolumn=81