forked from blurrypiano/littleVulkanEngine
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
63 lines (45 loc) · 1.92 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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
include .env
CFLAGS = -std=c++17 -I. -I$(LVE_PATH) -I$(VULKAN_SDK_PATH)/include -I$(STB_INCLUDE_PATH) -I$(TINYOBJ_INCLUDE_PATH) -g
LDFLAGS = -L$(VULKAN_SDK_PATH)/lib `pkg-config --static --libs glfw3` -lvulkan
ODIR=build
DEPDIR := build
DEPFLAGS = -o $@ -MMD -MP -MF $(DEPDIR)/$*.d
SRCS = $(shell find littleVulkanEngine -type f -name "*.cpp")
coreSources = $(shell find littleVulkanEngine/core -type f -name "*.cpp")
coreObjFiles = $(patsubst %.cpp, $(ODIR)/%.o, $(coreSources))
generateSources = $(shell find littleVulkanEngine/generate -type f -name "*.cpp")
generateObjFiles = $(patsubst %.cpp, $(ODIR)/%.o, $(generateSources))
experimentalSources = $(shell find littleVulkanEngine/experimental -type f -name "*.cpp")
experimentalObjFiles = $(patsubst %.cpp, $(ODIR)/%.o, $(experimentalSources))
vertSources = $(shell find shaders -type f -name "*.vert")
vertObjFiles = $(patsubst %.vert, %.vert.spv, $(vertSources))
fragSources = $(shell find shaders -type f -name "*.frag")
fragObjFiles = $(patsubst %.frag, %.frag.spv, $(fragSources))
TARGET = a.out
$(TARGET): $(vertObjFiles) $(fragObjFiles)
${TARGET}: $(coreObjFiles)
${TARGET}: $(generateObjFiles)
${TARGET}: $(experimentalObjFiles)
g++ $(CFLAGS) -o ${TARGET} $(coreObjFiles) $(generateObjFiles) $(experimentalObjFiles) $(LDFLAGS)
$(DEPDIR): ; @mkdir -p $@
DEPFILES := $(SRCS:%.cpp=$(DEPDIR)/%.d)
COMPILE.c = g++ $(DEPFLAGS) $(CFLAGS) -c
$(ODIR)/%.o : %.cpp $(DEPDIR)/%.d | $(DEPDIR)
g++ $(DEPFLAGS) $(CFLAGS) -c $<
libs: $(TARGET)
ar rvs lvecore.a $(coreObjFiles)
ar rvs lvegenerate.a $(generateObjFiles)
$(DEPFILES):
include $(wildcard $(DEPFILES))
# make shader targets
%.vert.spv: %.vert
${GLSLC} $< -o $@
%.frag.spv: %.frag
${GLSLC} $< -o $@
.PHONY: test clean
test: ${TARGET}
LD_LIBRARY_PATH=$(VULKAN_SDK_PATH)/lib VK_LAYER_PATH=$(VULKAN_SDK_PATH)/etc/vulkan/explicit_layer.d ./${TARGET}
clean:
rm -f ${TARGET}
find build -name '*.o' -delete
find build -name '*.d' -delete