forked from ayende/libgavran
-
Notifications
You must be signed in to change notification settings - Fork 0
/
makefile
45 lines (29 loc) · 1.07 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
# the compiler to use
CC = clang
# compiler flags:
# -g adds debugging information to the executable file
# -Wall turns on most, but not all, compiler warnings
TARGET_EXEC ?= gavran
BUILD_DIR ?= ./build
SRC_DIRS ?= ./
SRCS := $(shell find $(SRC_DIRS) -name '*.c')
OBJS := $(SRCS:%=$(BUILD_DIR)/%.o)
DEPS := $(OBJS:.o=.d)
INC_DIRS := $(shell find $(SRC_DIRS) -type d) ./../../include
INC_FLAGS := $(addprefix -I,$(INC_DIRS))
WARNINGS = -Weverything -Werror -Wno-gnu-zero-variadic-macro-arguments -Wno-pointer-arith -Wno-reserved-id-macro -Wno-covered-switch-default -Wno-newline-eof -Wno-assign-enum
DEFINES = -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE
CFLAGS = -g $(WARNINGS) $(INC_FLAGS) -MMD -MP $(DEFINES) -fPIC $(ASAN) -fblocks
LDFLAGS = -lm -lsodium -lzstd -lncurses -lBlocksRuntime #-shared
$(BUILD_DIR)/$(TARGET_EXEC): $(OBJS)
$(CC) $(OBJS) -o [email protected] $(LDFLAGS) -shared
$(CC) $(OBJS) -o $@ $(LDFLAGS)
# c source
$(BUILD_DIR)/%.c.o: %.c
$(MKDIR_P) $(dir $@)
$(CC) $(CFLAGS) -c $< -o $@
.PHONY: clean
clean:
$(RM) -r $(BUILD_DIR)
-include $(DEPS)
MKDIR_P ?= mkdir -p