-
Notifications
You must be signed in to change notification settings - Fork 0
/
GNUmakefile
86 lines (71 loc) · 2.29 KB
/
GNUmakefile
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
.PHONY: doc build test
MAKE?=make
all: banner_help
build: clean qi
qi:
@echo '======================================== Building qi == '
mkdir -p build
$(MAKE) -C src all
afl:
@echo '========================================= Fuzzing qi == '
# TODO: Currently this just fails with WARNING: Test case results in a time out
# I think this is because the application need to exit right after it loads
# a file for testing, but currently it just stays in the game loop
ifneq (, $(shell which afl-gcc))
./configure --cc=afl-gcc # --enable-debug
$(MAKE) clean qi
ifneq (, $(shell which afl-fuzz))
export AFL_I_DONT_CARE_ABOUT_MISSING_CRASHES=1; \
export AFL_SKIP_CPUFREQ=1; \
export AFL_NO_FORKSRV=1; \
afl-fuzz -t 2000+ -i $(PWD)/test_data/ -o build/fuzz $(PWD)/qi @@
endif
endif
clean:
@echo '======================================== Cleaning qi == '
$(MAKE) -C src clean
rm -rf build
rm -rf dist
test:
@echo '======================================= Running Tests == '
cat src/config.mak
$(MAKE) -C src test
dist: clean qi doc
@echo '======================================= Making Distro == '
mkdir -p dist
mv qi dist/qi
mv doc/output dist/doc
install:
@echo '============================================ Installl == '
$(MAKE) -C src install
distclean: clean
rm -f config.h config.mak
rm -rf dist
rm -rf doc/output
doc:
ifneq (, $(shell which doxygen))
doxygen doc/doxygen/Doxyfile
endif
checks:
ifneq (, $(shell which cppcheck))
cppcheck --enable=all --suppress=missingIncludeSystem \
--xml --xml-version=2 ./src \
2>report-src.xml
endif
banner_help:
@echo '=================================================================='
@echo '= 气 ='
@echo '= qi ='
@echo '=================================================================='
@echo ''
@echo 'Welcome to qi.'
@echo ''
@echo 'To build run ./configure, and then you can do one of the '
@echo ' following:'
@echo ''
@echo 'make qi - kick off script to make the edtior (probably what'
@echo ' you are after)'
@echo 'make clean - clean up build files'
@echo 'make distclean - clean build and config files (aka start over)'
@echo 'make doc - run doxygen on the code base'
@echo ''