mirror of https://github.com/bkaradzic/bgfx
Fixed shader makefile to work on *nix.
This commit is contained in:
parent
c29dc6de31
commit
d247365d80
|
@ -4,3 +4,4 @@
|
||||||
*.sh eol=lf
|
*.sh eol=lf
|
||||||
*.md eol=lf
|
*.md eol=lf
|
||||||
*.lua eol=lf
|
*.lua eol=lf
|
||||||
|
*.mk eol=lf
|
||||||
|
|
|
@ -1,96 +1,102 @@
|
||||||
#
|
#
|
||||||
# Copyright 2011-2013 Branimir Karadzic. All rights reserved.
|
# Copyright 2011-2013 Branimir Karadzic. All rights reserved.
|
||||||
# License: http://www.opensource.org/licenses/BSD-2-Clause
|
# License: http://www.opensource.org/licenses/BSD-2-Clause
|
||||||
#
|
#
|
||||||
|
|
||||||
ifndef TARGET
|
ifndef TARGET
|
||||||
.PHONY: all
|
.PHONY: all
|
||||||
all:;@echo Usage: make TARGET=# [clean]
|
all:;@echo Usage: make TARGET=# [clean]
|
||||||
@echo TARGET=0 (hlsl - dx9)
|
@echo TARGET=0 (hlsl - dx9)
|
||||||
@echo TARGET=1 (hlsl - dx11)
|
@echo TARGET=1 (hlsl - dx11)
|
||||||
@echo TARGET=2 (glsl - nacl)
|
@echo TARGET=2 (glsl - nacl)
|
||||||
@echo TARGET=3 (glsl - android)
|
@echo TARGET=3 (glsl - android)
|
||||||
@echo TARGET=4 (glsl - linux)
|
@echo TARGET=4 (glsl - linux)
|
||||||
else
|
else
|
||||||
SHADERC="$(BGFX_DIR)/tools/bin/shaderc"
|
SHADERC="$(BGFX_DIR)/tools/bin/shaderc"
|
||||||
|
|
||||||
ifeq ($(TARGET), 0)
|
ifeq ($(TARGET), 0)
|
||||||
VS_FLAGS=--platform windows -p vs_3_0 -O 3
|
VS_FLAGS=--platform windows -p vs_3_0 -O 3
|
||||||
FS_FLAGS=--platform windows -p ps_3_0 -O 3
|
FS_FLAGS=--platform windows -p ps_3_0 -O 3
|
||||||
SHADER_PATH=shaders/dx9
|
SHADER_PATH=shaders/dx9
|
||||||
else
|
else
|
||||||
ifeq ($(TARGET), 1)
|
ifeq ($(TARGET), 1)
|
||||||
VS_FLAGS=--platform windows -p vs_4_0 -O 3
|
VS_FLAGS=--platform windows -p vs_4_0 -O 3
|
||||||
FS_FLAGS=--platform windows -p ps_4_0 -O 3
|
FS_FLAGS=--platform windows -p ps_4_0 -O 3
|
||||||
SHADER_PATH=shaders/dx11
|
SHADER_PATH=shaders/dx11
|
||||||
else
|
else
|
||||||
ifeq ($(TARGET), 2)
|
ifeq ($(TARGET), 2)
|
||||||
VS_FLAGS=--platform nacl
|
VS_FLAGS=--platform nacl
|
||||||
FS_FLAGS=--platform nacl
|
FS_FLAGS=--platform nacl
|
||||||
SHADER_PATH=shaders/gles
|
SHADER_PATH=shaders/gles
|
||||||
else
|
else
|
||||||
ifeq ($(TARGET), 3)
|
ifeq ($(TARGET), 3)
|
||||||
VS_FLAGS=--platform android
|
VS_FLAGS=--platform android
|
||||||
FS_FLAGS=--platform android
|
FS_FLAGS=--platform android
|
||||||
SHADER_PATH=shaders/gles
|
SHADER_PATH=shaders/gles
|
||||||
else
|
else
|
||||||
ifeq ($(TARGET), 4)
|
ifeq ($(TARGET), 4)
|
||||||
VS_FLAGS=--platform linux -p 120
|
VS_FLAGS=--platform linux -p 120
|
||||||
FS_FLAGS=--platform linux -p 120
|
FS_FLAGS=--platform linux -p 120
|
||||||
SHADER_PATH=shaders/glsl
|
SHADER_PATH=shaders/glsl
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
|
|
||||||
BUILD_OUTPUT_DIR=$(addprefix ./, $(RUNTIME_DIR)/$(SHADER_PATH))
|
BUILD_OUTPUT_DIR=$(addprefix ./, $(RUNTIME_DIR)/$(SHADER_PATH))
|
||||||
BUILD_INTERMEDIATE_DIR=$(addprefix $(BUILD_DIR)/, $(SHADER_PATH))
|
BUILD_INTERMEDIATE_DIR=$(addprefix $(BUILD_DIR)/, $(SHADER_PATH))
|
||||||
|
|
||||||
VS_SOURCES=$(wildcard vs_*.sc)
|
VS_SOURCES=$(wildcard vs_*.sc)
|
||||||
VS_DEPS=$(addprefix $(BUILD_INTERMEDIATE_DIR)/,$(addsuffix .bin.d, $(basename $(VS_SOURCES))))
|
VS_DEPS=$(addprefix $(BUILD_INTERMEDIATE_DIR)/,$(addsuffix .bin.d, $(basename $(VS_SOURCES))))
|
||||||
|
|
||||||
FS_SOURCES=$(wildcard fs_*.sc)
|
FS_SOURCES=$(wildcard fs_*.sc)
|
||||||
FS_DEPS=$(addprefix $(BUILD_INTERMEDIATE_DIR)/,$(addsuffix .bin.d, $(basename $(FS_SOURCES))))
|
FS_DEPS=$(addprefix $(BUILD_INTERMEDIATE_DIR)/,$(addsuffix .bin.d, $(basename $(FS_SOURCES))))
|
||||||
|
|
||||||
CMD_MKDIR=cmd /C "if not exist "$(subst /,\,$(1))" mkdir "$(subst /,\,$(1))""
|
UNAME := $(shell uname)
|
||||||
CMD_RMDIR=cmd /C "if exist "$(subst /,\,$(1))" rmdir /S /Q "$(subst /,\,$(1))""
|
ifeq ($(UNAME),$(filter $(UNAME),Linux Darwin))
|
||||||
|
CMD_MKDIR=mkdir -p "$(1)"
|
||||||
VS_BIN = $(addprefix $(BUILD_INTERMEDIATE_DIR)/, $(addsuffix .bin, $(basename $(VS_SOURCES))))
|
CMD_RMDIR=rm -r "$(1)"
|
||||||
FS_BIN = $(addprefix $(BUILD_INTERMEDIATE_DIR)/, $(addsuffix .bin, $(basename $(FS_SOURCES))))
|
else
|
||||||
|
CMD_MKDIR=cmd /C "if not exist "$(subst /,\,$(1))" mkdir "$(subst /,\,$(1))""
|
||||||
BIN = $(VS_BIN) $(FS_BIN)
|
CMD_RMDIR=cmd /C "if exist "$(subst /,\,$(1))" rmdir /S /Q "$(subst /,\,$(1))""
|
||||||
ASM = $(VS_ASM) $(FS_ASM)
|
endif
|
||||||
|
|
||||||
$(BUILD_INTERMEDIATE_DIR)/vs_%.bin : vs_%.sc
|
VS_BIN = $(addprefix $(BUILD_INTERMEDIATE_DIR)/, $(addsuffix .bin, $(basename $(VS_SOURCES))))
|
||||||
@echo [$(<)]
|
FS_BIN = $(addprefix $(BUILD_INTERMEDIATE_DIR)/, $(addsuffix .bin, $(basename $(FS_SOURCES))))
|
||||||
@$(SHADERC) $(VS_FLAGS) --type vertex --depends -o $(@) -f $(<) --disasm
|
|
||||||
@cp $(@) $(BUILD_OUTPUT_DIR)/$(@F)
|
BIN = $(VS_BIN) $(FS_BIN)
|
||||||
|
ASM = $(VS_ASM) $(FS_ASM)
|
||||||
$(BUILD_INTERMEDIATE_DIR)/fs_%.bin : fs_%.sc
|
|
||||||
@echo [$(<)]
|
$(BUILD_INTERMEDIATE_DIR)/vs_%.bin : vs_%.sc
|
||||||
@$(SHADERC) $(FS_FLAGS) --type fragment --depends -o $(@) -f $(<) --disasm
|
@echo [$(<)]
|
||||||
@cp $(@) $(BUILD_OUTPUT_DIR)/$(@F)
|
@$(SHADERC) $(VS_FLAGS) --type vertex --depends -o $(@) -f $(<) --disasm
|
||||||
|
@cp $(@) $(BUILD_OUTPUT_DIR)/$(@F)
|
||||||
.PHONY: all
|
|
||||||
all: dirs $(BIN)
|
$(BUILD_INTERMEDIATE_DIR)/fs_%.bin : fs_%.sc
|
||||||
@echo Target $(SHADER_PATH)
|
@echo [$(<)]
|
||||||
|
@$(SHADERC) $(FS_FLAGS) --type fragment --depends -o $(@) -f $(<) --disasm
|
||||||
.PHONY: clean
|
@cp $(@) $(BUILD_OUTPUT_DIR)/$(@F)
|
||||||
clean:
|
|
||||||
@echo Cleaning...
|
.PHONY: all
|
||||||
@-rm -vf $(BIN)
|
all: dirs $(BIN)
|
||||||
@-$(call CMD_RMDIR,$(BUILD_INTERMEDIATE_DIR))
|
@echo Target $(SHADER_PATH)
|
||||||
|
|
||||||
.PHONY: dirs
|
.PHONY: clean
|
||||||
dirs:
|
clean:
|
||||||
@-$(call CMD_MKDIR,$(BUILD_INTERMEDIATE_DIR))
|
@echo Cleaning...
|
||||||
@-$(call CMD_MKDIR,$(BUILD_OUTPUT_DIR))
|
@-rm -vf $(BIN)
|
||||||
|
@-$(call CMD_RMDIR,$(BUILD_INTERMEDIATE_DIR))
|
||||||
.PHONY: rebuild
|
|
||||||
rebuild: clean all
|
.PHONY: dirs
|
||||||
|
dirs:
|
||||||
endif # TARGET
|
@-$(call CMD_MKDIR,$(BUILD_INTERMEDIATE_DIR))
|
||||||
|
@-$(call CMD_MKDIR,$(BUILD_OUTPUT_DIR))
|
||||||
-include $(VS_DEPS)
|
|
||||||
-include $(FS_DEPS)
|
.PHONY: rebuild
|
||||||
|
rebuild: clean all
|
||||||
|
|
||||||
|
endif # TARGET
|
||||||
|
|
||||||
|
-include $(VS_DEPS)
|
||||||
|
-include $(FS_DEPS)
|
||||||
|
|
Loading…
Reference in New Issue