This allows to define in lib-common/*.def.in files symbols with I386
stdcall @<num> suffixes and therefore have one common def file for all
platforms.

Removal of @<num> suffixes is done by following sed regex:

    sed -E 's/^([^ ]+)@[0-9]+( |$)/\1\2/'

Note that dollar character in Makefile is duplicated to prevent treating it
as variable in Makefile.

This regex was checked on following test cases:

    Test@4
    Test1@4 ; comment
    Test2@4 == Test22
    Test3@4 @8
    Test@4@8
    Test@5test@8
    @Test6@8

The result is:

    Test
    Test1 ; comment
    Test2 == Test22
    Test3 @8
    Test@4
    Test@5test
    @Test6

That regex handles comments, ordinal numbers and also leading @ chars which
are part of the symbols.
---
 mingw-w64-crt/Makefile.am | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/mingw-w64-crt/Makefile.am b/mingw-w64-crt/Makefile.am
index d90201d35f16..1c53e10809c5 100644
--- a/mingw-w64-crt/Makefile.am
+++ b/mingw-w64-crt/Makefile.am
@@ -4287,13 +4287,13 @@ lib32/%.def: lib-common/%.def.in
        $(MKDIR_P) $(@D) && $(CPP) -x c $< -Wp,-w -undef -P 
-I$(top_srcdir)/def-include -DDEF_I386 > $@
 
 lib64/%.def: lib-common/%.def.in
-       $(MKDIR_P) $(@D) && $(CPP) -x c $< -Wp,-w -undef -P 
-I$(top_srcdir)/def-include -DDEF_X64 > $@
+       $(MKDIR_P) $(@D) && $(CPP) -x c $< -Wp,-w -undef -P 
-I$(top_srcdir)/def-include -DDEF_X64 | sed -E 's/^([^ ]+)@[0-9]+( |$$)/\1\2/' 
> $@
 
 libarm32/%.def: lib-common/%.def.in
-       $(MKDIR_P) $(@D) && $(CPP) -x c $< -Wp,-w -undef -P 
-I$(top_srcdir)/def-include -DDEF_ARM32 > $@
+       $(MKDIR_P) $(@D) && $(CPP) -x c $< -Wp,-w -undef -P 
-I$(top_srcdir)/def-include -DDEF_ARM32 | sed -E 's/^([^ ]+)@[0-9]+( 
|$$)/\1\2/' > $@
 
 libarm64/%.def: lib-common/%.def.in
-       $(MKDIR_P) $(@D) && $(CPP) -x c $< -Wp,-w -undef -P 
-I$(top_srcdir)/def-include -DDEF_ARM64 > $@
+       $(MKDIR_P) $(@D) && $(CPP) -x c $< -Wp,-w -undef -P 
-I$(top_srcdir)/def-include -DDEF_ARM64 | sed -E 's/^([^ ]+)@[0-9]+( 
|$$)/\1\2/' > $@
 
 # Don't compile these, but install as is:
 #
-- 
2.20.1



_______________________________________________
Mingw-w64-public mailing list
Mingw-w64-public@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public

Reply via email to