forked from amethyst/amethyst
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
36 lines (26 loc) · 792 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
# This Makefile is meant for shader compilation only.
# Use cargo to compile the rust part of the project.
GLSLC = $(shell ./find_glslc.sh)
ifeq "$(GLSLC)" ""
break;
endif
define outpath
$(addsuffix .$(1), $(subst /shaders/,/compiled/,$(2)))
endef
SHADERS = $(filter-out /header/,$(wildcard */shaders/**/*.vert */shaders/**/*.frag))
OUT = $(call outpath,spv,$(SHADERS)) $(call outpath,spvasm,$(SHADERS))
all: $(OUT)
%.spv:
mkdir -p $(dir $@)
$(GLSLC) -MD -c -g -O -o $@ $<
%.spvasm:
mkdir -p $(dir $@)
$(GLSLC) -MD -S -g -O -o $@ $<
define shader_rules
$(call outpath,spv,$1): $1
$(call outpath,spvasm,$1) : $1
endef
$(foreach shader,$(SHADERS),$(eval $(call shader_rules,$(shader))))
clean:
$(RM) */compiled/**/*.spv */compiled/**/*.spvdis */compiled/**/*.d
.PHONY: all clean