-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
40 lines (29 loc) · 772 Bytes
/
Makefile
File metadata and controls
40 lines (29 loc) · 772 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
CC := gcc
SRCDIR := src
BINDIR := bin
OBJDIR := obj
INCDIR := include
EXEC := stock-sim
LINK := -lm -lpthread -lrt
INC := -I $(INCDIR)
CFLAGS := $(LINK) -Wall -Wextra -pedantic $(INC)
SRCFILES := $(shell find $(SRCDIR) -type f -name *.c)
OBJFILES := $(patsubst $(SRCDIR)/%.c,$(OBJDIR)/%.o,$(SRCFILES))
.PHONY: clean makedirs debug perf all tsan
.SUBLIME_TARGETS: all debug perf clean tsan
all: makedirs $(EXEC)
tsan: CFLAGS += -fsanitize=thread
tsan: debug
debug: CFLAGS += -g -DDEBUG
debug: all
perf: CFLAGS += -O3 -DPERF
perf: all
clean:
-/bin/rm -rf $(OBJDIR) $(BINDIR)
makedirs:
/bin/mkdir -p bin obj
$(OBJDIR)/%.o: $(SRCDIR)/%.c
$(CC) -c -o $@ $< $(CFLAGS)
$(EXEC): $(OBJFILES)
$(CC) $^ -o $(BINDIR)/$@ $(CFLAGS)
@echo "---=== COMPILE SUCCESS ===---"