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.
This commit is contained in:
James R 2021-05-04 22:34:20 -07:00
parent 8840bef2cb
commit 3d7205d494
3 changed files with 14 additions and 9 deletions

View file

@ -315,7 +315,7 @@ WINDRES:=$(WINDRES) $(WINDRESFLAGS)\
$(debug_opts) --include-dir=win32 -O coff $(debug_opts) --include-dir=win32 -O coff
%/ : %/ :
$(.)$(mkdir) $@ $(.)$(mkdir) $(call Windows_path,$@)
# this is needed so the target can be referenced in the # this is needed so the target can be referenced in the
# prerequisites # prerequisites
@ -385,14 +385,16 @@ $(eval $(call _recipe,o,nas,$(NASM) -o $$@ $$<))
$(eval $(call _recipe,o,s,$(CC) $(ASFLAGS) -c -o $$@ $$<)) $(eval $(call _recipe,o,s,$(CC) $(ASFLAGS) -c -o $$@ $$<))
$(eval $(call _recipe,res,rc,$(WINDRES) -i $$< -o $$@)) $(eval $(call _recipe,res,rc,$(WINDRES) -i $$< -o $$@))
_rm=$(.)$(rmrf) $(call Windows_path,$(1))
cleandep : cleandep :
$(.)$(rmrf) $(depends) comptime.h $(call _rm,$(depends) comptime.h)
clean : clean :
$(.)$(rmrf) $(exe) $(dbg) $(dbg).txt $(objects) $(call _rm,$(exe) $(dbg) $(dbg).txt $(objects))
distclean : distclean :
$(.)$(rmrf) ../bin ../objs ../deps comptime.h $(call _rm,../bin ../objs ../deps comptime.h)
info: info:
ifdef WINDOWSHELL ifdef WINDOWSHELL

View file

@ -5,11 +5,11 @@
PKG_CONFIG?=pkg-config PKG_CONFIG?=pkg-config
ifdef WINDOWSHELL ifdef WINDOWSHELL
rmrf?=DEL /S /Q rmrf=2>NUL DEL /S /Q
mkdir?=MD mkdir=-2>NUL MD
else else
rmrf?=rm -rf rmrf=rm -rf
mkdir?=mkdir -p mkdir=mkdir -p
endif endif
ifdef LINUX64 ifdef LINUX64

View file

@ -12,6 +12,9 @@ Wildvar=$(foreach v,$(filter $(1),$(.VARIABLES)),$($(v)))
# directory of the file. # directory of the file.
List=$(addprefix $(dir $(1)),$(file < $(1))) List=$(addprefix $(dir $(1)),$(file < $(1)))
# Convert path separators to backslash on Windows.
Windows_path=$(if $(WINDOWSHELL),$(subst /,\,$(1)),$(1))
define Propogate_flags = define Propogate_flags =
opts+=$$($(1)_CFLAGS) opts+=$$($(1)_CFLAGS)
libs+=$$($(1)_LDFLAGS) libs+=$$($(1)_LDFLAGS)
@ -73,7 +76,7 @@ Echo_name=
Print= Print=
ifndef SILENT ifndef SILENT
Echo=@echo "$(1)" Echo=@echo $(1)
ifndef ECHO ifndef ECHO
ifndef NOECHOFILENAMES ifndef NOECHOFILENAMES
Echo_name=$(call Echo,-- $(1) ...) Echo_name=$(call Echo,-- $(1) ...)