-
Notifications
You must be signed in to change notification settings - Fork 7
/
Makefile
78 lines (67 loc) · 2.11 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
78
## Copyright (C) 2018 Jeremiah Orians
## This file is part of scheme_interpreter
##
## scheme_interpreter is free software: you an redistribute it and/or modify
## it under the terms of the GNU General Public License as published by
## the Free Software Foundation, either version 3 of the License, or
## (at your option) any later version.
##
## scheme_interpreter is distributed in the hope that it will be useful,
## but WITHOUT ANY WARRANTY; without even the implied warranty of
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
## GNU General Public License for more details.
##
## You should have received a copy of the GNU General Public License
## along with scheme_interpreter. If not, see <http://www.gnu.org/licenses/>.
# Don't rebuild the built things in bin
VPATH = bin
CC = gcc
CFLAGS = -D_XOPEN_SOURCE=700 -O3 -std=c11 -ggdb -Wall -Werror -Wextra -Wpedantic -Wshadow -Wconversion -Wno-missing-field-initializers
RUN_SCRIPT=./util/run.sh
all: sch3
sch3: src/sch3.c
$(CC) $(CFLAGS) src/sch3.c -o bin/sch3
# Clean up after ourselves
.PHONY: clean
clean:
rm -f bin/sch3
DESTDIR:=
PREFIX:=/usr/local
bindir:=$(DESTDIR)$(PREFIX)/bin
.PHONY: install
install: sch3
mkdir -p $(bindir)
cp $^ $(bindir)
.PHONY: test
test: sch3
./tests/tests t/trivial "$(RUN_SCRIPT) {}"
./tests/tests t/simple "$(RUN_SCRIPT) {}"
./tests/tests t/mal "$(RUN_SCRIPT) {}"
./tests/tests t/rosetta "$(RUN_SCRIPT) {}"
./tests/tests t/scheme-tests "$(RUN_SCRIPT) {}"
./tests/tests t/sicp "$(RUN_SCRIPT) {}"
./tests/tests t/letrec "$(RUN_SCRIPT) {}"
analyze:
echo '##' PERFORMING SCAN BUILD
make clean
scan-build make
# echo '##' PERFORMING CPPCHECK
# cppcheck --enable=all ./src/sch3.c
echo '##' RUNNING WITH VALGRIND
make clean
make
make test RUN_SCRIPT=./util/run-valgrind.sh
echo '##' BUILDING WITH TCC
make clean
make CC=tcc
make test
echo '##' BUILDING WITH SANITIZE ADDRESS, MEMORY, UNDEFINED
make clean
make CC=clang CFLAGS='-fsanitize=address'
make test
make clean
make CC=clang CFLAGS='-fsanitize=memory -fsanitize-memory-track-origins'
make test
make clean
make CC=clang CFLAGS='-fsanitize=undefined'
make test