-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
36 lines (30 loc) · 1 KB
/
Makefile
File metadata and controls
36 lines (30 loc) · 1 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
CCARGS := -std=gnu2x -Wall -Wextra -Werror -O1
CC := gcc-13
.PHONY: run
run: example_one.out example_two.out example_doc.out
./example_one.out
./example_two.out
./example_doc.out
.PHONY: fmt
fmt: *.h *.c
clang-format -Werror -i $^
.PHONY: check
check: example_one.log example_two.log example_doc.log
grep -qE "answer == 42.+answer == 54" example_one.log
grep -q "3 == 4" example_one.log
grep -q "^example_one.c" example_one.log
grep -qE "negative checks.+: 2" example_two.log
grep -q "^example_two.c" example_two.log
! grep -q "^example_one.c" example_two.log
grep -q "result == 16" example_doc.log
! grep -q "square(0) == 0" example_doc.log
grep -q "^example_doc.c" example_doc.log
README.md: README.template.md example_one.c example_one.log tect.h
sed -e "/SCRIPT_CONTENT/{r example_one.c" -e "d}" \
-e "/SCRIPT_OUTPUT/{r example_one.log" -e "d}" $< > $@
echo >> $@ # newline
grep -E "^\/\/ ?" tect.h | sed -E "s|^\/\/ ?||" >> $@
%.out: %.c tect.h
${CC} $(CCARGS) -o $@ $<
%.log: %.out
./$< > $@