bgfx/src/makefile
kingscallop 17c9300afd
Allow shaders to be compiled on msys2 (#2539)
Adds support on tools.mk for the msys2 environment. The OS is still
considered windows but the command line tools for mkdir and rmdir
behave as if on linux.

The variable SHADER_TMP on the makefiles also had to be quoted to make
it work on msys2.
2021-06-12 11:36:54 -07:00

84 lines
2.5 KiB
Makefile

#
# Copyright 2011-2021 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 -p 120 -f $(<) -o "$(SHADER_TMP)" --bin2c $(basename $(<))_glsl
@cat "$(SHADER_TMP)" > $(@)
-$(SILENT) $(SHADERC) --type $(1) --platform android -f $(<) -o "$(SHADER_TMP)" --bin2c $(basename $(<))_essl
-@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)" >> $(@)
-@printf "extern const uint8_t* $(basename $(<))_pssl;\n" | tr -d '\015' >> $(@)
-@printf "extern const uint32_t $(basename $(<))_pssl_size;\n" | tr -d '\015' >> $(@)
endef
vs_debugfont.bin.h : vs_debugfont.sc
$(call shader-embedded, v, vs_3_0, vs_4_0)
fs_debugfont.bin.h : fs_debugfont.sc
$(call shader-embedded, f, ps_3_0, ps_4_0)
vs_clear.bin.h : vs_clear.sc
$(call shader-embedded, v, vs_3_0, vs_4_0)
fs_clear0.bin.h : fs_clear0.sc
$(call shader-embedded, f, ps_3_0, ps_4_0)
fs_clear1.bin.h : fs_clear1.sc
$(call shader-embedded, f, ps_3_0, ps_4_0)
fs_clear2.bin.h : fs_clear2.sc
$(call shader-embedded, f, ps_3_0, ps_4_0)
fs_clear3.bin.h : fs_clear3.sc
$(call shader-embedded, f, ps_3_0, ps_4_0)
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