-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
47 lines (40 loc) · 1.25 KB
/
Makefile
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
build: clean
gcc -ggdb -rdynamic -o kommando $(shell find ./bootstrap -name "*.c") -Wall -Wextra -Werror -Wpointer-arith -Wno-error=unused-but-set-variable -Wno-error=unused-variable -Wno-error=unused-function -Wno-error=unused-parameter
clean:
@rm -f kommando
@rm -f CACHELOG.txt
@rm -f MEMTRACE.txt
br: build run
run:
name=$(basename $(file) .kdo); \
./kommando $(shell ./kdolib/link) $$name.kdo $$name -cr -vv
compile:
name=$(basename $(file) .kdo); \
./kommando $(shell ./kdolib/link) $$name.kdo $$name -c -vv
help:
./kommando --help
clean_examples:
@git clean -fX examples >/dev/null
test: build clean_examples
@success=0; \
fail=0; \
all_files=$$(find ./examples -name "*.kdo"); \
count=$$(echo $$all_files | wc -w); \
index=0; \
printf "Running tests...\n"; \
for file in $$all_files; do \
index=$$((index + 1)); \
if make compile file=$$file > /dev/null 2>&1; then \
printf "[\x1b[1;32mOK\x1b[0m] ($$index/$$count) $$file\n"; \
success=$$((success + 1)); \
else \
printf "[\x1b[1;31mERROR\x1b[0m] ($$index/$$count) $$file\n"; \
fail=$$((fail + 1)); \
fi; \
done; \
printf "Tests complete.\n"; \
printf "\x1b[1;32msuccess: $$success\x1b[0m\t\x1b[1;31mfail: $$fail\x1b[0m\n"; \
if (test $$fail -ne 0) \
then \
(exit 1); \
fi \