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
%/ :
$(.)$(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

View file

@ -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

View file

@ -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) ...)