-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
81 lines (59 loc) · 1.64 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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
CC = gcc
GLC = glslc
CFLAGS = -Wall -Wno-missing-braces -Wno-attributes -fPIC
LDFLAGS = -L/opt/hfs18.0/dsolib -L/$(HOME)/lib
INFLAGS = -I$(HOME)/dev
LIBS = -lm -ltanto -lvulkan -lxcb -lxcb-keysyms -lfreetype
GLFLAGS = --target-env=vulkan1.2
BIN = bin
LIB = $(HOME)/lib
LIBNAME = shaderboy
O = build
GLSL = shaders
SPV = shaders/spv
NAME = shaderboy
DEPS = \
game.h \
render.h \
shaderboy.h \
common.h \
shaders/common.glsl
OBJS = \
$(O)/game.o \
$(O)/render.o \
$(O)/shaderboy.o \
SHADERS = $(SPV)/post-frag.spv \
$(SPV)/color-frag.spv
debug: CFLAGS += -g -DVERBOSE=1
debug: all
release: CFLAGS += -DNDEBUG -O3
release: all
all: bin lib tags shaders tanto
FRAGS := $(patsubst %.frag,$(SPV)/%-frag.spv,$(notdir $(wildcard $(GLSL)/*.frag)))
VERTS := $(patsubst %.vert,$(SPV)/%-vert.spv,$(notdir $(wildcard $(GLSL)/*.vert)))
shaders: $(FRAGS) $(VERTS)
clean:
rm -f $(O)/* $(LIB)/$(LIBNAME) $(BIN)/* $(SPV)/*
tags:
ctags -R .
bin: main.c $(OBJS) $(DEPS) shaders
$(CC) $(CFLAGS) $(INFLAGS) $(LDFLAGS) $(OBJS) $< -o $(BIN)/$(NAME) $(LIBS)
lib: $(OBJS) $(DEPS) shaders
$(CC) -shared -o $(LIB)/lib$(LIBNAME).so $(OBJS)
.PHONY: tanto clean
tanto:
cd tanto ; make ; cd ..
staticlib: $(OBJS) $(DEPS) shaders
ar rcs $(LIB)/lib$(NAME).a $(OBJS)
$(O)/%.o: %.c $(DEPS)
$(CC) $(CFLAGS) $(INFLAGS) -c $< -o $@
$(SPV)/%-vert.spv: $(GLSL)/%.vert $(DEPS)
$(GLC) $(GLFLAGS) $< -o $@
$(SPV)/%-frag.spv: $(GLSL)/%.frag $(DEPS)
$(GLC) $(GLFLAGS) $< -o $@
$(SPV)/%-rchit.spv: $(GLSL)/%.rchit
$(GLC) $(GLFLAGS) $< -o $@
$(SPV)/%-rgen.spv: $(GLSL)/%.rgen
$(GLC) $(GLFLAGS) $< -o $@
$(SPV)/%-rmiss.spv: $(GLSL)/%.rmiss
$(GLC) $(GLFLAGS) $< -o $@