-
Notifications
You must be signed in to change notification settings - Fork 3
/
Makefile
77 lines (68 loc) · 1.35 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
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
.PHONY: all clean install test lint fuzz
CC = cc
INSTALL = install
prefix = /usr/local
bindir = $(prefix)/bin
datarootdir = $(prefix)/share
mandir = $(datarootdir)/man
all = hardv hardv.1
all: $(all)
hardv: hardv.c
$(CC) $(CFLAGS) -o hardv hardv.c
hardv.1: hardv.1.s hardv
@echo building manpage...
@set -e; \
cp hardv.1.s hardv.1; \
printf '\n.SH VERSION\n\n' >>hardv.1; \
printf '.nf\n' >>hardv.1; \
printf 'HardV ' >>hardv.1; \
./hardv --version | head -n1 | cut -d' ' -f2 >>hardv.1; \
printf '.fi\n' >>hardv.1;
test: $(all)
@set -e; \
PATH="`pwd`:$$PATH"; \
for i in test/*; do \
cd $$i; \
echo running test $$i...; \
chmod +x run; \
./run; \
cd ../..; \
done; \
echo all tests passed;
clean:
@rm -rf $(all) lint fuzz *.tmp
@for i in test/*; do \
cd $$i; \
./clean; \
cd ../..; \
done
install: $(all)
@$(INSTALL) -d $(bindir)
$(INSTALL) hardv $(bindir)
@$(INSTALL) -d $(mandir)/man1
$(INSTALL) hardv.1 $(mandir)/man1
lint:
@set -e; \
rm -rf lint; \
mkdir -p lint; \
cp hardv.c hardv.1.s Makefile lint; \
cd lint; \
make \
'CFLAGS= \
-pedantic-errors \
-Wextra \
-Wno-error'
fuzz:
@set -e; \
rm -rf fuzz; \
mkdir -p fuzz; \
cp -r hardv.c hardv.1.s test Makefile fuzz; \
cd fuzz; \
make test \
'CFLAGS= \
-pedantic-errors \
-Wextra \
-Wno-error \
-O3 \
-fno-sanitize-recover \
-fsanitize=address,undefined'