aboutsummaryrefslogtreecommitdiff
path: root/Makefile
blob: 50b7f455f73d3ed1e631adf30a67bd88e2e589a3 (plain) (blame)
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
CXX = g++ -DGMP_SUPPORT
BUILD_DIR = build

all: release
debug: CXX += -g -pg
gc_debug: CXX += -DGC_INFO -DGC_DEBUG -g -pg

release: $(BUILD_DIR) $(BUILD_DIR)/sonsi
debug: $(BUILD_DIR) $(BUILD_DIR)/sonsi
gc_debug: $(BUILD_DIR) $(BUILD_DIR)/sonsi

_OBJS = main.o \
	parser.o builtin.o \
	model.o eval.o exc.o \
	consts.o types.o gc.o


OBJS = $(patsubst %, $(BUILD_DIR)/%, $(_OBJS))

$(BUILD_DIR)/sonsi: $(OBJS) 
	$(CXX) -o $(BUILD_DIR)/sonsi $^ -lgmp

$(BUILD_DIR):
	mkdir -p $(BUILD_DIR)

$(BUILD_DIR)/%.o : %.cpp
	$(CXX) -o $@ -c $< -Wall -O2

clean:
	rm -rf $(BUILD_DIR)

db:
	gdb $(BUILD_DIR)/sonsi

cdb:
	cgdb $(BUILD_DIR)/sonsi

run:
	./$(BUILD_DIR)/sonsi