crt: Add a framework for sharing def files with arch specific differences Signed-off-by: Martin Storsjö <martin@martin.st>
diff --git a/mingw-w64-crt/Makefile.am b/mingw-w64-crt/Makefile.am index 990e883..4e3dfc9 100644 --- a/mingw-w64-crt/Makefile.am +++ b/mingw-w64-crt/Makefile.am
@@ -1244,6 +1244,15 @@ %.def: %.def.in $(MKDIR_P) $(@D) && $(CPP) -x c $< -Wp,-w -undef -P -I$(top_srcdir)/def-include > $@ +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 > $@ + +libarm32/%.def: lib-common/%.def.in + $(MKDIR_P) $(@D) && $(CPP) -x c $< -Wp,-w -undef -P -I$(top_srcdir)/def-include -DDEF_ARM32 > $@ + # Don't compile these, but install as is: # libsrcdir=$(includedir) @@ -1277,6 +1286,7 @@ $(top_srcdir)/lib32/*.mri \ $(top_srcdir)/lib64/*.mri \ $(top_srcdir)/libarm32/*.mri \ + $(top_srcdir)/lib-common/*.def.in \ $(top_srcdir)/lib32/*.def.in \ $(top_srcdir)/lib64/*.def.in \ $(top_srcdir)/libarm32/*.def.in \
diff --git a/mingw-w64-crt/Makefile.in b/mingw-w64-crt/Makefile.in index 2e69775..590f23f 100644 --- a/mingw-w64-crt/Makefile.in +++ b/mingw-w64-crt/Makefile.in
@@ -6980,8 +6980,9 @@ $(top_srcdir)/lib-common/*.def $(top_srcdir)/lib32/*.def \ $(top_srcdir)/lib64/*.def $(top_srcdir)/libarm32/*.def \ $(top_srcdir)/lib32/*.mri $(top_srcdir)/lib64/*.mri \ - $(top_srcdir)/libarm32/*.mri $(top_srcdir)/lib32/*.def.in \ - $(top_srcdir)/lib64/*.def.in $(top_srcdir)/libarm32/*.def.in \ + $(top_srcdir)/libarm32/*.mri $(top_srcdir)/lib-common/*.def.in \ + $(top_srcdir)/lib32/*.def.in $(top_srcdir)/lib64/*.def.in \ + $(top_srcdir)/libarm32/*.def.in \ $(top_srcdir)/def-include/*.def.in crt/binmode.c \ crt/crtbegin.c crt/crtdll.c crt/crtend.c crt/crtexe.c \ crt/CRT_fp8.c crt/CRT_fp10.c crt/CRT_glob.c crt/CRT_noglob.c \ @@ -49240,6 +49241,15 @@ %.def: %.def.in $(MKDIR_P) $(@D) && $(CPP) -x c $< -Wp,-w -undef -P -I$(top_srcdir)/def-include > $@ +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 > $@ + +libarm32/%.def: lib-common/%.def.in + $(MKDIR_P) $(@D) && $(CPP) -x c $< -Wp,-w -undef -P -I$(top_srcdir)/def-include -DDEF_ARM32 > $@ + dist-hook: find $(top_distdir) -name ".svn" -delete
diff --git a/mingw-w64-crt/def-include/func.def.in b/mingw-w64-crt/def-include/func.def.in new file mode 100644 index 0000000..382cfd3 --- /dev/null +++ b/mingw-w64-crt/def-include/func.def.in
@@ -0,0 +1,42 @@ +// F64 - function available on all 64 bit architectures +// F_X86_ANY - function available on i386 and x86_64 +// F_I386 - function available only on i386 +// F_X64 - function available only on x86_64 +// F_ARM32 - function available only on arm32 +// F_ARM_ANY - function available on 32 and 64 bit arm +// F_NON_I386 - function available on everything but i386 +#if defined(DEF_X64) +#define F64(x) x +#define F_X64(x) x +#define F_X86_ANY(x) x +#define F_NON_I386(x) x +#elif defined(DEF_I386) +#define F_I386(x) x +#define F_X86_ANY(x) x +#elif defined(DEF_ARM32) +#define F_ARM32(x) x +#define F_ARM_ANY(x) x +#define F_NON_I386(x) x +#endif + +#ifndef F64 +#define F64(x) +#endif +#ifndef F_X86_ANY +#define F_X86_ANY(x) +#endif +#ifndef F_I386 +#define F_I386(x) +#endif +#ifndef F_X64 +#define F_X64(x) +#endif +#ifndef F_ARM_ANY +#define F_ARM_ANY(x) +#endif +#ifndef F_ARM32 +#define F_ARM32(x) +#endif +#ifndef F_NON_I386 +#define F_NON_I386(x) +#endif