-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
executable file
·44 lines (29 loc) · 787 Bytes
/
Copy pathMakefile
File metadata and controls
executable file
·44 lines (29 loc) · 787 Bytes
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
CC := gcc
name := carbon
src := src
inc := inc
obj := obj
srcf := $(shell find ./$(src) -type f -name "*.c")
objf := $(patsubst %.c,%.o,$(srcf))
objf := $(patsubst ./$(src)/%,./$(obj)/%,$(objf))
objdirs = $(dir $(objf))
executable := $(name)
flags := -O3 -Wall -std=c99
debugflags := -g -O0 -Wall -std=c99 -DDebug
ldflags := -lm
build: $(executable)
$(obj)/%.o: $(src)/%.c $(inc)/%.h
@mkdir -p $(objdirs)
$(CC) $(flags) -I$(inc) -c -o $@ $<
$(executable): $(objf)
$(CC) $(ldflags) $(objf) -o $(executable)
debug: flags = $(debugflags)
debug: $(executable)
run_new: $(executable)
st bash -c './$(executable) --disassemble test.cbn; read -n1' # using bash to see segfaults
run: $(executable)
./$(executable)
$(obj):
mkdir -p $(obj)
clean:
rm -f $(objf) $(executable)