From 21c39ec6e6e4d3303104bdec5a4d576e755505eb Mon Sep 17 00:00:00 2001 From: Brad Nelson Date: Mon, 4 Jan 2021 20:43:18 -0800 Subject: [PATCH] Make windows build optional. --- ueforth/Makefile | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/ueforth/Makefile b/ueforth/Makefile index 4a976aa..f3b9881 100644 --- a/ueforth/Makefile +++ b/ueforth/Makefile @@ -26,16 +26,30 @@ STRIP_ARGS = -S \ --remove-section=.note.ABI-tag LIBS=-ldl -WIN_ARCH=i686 -#WIN_ARCH=x86_64 WINFLAGS = -mwindows -luser32 +# Default to 32-bit Windows for maximum portability. +ifeq ($(WIN_ARCH),) + WIN_ARCH:=i686 + #WIN_ARCH=x86_64 +endif + TARGETS = $(WEB)/terminal.html \ $(WEB)/ueforth.js \ $(POSIX)/ueforth \ - $(WINDOWS)/uEforth.exe \ $(ARDUINO)/ueforth.ino +# Selectively enable windows if tools available +ifneq (, $(shell which $(WIN_ARCH)-w64-mingw32-windres)) + ifneq (, $(shell which $(WIN_ARCH)-w64-mingw32-gcc)) + TARGETS += $(WINDOWS)/uEforth.exe + else + $(warning "Missing $(WIN_ARCH)-w64-mingw32-gcc skipping Windows.") + endif +else + $(warning "Missing $(WIN_ARCH)-w64-mingw32-windres skipping Windows.") +endif + all: $(TARGETS) tests clean: