forked from libretro/RetroArch
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
69 lines (50 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
64
65
66
67
68
69
GLSLC = glslc
GSH_COMPILER = ./compiler.exe
GSH_COMPILER_V = -v
GSH_COMPILER_P = -p
GSH_COMPILER_O = -o
GSH_COMPILER_ALIGN = -align
SLANG_DIR = slang-shaders
BLACKLIST :=
BLACKLIST += $(SLANG_DIR)/dithering/shaders/bayer-matrix-dithering.slang
BLACKLIST += $(SLANG_DIR)/test/decode-format.slang
BLACKLIST += $(SLANG_DIR)/test/format.slang
BLACKLIST += $(SLANG_DIR)/blurs/blur5x5-gamma-encode-every-fbo.slang
BLACKLIST += $(SLANG_DIR)/blurs/blur12x12shared.slang
BLACKLIST += $(SLANG_DIR)/ntsc/shaders/ntsc-xot.slang
BLACKLIST += $(SLANG_DIR)/retro/shaders/bandlimit-pixel.slang
BLACKLIST += $(wildcard $(SLANG_DIR)/vhs/shaders/gristleVHS/*.slang)
BLACKLIST += $(wildcard $(SLANG_DIR)/anti-aliasing/shaders/smaa/*.slang)
BLACKLIST += $(wildcard $(SLANG_DIR)/procedural/*.slang)
EXE_EXT :=
ifneq ($(findstring Linux,$(shell uname -a)),)
else ifneq ($(findstring Darwin,$(shell uname -a)),)
else
EXE_EXT := .exe
endif
SLANG_PARSER = ./slang-parse$(EXE_EXT)
rwildcard=$(foreach d,$(wildcard $1*),$(call rwildcard,$d/,$2) $(filter $(subst *,%,$2),$d))
SLANG_SHADERS := $(call rwildcard,$(SLANG_DIR)/,*.slang)
SLANG_SHADERS := $(filter-out $(BLACKLIST),$(SLANG_SHADERS))
SLANG_SHADERS := $(SLANG_SHADERS:.slang=.gsh)
all: $(SLANG_SHADERS)
parser: $(SLANG_PARSER)
$(SLANG_PARSER): slang-parse.cpp
$(CXX) $< -o $@ -g -O0 -Wall -I../../deps/peglib
shaders: $(SLANG_SHADERS)
%.ppslang : %.slang
$(GLSLC) -E $< -o $@
%.vert %.frag: %.ppslang $(SLANG_PARSER) grammar.txt
$(SLANG_PARSER) --slang $< --vsh $*.vert --psh $*.frag
%.gsh: %.vert %.frag
$(GSH_COMPILER) $(GSH_COMPILER_ALIGN) $(GSH_COMPILER_V) $*.vert $(GSH_COMPILER_P) $*.frag $(GSH_COMPILER_O) $@
.PRECIOUS: %.vert %.frag %.ppslang
clean-shaders:
rm -rf $(SLANG_SHADERS)
clean-temp:
rm -rf $(SLANG_SHADERS:.gsh=.ppslang)
rm -rf $(SLANG_SHADERS:.gsh=.vert)
rm -rf $(SLANG_SHADERS:.gsh=.frag)
clean-parser:
rm -rf $(SLANG_PARSER) slang-parse.o
clean: clean-parser clean-shaders clean-temp