-
Notifications
You must be signed in to change notification settings - Fork 1
/
Makefile
52 lines (38 loc) · 1.28 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
SHELL=/bin/bash
.ONESHELL:
UNAME_S := $(shell uname -s)
export SPELL_NAME=template
default:
export CHAOS_COMPILER=gcc
${MAKE} build
clang:
export CHAOS_COMPILER=clang
${MAKE} build
build:
ifeq ($(UNAME_S), Darwin)
${MAKE} build-macos
else
${MAKE} build-linux
endif
build-linux:
${CHAOS_COMPILER} -shared -fPIC ${SPELL_NAME}.c -o ${SPELL_NAME}.so
build-macos:
${CHAOS_COMPILER} -shared -fPIC -undefined dynamic_lookup ${SPELL_NAME}.c -o ${SPELL_NAME}.dylib
spell:
mkdir -p spells/${SPELL_NAME}
export GLOBIGNORE='*.c'
cp ${SPELL_NAME}.* spells/${SPELL_NAME}/
test: spell
./test.sh
test-compiler: spell
./test.sh compile
memcheck: spell
valgrind --tool=memcheck --leak-check=full --show-reachable=yes --num-callers=20 --track-fds=yes --track-origins=yes --error-exitcode=1 chaos test.kaos || exit 1
memcheck-compiler: spell
valgrind --tool=memcheck --leak-check=full --show-reachable=yes --num-callers=20 --track-fds=yes --track-origins=yes --error-exitcode=1 chaos -c test.kaos || exit 1
valgrind --tool=memcheck --leak-check=full --show-reachable=yes --num-callers=20 --track-fds=yes --track-origins=yes --error-exitcode=1 build/main || exit 1
requirements:
git clone https://github.com/chaos-lang/chaos.git .chaos/ && \
cd .chaos/ && \
make requirements && \
rm -rf .chaos/