From 999507a72ee94764d9adf5bd14e132569362c981 Mon Sep 17 00:00:00 2001 From: Alvin Young Date: Mon, 8 Dec 2025 15:40:47 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0=20Makefile?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 更新Windows的兼容性 --- Makefile | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/Makefile b/Makefile index c959e05..8cfbe91 100644 --- a/Makefile +++ b/Makefile @@ -2,7 +2,7 @@ # user config values CC="/usr/bin/gcc" # CC="E:\\impressionyang\\scoop\\apps\\mingw\\12.2.0\\bin\\gcc.exe" -PROJECT=test +PROJECT=lazy_make_test BUILD_DIR=build # check operating system type @@ -65,19 +65,27 @@ INC_DIRS := $(wordlist 1, $(words $(INC_DIRS)), $(INC_DIRS)) # compile job all : +ifeq ($(OS_TYPE), WINDOWS) + mkdir $(BUILD_DIR) 2>nul || ver > nul +endif +ifeq ($(OS_TYPE), LINUX) mkdir -p $(BUILD_DIR) +endif +ifeq ($(OS_TYPE), OSX) + mkdir -p $(BUILD_DIR) +endif $(CC) $(CFLAGS) $(SOURCES) $(HEADERS) $(INC_DIRS) -o $(BUILD_DIR)/$(PROJECT) # virtual clean job .PHONY : clean clean: ifeq ($(OS_TYPE), WINDOWS) - del $(BUILD_DIR)/$(PROJECT).exe + rmdir /S /Q $(BUILD_DIR) endif ifeq ($(OS_TYPE), LINUX) - rm $(BUILD_DIR)/$(PROJECT) + rm -rf ./$(BUILD_DIR) endif ifeq ($(OS_TYPE), OSX) - rm $(BUILD_DIR)/$(PROJECT) + rm -rf ./$(BUILD_DIR) endif