-
Notifications
You must be signed in to change notification settings - Fork 2
/
Makefile
69 lines (56 loc) · 1.51 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
ifndef config
config=release
endif
ifeq ($(config),debug)
ALL_CFLAGS += -g -DDEBUG_MODE -DDEBUG_TRACE_EXECUTION
else ifeq ($(config),debuggc)
ALL_CFLAGS += -g -DDEBUG_STRESS_GC -DDEBUG_LOG_GC
else ifeq ($(config),optimize)
ALL_CFLAGS += -DOBA_COMPUTED_GOTO
else ifeq ($(config),test)
# Disable stack traces to simplify comparing error output.
ALL_CFLAGS += -DDISABLE_STACK_TRACES -DDEBUG_STRESS_GC
else ifneq ($(config),release)
$(error "invalid configuration $(config)")
endif
PROJECTS := oba
TARGET := oba
INCLUDES += -I ./src/include
ALL_CFLAGS += $(INCLUDES) -o $(TARGET)
.PHONY: all clean docs format run test help
all: $(PROJECTS)
clean:
@echo "==== Removing oba ===="
rm -rf $(TARGET)
docs:
@echo "=== Regenerating documentation ==="
tools/docs.sh -b
format:
@echo "==== Formatting oba source code ===="
find . -regex '.*\.\(c\|h\)' -exec clang-format -style=file -i {} \;
@echo "==== Formatting tools ===="
black tools/
oba: clean
@echo "==== Building oba ($(config)) ===="
python3 tools/inline_modules.py
$(CC) $(ALL_CFLAGS) ./src/main.c ./mod/*.c ./src/vm/*.c
run: oba
@echo "==== Running oba ($(config)) ===="
./oba
test:
@echo "==== Testing oba (test) ===="
make oba config=test
python3 tools/test.py
help:
@echo "Usage: make [target]"
@echo ""
@echo "TARGETS:"
@echo " all (default)"
@echo " clean"
@echo " docs"
@echo " format"
@echo " oba"
@echo " run"
@echo " test"
@echo ""
@echo "For more information, see https://github.com/premake/premake-core/wiki"