Hi, here're 2 patches focused on cleaning up mingw-w64-crt/Makefile.am.
From 5295d3cbae4d4cfdb31a0e030b7c0ba967fcc397 Mon Sep 17 00:00:00 2001
From: Zhongteng Gui <[email protected]>
Date: Thu, 3 Sep 2026 00:39:13 +0800
Subject: [PATCH 1/2] crt: Rename dxerr.c to dxerr.def.h
This follows crt/complex. Accordingly changes dxerr{8,9}{,w}.c and
Makefile.am.
Signed-off-by: Zhongteng Gui <[email protected]>
---
mingw-w64-crt/Makefile.am | 10 +++-------
mingw-w64-crt/libsrc/{dxerr.c => dxerr.def.h} | 14 +++++++-------
mingw-w64-crt/libsrc/dxerr8.c | 2 +-
mingw-w64-crt/libsrc/dxerr8w.c | 2 +-
mingw-w64-crt/libsrc/dxerr9.c | 2 +-
mingw-w64-crt/libsrc/dxerr9w.c | 2 +-
6 files changed, 14 insertions(+), 18 deletions(-)
rename mingw-w64-crt/libsrc/{dxerr.c => dxerr.def.h} (99%)
diff --git a/mingw-w64-crt/Makefile.am b/mingw-w64-crt/Makefile.am
index 12c7d3df4..cb9d8f2c4 100644
--- a/mingw-w64-crt/Makefile.am
+++ b/mingw-w64-crt/Makefile.am
@@ -4,7 +4,6 @@
# Done: 32-bit runtime compatibility
# Done: fix make dist
# TODO: Use $(TAR) instead of tar?
-# TODO: Find a better way to handle dxerr.c -- make it dxerr.h and add to
sources list?
#
#Use AM_MAINTAINER_MODE in configure.ac to disable autoreconf
@@ -100,8 +99,8 @@ src_libshell32=libsrc/shell32.c
src_libdinput=libsrc/dinput_kbd.c libsrc/dinput_joy.c libsrc/dinput_joy2.c
libsrc/dinput_mouse.c libsrc/dinput_mouse2.c
src_libdinput8=libsrc/dinput_private.h libsrc/dinput_joy.c
libsrc/dinput_joy2.c libsrc/dinput_mouse.c libsrc/dinput_mouse2.c
libsrc/dinput_kbd.c
src_libdmoguids=libsrc/dmoguids.c
-src_libdxerr8=libsrc/dxerr8.c libsrc/dxerr8w.c
-src_libdxerr9=libsrc/dxerr9.c libsrc/dxerr9w.c
+src_libdxerr8=libsrc/dxerr8.c libsrc/dxerr8w.c libsrc/dxerr.def.h
+src_libdxerr9=libsrc/dxerr9.c libsrc/dxerr9w.c libsrc/dxerr.def.h
src_libmfuuid=libsrc/mfuuid.c
src_libmsxml2=libsrc/msxml2.c
src_libmsxml6=libsrc/msxml6.c
@@ -1470,7 +1469,6 @@ lib32/%.o: crt/%.c
#
temp= \
-dxerr.c \
test.c
lib32_LIBRARIES = lib32/libkernel32.a
@@ -2261,7 +2259,6 @@ libarm32/%.o: crt/%.c
#
temp= \
-dxerr.c \
test.c
libarm32_LIBRARIES = libarm32/libkernel32.a
@@ -2579,7 +2576,6 @@ libarm64/%.x86_64.o: %.S
#
temp= \
-dxerr.c \
test.c
libarm64_LIBRARIES = libarm64/libkernel32.a
@@ -4552,7 +4548,7 @@ dist_libsrc_DATA = \
# Installation options
#
-noinst_HEADERS = libsrc/dxerr.c \
+noinst_HEADERS = \
include/internal.h include/sect_attribs.h
diff --git a/mingw-w64-crt/libsrc/dxerr.c b/mingw-w64-crt/libsrc/dxerr.def.h
similarity index 99%
rename from mingw-w64-crt/libsrc/dxerr.c
rename to mingw-w64-crt/libsrc/dxerr.def.h
index a328bcf1d..1e4025106 100644
--- a/mingw-w64-crt/libsrc/dxerr.c
+++ b/mingw-w64-crt/libsrc/dxerr.def.h
@@ -1,6 +1,6 @@
/*
- dxerr.c - DirectX 8 & 9 Error Functions
+ dxerr.def.h - DirectX 8 & 9 Error Functions
Written by Filip Navara <[email protected]>
@@ -723,7 +723,7 @@ HRESULT __stdcall DXTrace(char *strFile, DWORD dwLine,
HRESULT hr,
#if 0
const TCHAR *ErrorName = DXGetErrorString9(hr);
TCHAR *DebugMessage;
-
+
DebugMessage = (TCHAR *)malloc((strlen(strFile) + (strMsg ?
_tcslen(strMsg) : 0) + _tcslen(ErrorName) + 48) * sizeof(TCHAR));
if (DebugMessage == 0)
return hr;
@@ -738,10 +738,10 @@ HRESULT __stdcall DXTrace(char *strFile, DWORD dwLine,
HRESULT hr,
DebugMessage = (TCHAR *)malloc((strlen(strFile) + (strMsg ?
_tcslen(strMsg) : 0) + _tcslen(ErrorName) + 60) * sizeof(TCHAR));
if (DebugMessage == 0)
return DXERROR_NOT_ENOUGH_MEMORY;
- wsprintf(DebugMessage,
+ wsprintf(DebugMessage,
TEXT("File: %hs\nLine: %Lu\nError Code: %s(0x%Lx)\nCalling:
%s\n"
"Do you want to debug the application?"), strFile, dwLine,
- ErrorName, hr, (strMsg ? strMsg : TEXT("")));
+ ErrorName, hr, (strMsg ? strMsg : TEXT("")));
Result = MessageBox(0, DebugMessage, TEXT("Unexpected error
encountred"), MB_YESNO | MB_ICONDXERROR);
if (Result == 0)
return hr;
@@ -756,16 +756,16 @@ HRESULT __stdcall DXTrace(char *strFile, DWORD dwLine,
HRESULT hr,
#else
const TCHAR *ErrorName = DXGetErrorString(hr);
TCHAR DebugMessage[4096];
-
+
wsprintf(DebugMessage, TEXT("%hs(%Lu): %s (hr=%s(0x%Lx))"), strFile,
dwLine, (strMsg ? strMsg : TEXT("")), ErrorName, hr);
OutputDebugString(DebugMessage);
if (bPopMsgBox)
{
int Result;
- wsprintf(DebugMessage,
+ wsprintf(DebugMessage,
TEXT("File: %hs\nLine: %Lu\nError Code: %s(0x%Lx)\nCalling:
%s\n"
"Do you want to debug the application?"), strFile, dwLine,
- ErrorName, hr, (strMsg ? strMsg : TEXT("")));
+ ErrorName, hr, (strMsg ? strMsg : TEXT("")));
Result = MessageBox(0, DebugMessage, TEXT("Unexpected error
encountred"), MB_YESNO | MB_ICONERROR);
if (Result == IDYES)
DebugBreak();
diff --git a/mingw-w64-crt/libsrc/dxerr8.c b/mingw-w64-crt/libsrc/dxerr8.c
index 6794e32d8..7ccbdc385 100644
--- a/mingw-w64-crt/libsrc/dxerr8.c
+++ b/mingw-w64-crt/libsrc/dxerr8.c
@@ -15,4 +15,4 @@
#define DXTrace DXTraceA
#define DXERROR8(v,n,d) {v, n, d},
#define DXERROR8LAST(v,n,d) {v, n, d}
-#include "dxerr.c"
+#include "dxerr.def.h"
diff --git a/mingw-w64-crt/libsrc/dxerr8w.c b/mingw-w64-crt/libsrc/dxerr8w.c
index 207bd884b..e4b0aac3e 100644
--- a/mingw-w64-crt/libsrc/dxerr8w.c
+++ b/mingw-w64-crt/libsrc/dxerr8w.c
@@ -17,5 +17,5 @@
#define DXTrace DXTraceW
#define DXERROR8(v,n,d) {v, L##n, L##d},
#define DXERROR8LAST(v,n,d) {v, L##n, L##d}
-#include "dxerr.c"
+#include "dxerr.def.h"
diff --git a/mingw-w64-crt/libsrc/dxerr9.c b/mingw-w64-crt/libsrc/dxerr9.c
index af2d859e0..c8cc30f8c 100644
--- a/mingw-w64-crt/libsrc/dxerr9.c
+++ b/mingw-w64-crt/libsrc/dxerr9.c
@@ -15,4 +15,4 @@
#define DXTrace DXTraceA
#define DXERROR9(v,n,d) {v, n, d},
#define DXERROR9LAST(v,n,d) {v, n, d}
-#include "dxerr.c"
+#include "dxerr.def.h"
diff --git a/mingw-w64-crt/libsrc/dxerr9w.c b/mingw-w64-crt/libsrc/dxerr9w.c
index 9556598a0..8cdebc017 100644
--- a/mingw-w64-crt/libsrc/dxerr9w.c
+++ b/mingw-w64-crt/libsrc/dxerr9w.c
@@ -17,5 +17,5 @@
#define DXTrace DXTraceW
#define DXERROR9(v,n,d) {v, L##n, L##d},
#define DXERROR9LAST(v,n,d) {v, L##n, L##d}
-#include "dxerr.c"
+#include "dxerr.def.h"
--
2.55.0.windows.5
From 79c5c76a7268361ecec0c355ba05c125a70fad72 Mon Sep 17 00:00:00 2001
From: Zhongteng Gui <[email protected]>
Date: Thu, 3 Sep 2026 00:47:58 +0800
Subject: [PATCH 2/2] crt: Remove unused file and variable
lib32/test.c is never used. test.c doesn't exist (note that this isn't
lib32/test.c), and temp is never used. Both $(TAR) and tar are not used.
Signed-off-by: Zhongteng Gui <[email protected]>
---
mingw-w64-crt/Makefile.am | 22 ----------------------
mingw-w64-crt/lib32/test.c | 12 ------------
2 files changed, 34 deletions(-)
delete mode 100644 mingw-w64-crt/lib32/test.c
diff --git a/mingw-w64-crt/Makefile.am b/mingw-w64-crt/Makefile.am
index cb9d8f2c4..e45016bb3 100644
--- a/mingw-w64-crt/Makefile.am
+++ b/mingw-w64-crt/Makefile.am
@@ -3,7 +3,6 @@
# Done: Turn _libm_dummy.c into a BUILT_SOURCES thing
# Done: 32-bit runtime compatibility
# Done: fix make dist
-# TODO: Use $(TAR) instead of tar?
#
#Use AM_MAINTAINER_MODE in configure.ac to disable autoreconf
@@ -1464,13 +1463,6 @@ lib32/gcrt2.o: lib32/gcrt0.o
lib32/%.o: crt/%.c
$(AM_V_CC)$(COMPILE) $(CPPFLAGS32) -c $< -o $@
-# These source files aren't compiled in to any library yet. I'm not sure how
/ where to do so.
-# The source files that I did compile somewhere I just guessed at anyway.
-#
-
-temp= \
-test.c
-
lib32_LIBRARIES = lib32/libkernel32.a
lib32_libkernel32_a_SOURCES = $(src_intrincs) $(src_intrincs32)
lib32_libkernel32_a_AR = $(DTLIB32) && $(AR) $(ARFLAGS)
@@ -2254,13 +2246,6 @@ libarm32/gcrt2.o: libarm32/gcrt0.o
libarm32/%.o: crt/%.c
$(AM_V_CC)$(COMPILE) $(CPPFLAGSARM32) -c $< -o $@
-# These source files aren't compiled in to any library yet. I'm not sure how
/ where to do so.
-# The source files that I did compile somewhere I just guessed at anyway.
-#
-
-temp= \
-test.c
-
libarm32_LIBRARIES = libarm32/libkernel32.a
libarm32_libkernel32_a_SOURCES = $(src_intrincs) $(src_intrincsarm32)
lib-common/kernel32.def.in
libarm32_libkernel32_a_AR = $(DTDEFARM32) libarm32/kernel32.def && $(AR)
$(ARFLAGS)
@@ -2571,13 +2556,6 @@ libarm64/%.o: crt/%.c
libarm64/%.x86_64.o: %.S
$(AM_V_CC)$(MKDIR_P) $(@D) && $(CC) $(COMMON_CFLAGS) $(CPPFLAGSARM64)
-target x86_64-windows-gnu -c $< -o $@
-# These source files aren't compiled in to any library yet. I'm not sure how
/ where to do so.
-# The source files that I did compile somewhere I just guessed at anyway.
-#
-
-temp= \
-test.c
-
libarm64_LIBRARIES = libarm64/libkernel32.a
libarm64_libkernel32_a_SOURCES = $(src_intrincs) $(src_intrincsarm64)
lib-common/kernel32.def.in
libarm64_libkernel32_a_CPPFLAGS=$(CPPFLAGSARM64) $(extra_include)
diff --git a/mingw-w64-crt/lib32/test.c b/mingw-w64-crt/lib32/test.c
deleted file mode 100644
index 950e5631e..000000000
--- a/mingw-w64-crt/lib32/test.c
+++ /dev/null
@@ -1,12 +0,0 @@
-/* Perform simple test of headers to avoid typos and such */
-#include <windows.h>
-#include <d3d9.h>
-#include <d3d9caps.h>
-#include <d3d9types.h>
-#include <dxerr8.h>
-#include <dxerr9.h>
-
-int main()
-{
- return 0;
-}
--
2.55.0.windows.5
_______________________________________________
Mingw-w64-public mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public