SDL: watcom: add ENABLE_WERROR option to makefiles

From be5f55c47e0ce8bf0f6f6dc95269b22b93fa7b8a Mon Sep 17 00:00:00 2001
From: Anonymous Maarten <[EMAIL REDACTED]>
Date: Fri, 7 Oct 2022 00:17:25 +0200
Subject: [PATCH] watcom: add ENABLE_WERROR option to makefiles

---
 Makefile.os2      | 5 +++++
 Makefile.w32      | 5 +++++
 test/Makefile.os2 | 5 +++++
 test/Makefile.w32 | 5 +++++
 4 files changed, 20 insertions(+)

diff --git a/Makefile.os2 b/Makefile.os2
index b9096c929590..76b2b398dfe9 100644
--- a/Makefile.os2
+++ b/Makefile.os2
@@ -9,6 +9,8 @@
 # can compile hidapi joystick support against it (experimental)
 # by specifying HIDAPI=1, e.g.:
 # wmake -f Makefile.os2 HIDAPI=1
+#
+# To error out upon warnings: wmake -f Makefile.os2 ENABLE_WERROR=1
 
 LIBNAME = SDL2
 MAJOR_VERSION = 2
@@ -40,6 +42,9 @@ CFLAGS = -bt=os2 -d0 -q -bm -5s -fp5 -fpi87 -sg -oeatxhn -ei
 
 # max warnings:
 CFLAGS+= -wx
+!ifeq ENABLE_WERROR 1
+CFLAGS+= -we
+!endif
 # newer OpenWatcom versions enable W303 by default
 CFLAGS+= -wcd=303
 # the include paths :
diff --git a/Makefile.w32 b/Makefile.w32
index 22ec0cd92d0f..68c3a3731598 100644
--- a/Makefile.w32
+++ b/Makefile.w32
@@ -1,5 +1,7 @@
 # Open Watcom makefile to build SDL2.dll for Win32
 # wmake -f Makefile.w32
+#
+# To error out upon warnings: wmake -f Makefile.w32 ENABLE_WERROR=1
 
 LIBNAME = SDL2
 MAJOR_VERSION = 2
@@ -26,6 +28,9 @@ LIBS = user32.lib gdi32.lib winmm.lib imm32.lib ole32.lib oleaut32.lib shell32.l
 CFLAGS = -bt=nt -d0 -q -bm -5s -fp5 -fpi87 -sg -oeatxhn -ei
 # max warnings:
 CFLAGS+= -wx
+!ifeq ENABLE_WERROR 1
+CFLAGS+= -we
+!endif
 # newer OpenWatcom versions enable W303 by default
 CFLAGS+= -wcd=303
 # new vulkan headers result in lots of W202 warnings
diff --git a/test/Makefile.os2 b/test/Makefile.os2
index 75aaeedfdf57..ee66409b0c15 100644
--- a/test/Makefile.os2
+++ b/test/Makefile.os2
@@ -1,5 +1,7 @@
 # Open Watcom makefile to build SDL2 tests for OS/2
 # wmake -f Makefile.os2
+#
+# To error out upon warnings: wmake -f Makefile.os2 ENABLE_WERROR=1
 
 SYSTEM = os2v2
 
@@ -7,6 +9,9 @@ INCPATH = -I"$(%WATCOM)/h/os2" -I"$(%WATCOM)/h"
 
 CFLAGS = -bt=os2 -d0 -q -bm -5s -fp5 -fpi87 -sg -oteanbmier -ei
 CFLAGS+= -wx -wcd=303
+!ifeq ENABLE_WERROR 1
+CFLAGS+= -we
+!endif
 
 TNSRCS = testnative.c testnativeos2.c
 
diff --git a/test/Makefile.w32 b/test/Makefile.w32
index 51ca7eafc7da..02e68e865f35 100644
--- a/test/Makefile.w32
+++ b/test/Makefile.w32
@@ -1,5 +1,7 @@
 # Open Watcom makefile to build SDL2 tests for Win32
 # wmake -f Makefile.w32
+#
+# To error out upon warnings: wmake -f Makefile.w32 ENABLE_WERROR=1
 
 SYSTEM = nt
 
@@ -7,6 +9,9 @@ INCPATH = -I"$(%WATCOM)/h/nt" -I"$(%WATCOM)/h" -I"../src/video/khronos"
 
 CFLAGS = -bt=nt -d0 -q -bm -5s -fp5 -fpi87 -sg -oteanbmier -ei
 CFLAGS+= -wx -wcd=303
+!ifeq ENABLE_WERROR 1
+CFLAGS+= -we
+!endif
 CFLAGS+= -DSDL_MAIN_HANDLED
 CFLAGS+= -DHAVE_OPENGL
 GLLIBS = opengl32.lib