makefile 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. #
  2. # Copyright 2011-2018 Branimir Karadzic. All rights reserved.
  3. # License: https://github.com/bkaradzic/bgfx#license-bsd-2-clause
  4. #
  5. THISDIR:=$(dir $(lastword $(MAKEFILE_LIST)))
  6. include $(THISDIR)/../scripts/tools.mk
  7. SHADER_TMP = $(TEMP)/tmp
  8. BIN = vs_debugfont.bin.h \
  9. fs_debugfont.bin.h \
  10. vs_clear.bin.h \
  11. fs_clear0.bin.h \
  12. fs_clear1.bin.h \
  13. fs_clear2.bin.h \
  14. fs_clear3.bin.h \
  15. fs_clear4.bin.h \
  16. fs_clear5.bin.h \
  17. fs_clear6.bin.h \
  18. fs_clear7.bin.h \
  19. .PHONY: all
  20. all: $(BIN)
  21. define shader-embedded
  22. @echo [$(<)]
  23. $(SILENT) $(SHADERC) --type $(1) --platform linux -f $(<) -o $(SHADER_TMP) --bin2c $(basename $(<))_glsl
  24. @cat $(SHADER_TMP) > $(@)
  25. -$(SILENT) $(SHADERC) --type $(1) --platform linux -p spirv -f $(<) -o $(SHADER_TMP) --bin2c $(basename $(<))_spv
  26. -@cat $(SHADER_TMP) >> $(@)
  27. -$(SILENT) $(SHADERC) --type $(1) --platform windows -p $(2) -O 3 -f $(<) -o $(SHADER_TMP) --bin2c $(basename $(<))_dx9
  28. -@cat $(SHADER_TMP) >> $(@)
  29. -$(SILENT) $(SHADERC) --type $(1) --platform windows -p $(3) -O 3 -f $(<) -o $(SHADER_TMP) --bin2c $(basename $(<))_dx11
  30. -@cat $(SHADER_TMP) >> $(@)
  31. -$(SILENT) $(SHADERC) --type $(1) --platform ios -p metal -O 3 -f $(<) -o $(SHADER_TMP) --bin2c $(basename $(<))_mtl
  32. -@cat $(SHADER_TMP) >> $(@)
  33. -@echo extern const uint8_t* $(basename $(<))_pssl;>> $(@)
  34. -@echo extern const uint32_t $(basename $(<))_pssl_size;>> $(@)
  35. endef
  36. vs_debugfont.bin.h : vs_debugfont.sc
  37. $(call shader-embedded, v, vs_3_0, vs_4_0_level_9_1)
  38. fs_debugfont.bin.h : fs_debugfont.sc
  39. $(call shader-embedded, f, ps_3_0, ps_4_0_level_9_1)
  40. vs_clear.bin.h : vs_clear.sc
  41. $(call shader-embedded, v, vs_3_0, vs_4_0_level_9_1)
  42. fs_clear0.bin.h : fs_clear0.sc
  43. $(call shader-embedded, f, ps_3_0, ps_4_0_level_9_1)
  44. fs_clear1.bin.h : fs_clear1.sc
  45. $(call shader-embedded, f, ps_3_0, ps_4_0_level_9_1)
  46. fs_clear2.bin.h : fs_clear2.sc
  47. $(call shader-embedded, f, ps_3_0, ps_4_0_level_9_1)
  48. fs_clear3.bin.h : fs_clear3.sc
  49. $(call shader-embedded, f, ps_3_0, ps_4_0_level_9_1)
  50. fs_clear4.bin.h : fs_clear4.sc
  51. $(call shader-embedded, f, ps_3_0, ps_4_0)
  52. fs_clear5.bin.h : fs_clear5.sc
  53. $(call shader-embedded, f, ps_3_0, ps_4_0)
  54. fs_clear6.bin.h : fs_clear6.sc
  55. $(call shader-embedded, f, ps_3_0, ps_4_0)
  56. fs_clear7.bin.h : fs_clear7.sc
  57. $(call shader-embedded, f, ps_3_0, ps_4_0)
  58. .PHONY: clean
  59. clean:
  60. @echo Cleaning...
  61. @-rm -vf $(BIN)
  62. .PHONY: rebuild
  63. rebuild: clean all