Compare commits

..

No commits in common. "66a5e7db200a6a0e4c7dbbb341d6c0c729b13d7a" and "c89ea61fa395a68cc8e6d86f684904c5af387596" have entirely different histories.

5 changed files with 22 additions and 22 deletions

3
.vscode/tasks.json vendored
View File

@ -57,11 +57,10 @@
}, },
{ {
"label": "Run", "label": "Run",
"detail": "Build executable and run.", "detail": "Run executable",
"type": "shell", "type": "shell",
"command": "make", "command": "make",
"args": [ "args": [
"-j$(nproc)",
"run" "run"
], ],
"group": "build", "group": "build",

View File

@ -4,13 +4,13 @@ SHELL = /usr/bin/env bash
BUILD_DIR = build BUILD_DIR = build
# Source output target name # Source output target name
SOURCE_OUTPUT := $(BUILD_DIR)/2D_Engine SOURCE_OUTPUT := 2D_Engine
# Core output target name # Core output target name
CORE_OUTPUT := $(BUILD_DIR)/libcore.a CORE_OUTPUT := libcore.a
# Assets output # Assets output
ASSET_OUTPUT := $(BUILD_DIR)/game.data ASSET_OUTPUT := game.data
# Verbosity # Verbosity
Q := @ Q := @
@ -44,4 +44,4 @@ clean:
# Run executable # Run executable
.PHONY: run .PHONY: run
run: all run: all
$(Q)./$(SOURCE_OUTPUT) $(Q)./$(BUILD_DIR)/$(SOURCE_OUTPUT)

View File

@ -6,17 +6,18 @@ ASSETS := $(ASSETS:%=$(ASSETS_DIR)/%)
ASSET_BUILDER_DIR = $(ASSETS_DIR)/asset_builder/src ASSET_BUILDER_DIR = $(ASSETS_DIR)/asset_builder/src
ASSET_BUILDER_OUTPUT = $(BUILD_DIR)/$(ASSETS_DIR)/asset_builder/asset_builder ASSET_BUILDER_OUTPUT = asset_builder
build_assets: setup_asset build_asset_builder asset_end build_assets: setup_asset asset_end
include $(ASSET_BUILDER_DIR)/Makefile include $(ASSET_BUILDER_DIR)/Makefile
setup_asset: setup_asset:
@echo "Building $(notdir $(ASSET_OUTPUT))" @echo "Building $(ASSET_OUTPUT)"
$(Q)mkdir -p $(dir $(ASSETS))
$(ASSET_OUTPUT): $(ASSET_BUILDER_OUTPUT) $(BUILD_DIR)/$(ASSET_OUTPUT): build_asset_builder
$(Q)$^ $@ $(ASSETS) $(Q)$(BUILD_DIR)/$(ASSET_BUILDER_DIR)/$(ASSET_BUILDER_OUTPUT) $@ $(ASSETS)
asset_end: $(ASSET_OUTPUT) asset_end: $(BUILD_DIR)/$(ASSET_OUTPUT)
@echo "Built target $(notdir $(ASSET_OUTPUT))" @echo "Built target $(ASSET_OUTPUT)"

View File

@ -29,7 +29,7 @@ build_asset_builder: asset_builder_setup count_asset_builder_build asset_builder
# Source build directories # Source build directories
asset_builder_setup: asset_builder_setup:
@echo "Building $(notdir $(ASSET_BUILDER_OUTPUT))" @echo "Building Asset Builder"
$(Q)mkdir -p $(dir $(ASSET_BUILDER_OBJECTS)) $(Q)mkdir -p $(dir $(ASSET_BUILDER_OBJECTS))
# Count nb of files to build # Count nb of files to build
@ -37,7 +37,7 @@ count_asset_builder_build:
$(eval export TOTAL_ASSET_BUILDER_FILES := $(shell echo $$(($$(make -n $(ASSET_BUILDER_OBJECTS) 2>/dev/null | grep -c "Building") + 1)))) $(eval export TOTAL_ASSET_BUILDER_FILES := $(shell echo $$(($$(make -n $(ASSET_BUILDER_OBJECTS) 2>/dev/null | grep -c "Building") + 1))))
# Link asset builder target # Link asset builder target
$(ASSET_BUILDER_OUTPUT): $(ASSET_BUILDER_OBJECTS) $(BUILD_DIR)/$(ASSET_BUILDER_DIR)/$(ASSET_BUILDER_OUTPUT): $(ASSET_BUILDER_OBJECTS)
@echo -e "[100%] $(YELLOW)Linking $(ASSET_BUILDER_OUTPUT)$(RESET)" @echo -e "[100%] $(YELLOW)Linking $(ASSET_BUILDER_OUTPUT)$(RESET)"
$(Q)$(SRC_CC) $(ASSET_BUILDER_OBJECTS) -o $@ $(ASSET_BUILDER_LDFLAGS) $(Q)$(SRC_CC) $(ASSET_BUILDER_OBJECTS) -o $@ $(ASSET_BUILDER_LDFLAGS)
@ -49,8 +49,8 @@ $(BUILD_DIR)/$(ASSET_BUILDER_DIR)/%.o: $(ASSET_BUILDER_DIR)/%.c
$(Q)$(SRC_CC) $(SRC_CFLAGS) $(ASSET_BUILDER_INCLUDE_DIRS:%=-I%) -MMD -MP -c $< -o $@ $(Q)$(SRC_CC) $(SRC_CFLAGS) $(ASSET_BUILDER_INCLUDE_DIRS:%=-I%) -MMD -MP -c $< -o $@
# Print ending message # Print ending message
asset_builder_end: $(ASSET_BUILDER_OUTPUT) asset_builder_end: $(BUILD_DIR)/$(ASSET_BUILDER_DIR)/$(ASSET_BUILDER_OUTPUT)
@echo "Built target $(notdir $(ASSET_BUILDER_OUTPUT))" @echo "Built target $(ASSET_BUILDER_OUTPUT)"
# Source files dependencies # Source files dependencies
-include $(ASSET_BUILDER_OBJECTS:.o=.d) -include $(ASSET_BUILDER_OBJECTS:.o=.d)

View File

@ -34,7 +34,7 @@ build_src: src_setup count_src_build src_end
# Source build directories # Source build directories
src_setup: src_setup:
@echo "Building $(notdir $(SOURCE_OUTPUT))" @echo "Building Source"
$(Q)mkdir -p $(dir $(SOURCE_OBJECTS)) $(Q)mkdir -p $(dir $(SOURCE_OBJECTS))
# Count nb of files to build # Count nb of files to build
@ -42,9 +42,9 @@ count_src_build:
$(eval export TOTAL_SRC_FILES := $(shell echo $$(($$(make -n $(SOURCE_OBJECTS) 2>/dev/null | grep -c "Building") + 1)))) $(eval export TOTAL_SRC_FILES := $(shell echo $$(($$(make -n $(SOURCE_OBJECTS) 2>/dev/null | grep -c "Building") + 1))))
# Link game target # Link game target
$(SOURCE_OUTPUT): $(SOURCE_OBJECTS) $(CORE_OUTPUT) $(BUILD_DIR)/$(SOURCE_OUTPUT): $(SOURCE_OBJECTS) $(BUILD_DIR)/$(CORE_OUTPUT)
@echo -e "[100%] $(YELLOW)Linking $(SOURCE_OUTPUT)$(RESET)" @echo -e "[100%] $(YELLOW)Linking $(SOURCE_OUTPUT)$(RESET)"
$(Q)$(SRC_CC) $(SOURCE_OBJECTS) -L./$(BUILD_DIR) $(CORE_OUTPUT) $(CORE_DEPS_FLAGS) -o $@ $(SRC_LDFLAGS) $(Q)$(SRC_CC) $(SOURCE_OBJECTS) -L./$(BUILD_DIR) $(BUILD_DIR)/$(CORE_OUTPUT) $(CORE_DEPS_FLAGS) -o $@ $(SRC_LDFLAGS)
# Build .o files # Build .o files
$(BUILD_DIR)/$(SOURCE_DIR)/%.o: $(SOURCE_DIR)/%.c $(BUILD_DIR)/$(SOURCE_DIR)/%.o: $(SOURCE_DIR)/%.c
@ -54,8 +54,8 @@ $(BUILD_DIR)/$(SOURCE_DIR)/%.o: $(SOURCE_DIR)/%.c
$(Q)$(SRC_CC) $(SRC_CFLAGS) $(SRC_INCLUDE_DIRS:%=-I%) -MMD -MP -c $< -o $@ $(Q)$(SRC_CC) $(SRC_CFLAGS) $(SRC_INCLUDE_DIRS:%=-I%) -MMD -MP -c $< -o $@
# Print ending message # Print ending message
src_end: $(SOURCE_OUTPUT) src_end: $(BUILD_DIR)/$(SOURCE_OUTPUT)
@echo "Built target $(notdir $(SOURCE_OUTPUT))" @echo "Built target $(SOURCE_OUTPUT)"
# Source files dependencies # Source files dependencies
-include $(SOURCE_OBJECTS:.o=.d) -include $(SOURCE_OBJECTS:.o=.d)