From 1801dcc99985566de4c74721543661a80a78cdc8 Mon Sep 17 00:00:00 2001 From: Dominik Riebeling Date: Wed, 21 Oct 2020 19:12:08 +0200 Subject: [PATCH] rbutil: Fix native Windows build for tools. - When make on Windows finds sh.exe it will try to use that. We use cmd.exe calls when detecting Windows, so make sure we use cmd.exe as shell. - Add missing Windows compatibility to tomcrypt Makefile. Change-Id: Iaef133ca27472a5ddf449174d540983f15c66aea --- rbutil/libtools.make | 1 + tools/rbspeex/Makefile | 1 + tools/ucl/src/Makefile | 1 + utils/tomcrypt/Makefile | 13 +++++++++++-- 4 files changed, 14 insertions(+), 2 deletions(-) diff --git a/rbutil/libtools.make b/rbutil/libtools.make index dadc1a0545..7f9fa15f5b 100644 --- a/rbutil/libtools.make +++ b/rbutil/libtools.make @@ -22,6 +22,7 @@ endif # Get directory this Makefile is in for relative paths. TOP := $(dir $(lastword $(MAKEFILE_LIST))) ifeq ($(OS),Windows_NT) +SHELL = cmd.exe mkdir = if not exist $(subst /,\,$(1)) mkdir $(subst /,\,$(1)) rm = if exist $(subst /,\,$(1)) del /q /s $(subst /,\,$(1)) else diff --git a/tools/rbspeex/Makefile b/tools/rbspeex/Makefile index b33534695c..03f88f34cd 100644 --- a/tools/rbspeex/Makefile +++ b/tools/rbspeex/Makefile @@ -12,6 +12,7 @@ SILENT = @ endif ifeq ($(OS),Windows_NT) +SHELL = cmd.exe mkdir = if not exist $(subst /,\,$(1)) mkdir $(subst /,\,$(1)) rm = if exist $(subst /,\,$(1)) del /q /s $(subst /,\,$(1)) else diff --git a/tools/ucl/src/Makefile b/tools/ucl/src/Makefile index 14ba2c2b04..7fffe59a7b 100644 --- a/tools/ucl/src/Makefile +++ b/tools/ucl/src/Makefile @@ -13,6 +13,7 @@ SILENT = @ endif ifeq ($(OS),Windows_NT) +SHELL = cmd.exe mkdir = if not exist $(subst /,\,$(1)) mkdir $(subst /,\,$(1)) else mkdir = mkdir -p $(1) diff --git a/utils/tomcrypt/Makefile b/utils/tomcrypt/Makefile index 4ca8c4e843..3382819a66 100644 --- a/utils/tomcrypt/Makefile +++ b/utils/tomcrypt/Makefile @@ -13,6 +13,15 @@ ifndef V SILENT := @ endif +ifeq ($(OS),Windows_NT) +SHELL = cmd.exe +mkdir = if not exist $(subst /,\,$(1)) mkdir $(subst /,\,$(1)) +rm = if exist $(subst /,\,$(1)) del /q /s $(subst /,\,$(1)) +else +mkdir = mkdir -p $(1) +rm = rm -rf $(1) +endif + CFLAGS := -O3 -g -std=c99 -Wall $(DEFINES) -Isrc/headers LDFLAGS := @@ -38,8 +47,8 @@ $(LIB): $(OBJS) $(BUILD_DIR)/%.o: %.c $(info CC $(notdir $@)) - $(SILENT)mkdir -p $(dir $@) + $(SILENT)$(call mkdir, $(dir $@)) $(SILENT)$(CROSS)$(CC) $(CFLAGS) -c -o $@ $< clean: - rm -fr $(BUILDDIR) $(LIB) + $(call rm,$(BUILDDIR) $(LIB))