-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
62 lines (42 loc) · 1.26 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
all: true_all
BIN?=bin
TARGETS+=$(BIN)/vulkanisch.exe
SRCS:=\
src/common/main.cpp\
src/common/util.cpp\
src/common/vkutil.cpp\
src/common/linalg.cpp\
glad/src/vulkan.c\
CXXFLAGS+=-Wall -Wextra -Werror -std=c++14
CXXFLAGS+=-Isrc
CXXFLAGS+=-Iglad/include
CXXFLAGS+=$(shell pkg-config sdl2 --cflags)
LDFLAGS+=$(shell pkg-config sdl2 --libs)
SHADERS:=
GetMyDir=$(patsubst %/,%,$(dir $(lastword $(MAKEFILE_LIST))))
SUBS=$(wildcard src/*/*.mk)
include $(SUBS)
TARGETS+=$(SHADERS:%.glsl=$(BIN)/%.spv)
true_all: $(TARGETS)
$(BIN)/vulkanisch.exe: $(SRCS:%=$(BIN)/%.o)
#------------------------------------------------------------------------------
# Generic rules
#------------------------------------------------------------------------------
include $(shell test -d $(BIN) && find $(BIN) -name "*.dep")
$(BIN)/%.exe:
@mkdir -p $(dir $@)
$(CXX) -o "$@" $^ $(LDFLAGS)
$(BIN)/%.cpp.o: %.cpp
@mkdir -p $(dir $@)
$(CXX) $(CXXFLAGS) -c -MMD -MT "$@" -MF "[email protected]" -o "$@" $<
$(BIN)/%.c.o: %.c
@mkdir -p $(dir $@)
$(CXX) $(CXXFLAGS) -c -o "$@" $<
$(BIN)/%.vert.spv: %.vert.glsl
@mkdir -p $(dir $@)
glslangValidator -V -o "$@" -S vert "$<" --quiet
$(BIN)/%.frag.spv: %.frag.glsl
@mkdir -p $(dir $@)
glslangValidator -V -o "$@" -S frag "$<" --quiet
clean:
rm -rf $(BIN)