From 3d7205d4942d1e1b2627fdf5acf9d9c82437a97b Mon Sep 17 00:00:00 2001 From: James R Date: Tue, 4 May 2021 22:34:20 -0700 Subject: [PATCH] Fix minor errors with Windows ECHO, DEL, MD - Quotes were not removed by ECHO. - DEL would print an error on nonexistent file. - MD would do this plus return a nonzero exit code. --- src/Makefile | 10 ++++++---- src/Makefile.d/platform.mk | 8 ++++---- src/Makefile.d/util.mk | 5 ++++- 3 files changed, 14 insertions(+), 9 deletions(-) diff --git a/src/Makefile b/src/Makefile index 8c31b212d..0c44afe55 100644 --- a/src/Makefile +++ b/src/Makefile @@ -315,7 +315,7 @@ WINDRES:=$(WINDRES) $(WINDRESFLAGS)\ $(debug_opts) --include-dir=win32 -O coff %/ : - $(.)$(mkdir) $@ + $(.)$(mkdir) $(call Windows_path,$@) # this is needed so the target can be referenced in the # prerequisites @@ -385,14 +385,16 @@ $(eval $(call _recipe,o,nas,$(NASM) -o $$@ $$<)) $(eval $(call _recipe,o,s,$(CC) $(ASFLAGS) -c -o $$@ $$<)) $(eval $(call _recipe,res,rc,$(WINDRES) -i $$< -o $$@)) +_rm=$(.)$(rmrf) $(call Windows_path,$(1)) + cleandep : - $(.)$(rmrf) $(depends) comptime.h + $(call _rm,$(depends) comptime.h) clean : - $(.)$(rmrf) $(exe) $(dbg) $(dbg).txt $(objects) + $(call _rm,$(exe) $(dbg) $(dbg).txt $(objects)) distclean : - $(.)$(rmrf) ../bin ../objs ../deps comptime.h + $(call _rm,../bin ../objs ../deps comptime.h) info: ifdef WINDOWSHELL diff --git a/src/Makefile.d/platform.mk b/src/Makefile.d/platform.mk index ca00806d9..4f110594e 100644 --- a/src/Makefile.d/platform.mk +++ b/src/Makefile.d/platform.mk @@ -5,11 +5,11 @@ PKG_CONFIG?=pkg-config ifdef WINDOWSHELL -rmrf?=DEL /S /Q -mkdir?=MD +rmrf=2>NUL DEL /S /Q +mkdir=-2>NUL MD else -rmrf?=rm -rf -mkdir?=mkdir -p +rmrf=rm -rf +mkdir=mkdir -p endif ifdef LINUX64 diff --git a/src/Makefile.d/util.mk b/src/Makefile.d/util.mk index 88f141bee..e76e32422 100644 --- a/src/Makefile.d/util.mk +++ b/src/Makefile.d/util.mk @@ -12,6 +12,9 @@ Wildvar=$(foreach v,$(filter $(1),$(.VARIABLES)),$($(v))) # directory of the file. List=$(addprefix $(dir $(1)),$(file < $(1))) +# Convert path separators to backslash on Windows. +Windows_path=$(if $(WINDOWSHELL),$(subst /,\,$(1)),$(1)) + define Propogate_flags = opts+=$$($(1)_CFLAGS) libs+=$$($(1)_LDFLAGS) @@ -73,7 +76,7 @@ Echo_name= Print= ifndef SILENT -Echo=@echo "$(1)" +Echo=@echo $(1) ifndef ECHO ifndef NOECHOFILENAMES Echo_name=$(call Echo,-- $(1) ...)