Building is functionnal for all.
This commit is contained in:
parent
6c2034cecc
commit
314cca6434
5
Makefile
5
Makefile
|
|
@ -7,7 +7,7 @@ BUILD_DIR = build
|
|||
SOURCE_OUTPUT := 2D_Engine
|
||||
|
||||
# Assets output
|
||||
ASSETS_OUTPUT := game.data
|
||||
ASSET_OUTPUT := game.data
|
||||
|
||||
# Verbosity
|
||||
Q := @
|
||||
|
|
@ -21,8 +21,7 @@ YELLOW := \033[33m
|
|||
RESET := \033[m
|
||||
|
||||
# Default targets
|
||||
#all: build_core build_src compress_assets
|
||||
all: build_core build_src
|
||||
all: build_core build_src compress_assets
|
||||
|
||||
# Sub Makefiles
|
||||
SOURCE_DIR = src
|
||||
|
|
|
|||
|
|
@ -12,14 +12,33 @@ ASSETS := \
|
|||
# Deduce assets lz4
|
||||
ASSETS_COMPRESSED = $(ASSETS:%=$(BUILD_DIR)/%.lz4)
|
||||
|
||||
# Current file nb to process
|
||||
CURRENT_ASSET_FILE := 0
|
||||
|
||||
# Build asset target
|
||||
compress_assets: asset_setup count_assets_compress $(BUILD_DIR)/$(ASSET_OUTPUT) assets_end
|
||||
|
||||
# Asset compressing message
|
||||
asset_setup:
|
||||
@echo "Compressing Assets (3/3)"
|
||||
$(Q)mkdir -p $(dir $(ASSETS_COMPRESSED))
|
||||
|
||||
# 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
|
||||
$(BUILD_DIR)/$(ASSETS_OUTPUT): $(ASSETS_COMPRESSED)
|
||||
@echo "[100%] $(YELLOW)Compressing $(ASSETS_OUTPUT)$(RESET)"
|
||||
$(Q)tar -cvf $@ $()
|
||||
$(BUILD_DIR)/$(ASSET_OUTPUT): $(ASSETS_COMPRESSED)
|
||||
@echo -e "[100%] $(YELLOW)Compressing $(ASSET_OUTPUT)$(RESET)"
|
||||
$(Q)tar -cf $@ $(ASSETS_COMPRESSED)
|
||||
|
||||
# Compress individual assets
|
||||
$(BUILD_DIR)/%.lz4: %
|
||||
$(eval CURRENT_FILE := $(shell echo $$(($(CURRENT_FILE) + 1))))
|
||||
$(eval PERCENTAGE := $(shell echo $$(($(CURRENT_FILE) * 100 / $(TOTAL_FILES)))))
|
||||
@echo "[$(PERCENTAGE)%] $(GREEN)Compressing asset $@$(RESET)"
|
||||
$(Q)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
|
||||
assets_end: $(BUILD_DIR)/$(SOURCE_OUTPUT)
|
||||
@echo "Compressed target $(ASSET_OUTPUT)"
|
||||
|
|
|
|||
|
|
@ -23,12 +23,12 @@ CURRENT_SRC_FILE := 0
|
|||
# Build src target
|
||||
build_src: src_setup count_src_build $(BUILD_DIR)/$(SOURCE_OUTPUT) src_end
|
||||
|
||||
# Source build directories and
|
||||
# Source build directories
|
||||
src_setup:
|
||||
@echo "Building Source (2/3)"
|
||||
$(Q)mkdir -p $(dir $(SOURCE_OBJECTS))
|
||||
|
||||
# Count
|
||||
# Count nb of files to build
|
||||
count_src_build:
|
||||
$(eval export TOTAL_SRC_FILES := $(shell echo $$(($$(make -n $(SOURCE_OBJECTS) 2>/dev/null | grep -c "Building") + 1))))
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue