-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
37 lines (27 loc) · 757 Bytes
/
Makefile
File metadata and controls
37 lines (27 loc) · 757 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
CC = gcc
BASE_CFLAGS = -Wall -Wextra -Wshadow -Wno-comment -Wno-unused-result -std=c23
LIBS = sodium
DEBUG ?= 0
ORDER ?= 5
SRCDIR = src
BINDIR = bin
ifeq ($(DEBUG), 0)
TARGET = $(BINDIR)/release.exe
CFLAGS = $(BASE_CFLAGS) -O3
else
TARGET = $(BINDIR)/debug.exe
CFLAGS = $(BASE_CFLAGS) -g -O0
endif
SOURCES = $(wildcard $(SRCDIR)/*.c)
HEADERS = $(wildcard $(SRCDIR)/*.h)
all: $(TARGET)
$(TARGET): $(SOURCES) $(HEADERS) Makefile | $(BINDIR)
$(CC) $(CFLAGS) -o $@ $(SOURCES) -DDEBUG=$(DEBUG) -DB_PLUS_TREE_ORDER=$(ORDER) -I$(SRCDIR) $(addprefix -l, $(LIBS))
$(BINDIR):
@mkdir $(BINDIR)
run: $(TARGET)
@wt.exe -f --size 40,16 -d "$(CURDIR)" "$(abspath $(TARGET))"
clean:
@rm -rf $(BINDIR)
rebuild: clean all
.PHONY: all run clean rebuild