summaryrefslogtreecommitdiffstatshomepage
path: root/3rdparty/bgfx/src/makefile
blob: 18e21ddf0d9d38972f23704f8b1dbdc56b4d6882 (plain) (blame)
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
#
# Copyright 2011-2019 Branimir Karadzic. All rights reserved.
# License: https://github.com/bkaradzic/bgfx#license-bsd-2-clause
#

THISDIR:=$(dir $(lastword $(MAKEFILE_LIST)))
include $(THISDIR)/../scripts/tools.mk

SHADER_TMP = $(TEMP)/tmp

BIN = vs_debugfont.bin.h \
	  fs_debugfont.bin.h \
	  vs_clear.bin.h \
	  fs_clear0.bin.h \
	  fs_clear1.bin.h \
	  fs_clear2.bin.h \
	  fs_clear3.bin.h \
	  fs_clear4.bin.h \
	  fs_clear5.bin.h \
	  fs_clear6.bin.h \
	  fs_clear7.bin.h \

.PHONY: all
all: $(BIN)

define shader-embedded
	@echo [$(<)]
	 $(SILENT) $(SHADERC) --type $(1) --platform linux                 -f $(<) -o $(SHADER_TMP) --bin2c $(basename $(<))_glsl
	 @cat $(SHADER_TMP) > $(@)
	-$(SILENT) $(SHADERC) --type $(1) --platform linux   -p spirv      -f $(<) -o $(SHADER_TMP) --bin2c $(basename $(<))_spv
	-@cat $(SHADER_TMP) >> $(@)
	-$(SILENT) $(SHADERC) --type $(1) --platform windows -p $(2)  -O 3 -f $(<) -o $(SHADER_TMP) --bin2c $(basename $(<))_dx9
	-@cat $(SHADER_TMP) >> $(@)
	-$(SILENT) $(SHADERC) --type $(1) --platform windows -p $(3)  -O 3 -f $(<) -o $(SHADER_TMP) --bin2c $(basename $(<))_dx11
	-@cat $(SHADER_TMP) >> $(@)
	-$(SILENT) $(SHADERC) --type $(1) --platform ios     -p metal -O 3 -f $(<) -o $(SHADER_TMP) --bin2c $(basename $(<))_mtl
	-@cat $(SHADER_TMP) >> $(@)
	-@echo extern const uint8_t* $(basename $(<))_pssl;>> $(@)
	-@echo extern const uint32_t $(basename $(<))_pssl_size;>> $(@)
endef

vs_debugfont.bin.h : vs_debugfont.sc
	$(call shader-embedded, v, vs_3_0, vs_4_0_level_9_1)

fs_debugfont.bin.h : fs_debugfont.sc
	$(call shader-embedded, f, ps_3_0, ps_4_0_level_9_1)

vs_clear.bin.h : vs_clear.sc
	$(call shader-embedded, v, vs_3_0, vs_4_0_level_9_1)

fs_clear0.bin.h : fs_clear0.sc
	$(call shader-embedded, f, ps_3_0, ps_4_0_level_9_1)

fs_clear1.bin.h : fs_clear1.sc
	$(call shader-embedded, f, ps_3_0, ps_4_0_level_9_1)

fs_clear2.bin.h : fs_clear2.sc
	$(call shader-embedded, f, ps_3_0, ps_4_0_level_9_1)

fs_clear3.bin.h : fs_clear3.sc
	$(call shader-embedded, f, ps_3_0, ps_4_0_level_9_1)

fs_clear4.bin.h : fs_clear4.sc
	$(call shader-embedded, f, ps_3_0, ps_4_0)

fs_clear5.bin.h : fs_clear5.sc
	$(call shader-embedded, f, ps_3_0, ps_4_0)

fs_clear6.bin.h : fs_clear6.sc
	$(call shader-embedded, f, ps_3_0, ps_4_0)

fs_clear7.bin.h : fs_clear7.sc
	$(call shader-embedded, f, ps_3_0, ps_4_0)

.PHONY: clean
clean:
	@echo Cleaning...
	@-rm -vf $(BIN)

.PHONY: rebuild
rebuild: clean all