Hacked up mesa/x86/gen_matypes.c so it no longer generates a header file, but

a file suitable for the CreateAsmStructOffsetsHeader rule. The file is then
used to generate the actual matypes.h header. This fixes issues when
cross-compiling from a 64 bit platform.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@34312 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Ingo Weinhold
2009-11-27 14:12:32 +00:00
parent a492466dad
commit dc28a50219
2 changed files with 58 additions and 16 deletions
+16 -7
View File
@@ -41,12 +41,21 @@ UsePublicObjectHeaders gen_matypes : opengl ;
BuildPlatformMain gen_matypes : BuildPlatformMain gen_matypes :
gen_matypes.c ; gen_matypes.c ;
rule MkMaTypes rule MkMaTypes header
{ {
MakeLocateArch $(<) ; header = [ FGristFiles $(header) ] ;
Depends $(<) : gen_matypes ;
MkMaTypes1 $(<) : gen_matypes ; # generate the intermediate header
LocalClean clean : $(<) ; local intermediateHeader = $(header:S=.h.cpp) ;
MakeLocateArch $(intermediateHeader) ;
Depends $(intermediateHeader) : gen_matypes ;
MkMaTypes1 $(intermediateHeader) : gen_matypes ;
LocalClean clean : $(intermediateHeader) ;
# generate the final header
TARGET_HDRS on $(header) = [ on $(header) return $(TARGET_HDRS) ]
$(TARGET_PRIVATE_SYSTEM_HEADERS) ;
CreateAsmStructOffsetsHeader $(header) : $(intermediateHeader) ;
} }
actions MkMaTypes1 actions MkMaTypes1
@@ -78,7 +87,7 @@ actions MkMaTypes1
local arch_sources ; local arch_sources ;
if $(TARGET_ARCH) = x86 { if $(TARGET_ARCH) = x86 {
MkMaTypes <mesa>matypes.h ; MkMaTypes matypes.h ;
arch_sources = arch_sources =
common_x86.c common_x86.c
@@ -109,7 +118,7 @@ if $(TARGET_ARCH) = x86 {
x86sse.c x86sse.c
; ;
Includes [ FGristFiles $(arch_sources) ] : <mesa>matypes.h ; Includes [ FGristFiles $(arch_sources) ] : [ FGristFiles matypes.h ] ;
SEARCH_SOURCE += [ FDirName $(SUBDIR) x86 rtasm ] ; SEARCH_SOURCE += [ FDirName $(SUBDIR) x86 rtasm ] ;
+35 -2
View File
@@ -61,7 +61,12 @@ do { \
printf( "\n" ); \ printf( "\n" ); \
} while (0) } while (0)
#if defined(__BEOS__) || defined(__HAIKU__) || defined(_LP64) #if 1
// Haiku build system: support for cross-compilation
#define OFFSET( s, t, m ) \
printf( "#undef %s\n", s); \
printf( "DEFINE_COMPUTED_ASM_MACRO(%s, offsetof(%s, %s));\n", s, #t, #m );
#elif defined(__BEOS__) || defined(__HAIKU__) || defined(_LP64)
#define OFFSET( s, t, m ) \ #define OFFSET( s, t, m ) \
printf( "#define %s\t%ld\n", s, offsetof( t, m ) ); printf( "#define %s\t%ld\n", s, offsetof( t, m ) );
#else #else
@@ -69,7 +74,12 @@ do { \
printf( "#define %s\t%d\n", s, offsetof( t, m ) ); printf( "#define %s\t%d\n", s, offsetof( t, m ) );
#endif #endif
#if defined(__BEOS__) || defined(__HAIKU__) || defined(_LP64) #if 1
// Haiku build system: support for cross-compilation
#define SIZEOF( s, t ) \
printf( "#undef %s\n", s); \
printf( "DEFINE_COMPUTED_ASM_MACRO(%s, sizeof(%s));\n", s, #t );
#elif defined(__BEOS__) || defined(__HAIKU__) || defined(_LP64)
#define SIZEOF( s, t ) \ #define SIZEOF( s, t ) \
printf( "#define %s\t%ld\n", s, sizeof(t) ); printf( "#define %s\t%ld\n", s, sizeof(t) );
#else #else
@@ -77,8 +87,16 @@ do { \
printf( "#define %s\t%d\n", s, sizeof(t) ); printf( "#define %s\t%d\n", s, sizeof(t) );
#endif #endif
#if 1
// Haiku build system: support for cross-compilation
#define DEFINE( s, d ) \
printf( "#undef %s\n", s); \
printf( "#define %s\t0x%x\n", s, d ); \
printf( "DEFINE_COMPUTED_ASM_MACRO(%s, %#x);\n", s, d );
#else
#define DEFINE( s, d ) \ #define DEFINE( s, d ) \
printf( "#define %s\t0x%x\n", s, d ); printf( "#define %s\t0x%x\n", s, d );
#endif
@@ -93,6 +111,16 @@ int main( int argc, char **argv )
printf( "#define __ASM_TYPES_H__\n" ); printf( "#define __ASM_TYPES_H__\n" );
printf( "\n" ); printf( "\n" );
#if 1
// Haiku build system: support for cross-compilation
printf("#include <computed_asm_macros.h>");
printf( "\n" );
printf( "#include \"main/glheader.h\"\n" );
printf( "#include \"main/mtypes.h\"\n" );
printf( "#include \"tnl/t_context.h\"" );
printf( "\n" );
printf( "void dummy() {\n" );
#endif
/* GLcontext offsets: /* GLcontext offsets:
*/ */
@@ -239,6 +267,11 @@ int main( int argc, char **argv )
OFFSET( "LIGHT_MODEL_TWO_SIDE ", struct gl_lightmodel, TwoSide ); OFFSET( "LIGHT_MODEL_TWO_SIDE ", struct gl_lightmodel, TwoSide );
OFFSET( "LIGHT_MODEL_COLOR_CONTROL ", struct gl_lightmodel, ColorControl ); OFFSET( "LIGHT_MODEL_COLOR_CONTROL ", struct gl_lightmodel, ColorControl );
#if 1
// Haiku build system: support for cross-compilation
printf("}");
printf( "\n" );
#endif
printf( "\n" ); printf( "\n" );
printf( "\n" ); printf( "\n" );