Changed Makefile structure and assets are compressed correctly now.
This commit is contained in:
parent
888c800111
commit
d3ce988aaf
2
Makefile
2
Makefile
|
|
@ -25,7 +25,7 @@ all: build_core build_src compress_assets
|
||||||
|
|
||||||
# Sub Makefiles
|
# Sub Makefiles
|
||||||
SOURCE_DIR = src
|
SOURCE_DIR = src
|
||||||
CORE_DIR = core
|
CORE_DIR = core/src
|
||||||
ASSETS_DIR = assets
|
ASSETS_DIR = assets
|
||||||
|
|
||||||
include $(CORE_DIR)/Makefile
|
include $(CORE_DIR)/Makefile
|
||||||
|
|
|
||||||
|
|
@ -1,43 +1,27 @@
|
||||||
# Assets files
|
# Assets files
|
||||||
ASSETS := \
|
ASSETS := \
|
||||||
assets/tileset/tileset.png \
|
tileset/tileset.png \
|
||||||
assets/player_sheets/player_idle_sheet.png \
|
player_sheets/player_idle_sheet.png \
|
||||||
assets/player_sheets/player_run_sheet.png \
|
player_sheets/player_run_sheet.png \
|
||||||
assets/player_sheets/player_death_sheet.png \
|
player_sheets/player_death_sheet.png \
|
||||||
assets/enemy_sheets/enemy_idle_sheet.png \
|
enemy_sheets/enemy_idle_sheet.png \
|
||||||
assets/enemy_sheets/enemy_run_sheet.png \
|
enemy_sheets/enemy_run_sheet.png \
|
||||||
assets/enemy_sheets/enemy_death_sheet.png \
|
enemy_sheets/enemy_death_sheet.png \
|
||||||
assets/maps/map_test.json
|
maps/map_test.json
|
||||||
|
|
||||||
# Deduce assets lz4
|
|
||||||
ASSETS_COMPRESSED = $(ASSETS:%=$(BUILD_DIR)/%.lz4)
|
|
||||||
|
|
||||||
# Current file nb to process
|
|
||||||
CURRENT_ASSET_FILE := 0
|
|
||||||
|
|
||||||
# Build asset target
|
# Build asset target
|
||||||
compress_assets: asset_setup count_assets_compress $(BUILD_DIR)/$(ASSET_OUTPUT) assets_end
|
compress_assets: asset_setup $(BUILD_DIR)/$(ASSET_OUTPUT) assets_end
|
||||||
|
|
||||||
# Asset compressing message
|
# Asset compressing message
|
||||||
asset_setup:
|
asset_setup:
|
||||||
@echo "Compressing Assets (3/3)"
|
@echo "Compressing Assets (3/3)"
|
||||||
$(Q)mkdir -p $(dir $(ASSETS_COMPRESSED))
|
$(Q)mkdir -p $(BUILD_DIR)/$(ASSETS_DIR)
|
||||||
|
|
||||||
# Count nb of assets to compress
|
|
||||||
count_assets_compress:
|
|
||||||
$(eval export TOTAL_ASSETS_FILES := $(shell echo $$(($$(make -n $(ASSETS_COMPRESSED) 2>/dev/null | grep -c "Compressing") + 1))))
|
|
||||||
|
|
||||||
# Compress assets into tar file
|
# Compress assets into tar file
|
||||||
$(BUILD_DIR)/$(ASSET_OUTPUT): $(ASSETS_COMPRESSED)
|
$(BUILD_DIR)/$(ASSET_OUTPUT): $(ASSETS:%=$(ASSETS_DIR)/%)
|
||||||
@echo -e "[100%] $(YELLOW)Compressing $(ASSET_OUTPUT)$(RESET)"
|
@echo -e "[100%] $(YELLOW)Compressing $(ASSET_OUTPUT)$(RESET)"
|
||||||
$(Q)tar -cf $@ $(ASSETS_COMPRESSED)
|
$(Q)tar -cf $(BUILD_DIR)/$(ASSETS_DIR)/assets.tar $^
|
||||||
|
$(Q)lz4 --favor-decSpeed -fqtz $(BUILD_DIR)/$(ASSETS_DIR)/assets.tar $@
|
||||||
# Compress individual assets
|
|
||||||
$(BUILD_DIR)/%.lz4: %
|
|
||||||
$(eval CURRENT_ASSET_FILE := $(shell echo $$(($(CURRENT_ASSET_FILE) + 1))))
|
|
||||||
$(eval PERCENTAGE := $(shell echo $$(($(CURRENT_ASSET_FILE) * 100 / $(TOTAL_ASSETS_FILES)))))
|
|
||||||
@echo -e "[$(PERCENTAGE)%] $(GREEN)Compressing asset $@$(RESET)"
|
|
||||||
$(Q)lz4 --favor-decSpeed -fqtz $< $@
|
|
||||||
|
|
||||||
# Print ending message
|
# Print ending message
|
||||||
assets_end: $(BUILD_DIR)/$(SOURCE_OUTPUT)
|
assets_end: $(BUILD_DIR)/$(SOURCE_OUTPUT)
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue