From 52b3240549fa2a9ae918bcade65553653f71ba6e Mon Sep 17 00:00:00 2001 From: Ulysse Cura Date: Wed, 9 Sep 2026 15:28:05 +0200 Subject: [PATCH] Fixed makefiles calls. --- Makefile | 15 +++++++++++---- assets/Makefile | 4 +++- configure | 2 +- src/Makefile | 4 +++- 4 files changed, 18 insertions(+), 7 deletions(-) diff --git a/Makefile b/Makefile index b598665..fcc1e54 100644 --- a/Makefile +++ b/Makefile @@ -4,11 +4,13 @@ SHELL = /usr/bin/env bash ROOT := $(realpath $(dir $(lastword $(MAKEFILE_LIST)))) +ifeq ($(filter clean-all,$(MAKECMDGOALS)),) ifneq ($(realpath $(ROOT)/config.mk), $(ROOT)/config.mk) -$(error ERROR: Please run the configure script before building.) +$(error ERROR: Please run the configure script before building) endif include $(ROOT)/config.mk +endif # # User settings @@ -65,14 +67,19 @@ RESET := \033[m # Default targets all: $(OUTPUT) $(ASSET_OUTPUT) -$(OUTPUT): +$(OUTPUT): FORCE $(Q)cd $(SOURCE_DIR) && $(MAKE) $@ -$(ASSET_OUTPUT): +$(ASSET_OUTPUT): FORCE $(Q)cd $(ASSETS_DIR) && $(MAKE) $@ -.PHONY: clean run print-var-% +FORCE: + +.PHONY: clean clean-all run print-var-% clean: + $(Q)rm -rf $(BUILD_DIR) + +clean-all: $(Q)rm -rf $(dir $(BUILD_DIR)) run: all diff --git a/assets/Makefile b/assets/Makefile index cd868c9..ee672ba 100644 --- a/assets/Makefile +++ b/assets/Makefile @@ -26,5 +26,7 @@ $(BUILD_DIR)/$(notdir $(ASSETS_DIR))/%.o: $(ASSETS_DIR)/% $(ASSET_BUILDER_OUTPUT @echo -e "[$(PERCENTAGE)%] $(GREEN)Building ASSET object $@$(RESET)" $(Q)$(ASSET_BUILDER_OUTPUT) $@ -c $< -$(ASSET_BUILDER_OUTPUT): +$(ASSET_BUILDER_OUTPUT): FORCE $(Q)cd $(ASSET_BUILDER_DIR) && $(MAKE) $@ + +FORCE: diff --git a/configure b/configure index 78c084f..c981390 100755 --- a/configure +++ b/configure @@ -69,7 +69,7 @@ done ## Clean if [ -n "${CLEAN}" ]; then - make clean + make clean-all rm -rf ${CONFIG_FILE} fi diff --git a/src/Makefile b/src/Makefile index 153c168..c82f374 100644 --- a/src/Makefile +++ b/src/Makefile @@ -33,7 +33,9 @@ $(BUILD_DIR)/$(notdir $(SOURCE_DIR))/%.o: $(SOURCE_DIR)/% @echo -e "[$(PERCENTAGE)%] $(GREEN)Building C object $@$(RESET)" $(Q)$(TARGET_HOST_CC) $(TARGET_HOST_CFLAGS) $(INCLUDES:%=-I%) -MMD -MP -c $< -o $@ -$(LIBCORE): +$(LIBCORE): FORCE $(Q)cd $(CORE_DIR) && $(MAKE) $@ +FORCE: + -include $(OBJECTS:.o=.d)