-
Notifications
You must be signed in to change notification settings - Fork 2
/
Makefile
41 lines (27 loc) · 975 Bytes
/
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
TARGET_EXEC ?= "vulkan-triangle"
BUILD_DIR ?= ./obj
SRC_DIRS ?= src
SRCS := $(shell find $(SRC_DIRS) -type f -name *.c)
OBJS := $(SRCS:%=$(BUILD_DIR)/%.o)
INC_DIRS := include
INC_FLAGS := $(addprefix -I,$(INC_DIRS))
LDFLAGS := -lm -lvulkan -lglfw
CC := clang
CFLAGS ?= $(INC_FLAGS) -std=c2x -MMD -MP -O0 -g3 -Wall -Weverything -pedantic -Wno-switch-enum
#CC := clang
#CFLAGS ?= $(INC_FLAGS) -std=c11 --analyze -MMD -MP -O0 -g3 -Wall -Weverything -pedantic -Wno-padded -Wno-switch-enum
#CC := gcc
#CFLAGS ?= $(INC_FLAGS) -fanalyzer -std=c11 -MMD -MP -O0 -g3 -Wall -pedantic -Wno-padded -Wno-switch-enum
#CC := afl-gcc
#CFLAGS ?= $(INC_FLAGS) -std=c11 -MMD -MP -O0 -g3 -Wall -pedantic -Wno-padded -Wno-switch-enum
$(BUILD_DIR)/$(TARGET_EXEC): $(OBJS)
$(CC) $(OBJS) -o $@ $(LDFLAGS)
# c source
$(BUILD_DIR)/%.c.o: %.c
$(MKDIR_P) $(dir $@)
$(CC) $(CPPFLAGS) $(CFLAGS) -c $< -o $@
.PHONY: clean
clean:
$(RM) -r $(BUILD_DIR)
-include $(DEPS)
MKDIR_P ?= mkdir -p