Avoid some code duplication for setting the architecture depending Cc and C++

flags, using a global variable FFMPEG_PLATFORM_DEFINES.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@31431 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Stephan Aßmus 2009-07-06 21:57:08 +00:00
parent a4a0a6665e
commit 7486c08251
4 changed files with 33 additions and 69 deletions

View File

@ -17,32 +17,39 @@ if $(HAIKU_GCC_VERSION[1]) >= 3 {
SubDirCcFlags -fomit-frame-pointer -DPIC ;
}
local defines ;
defines = HAVE_AV_CONFIG_H=1 ;
# NOTE: This is intentionally a global variable, so we can re-use it in
# sub-folders.
FFMPEG_PLATFORM_DEFINES = HAVE_AV_CONFIG_H=1 ;
if $(TARGET_ARCH) = x86 {
defines += ARCH_X86=1 ARCH_X86_32=1 ARCH_PPC=0 ARCH_SPARC=0 ;
defines += HAVE_AMD3DNOW=0 HAVE_AMD3DNOWEXT=0 ;
defines += HAVE_MMX=1 HAVE_MMX2=1 HAVE_SSE=0 HAVE_SSE3=1 ;
defines += HAVE_ALTIVEC=0 ;
defines += HAVE_VIS=0 ;
FFMPEG_PLATFORM_DEFINES += ARCH_X86=1 ARCH_X86_32=1 ;
FFMPEG_PLATFORM_DEFINES += ARCH_PPC=0 ;
FFMPEG_PLATFORM_DEFINES += ARCH_SPARC=0 ;
FFMPEG_PLATFORM_DEFINES += HAVE_AMD3DNOW=0 HAVE_AMD3DNOWEXT=0 ;
FFMPEG_PLATFORM_DEFINES += HAVE_MMX=1 HAVE_MMX2=1 HAVE_SSE=0 HAVE_SSE3=1 ;
FFMPEG_PLATFORM_DEFINES += HAVE_ALTIVEC=0 ;
FFMPEG_PLATFORM_DEFINES += HAVE_VIS=0 ;
} else if $(TARGET_ARCH) = ppc {
defines += ARCH_X86=0 ARCH_X86_32=0 ARCH_PPC=1 ARCH_SPARC=0 ;
defines += HAVE_AMD3DNOW=0 HAVE_AMD3DNOWEXT=0 ;
defines += HAVE_MMX=0 HAVE_MMX2=0 HAVE_SSE=0 HAVE_SSE3=0 ;
defines += HAVE_ALTIVEC=1 ;
defines += HAVE_VIS=0 ;
FFMPEG_PLATFORM_DEFINES += ARCH_X86=0 ARCH_X86_32=0 ;
FFMPEG_PLATFORM_DEFINES += ARCH_PPC=1 ;
FFMPEG_PLATFORM_DEFINES += ARCH_SPARC=0 ;
FFMPEG_PLATFORM_DEFINES += HAVE_AMD3DNOW=0 HAVE_AMD3DNOWEXT=0 ;
FFMPEG_PLATFORM_DEFINES += HAVE_MMX=0 HAVE_MMX2=0 HAVE_SSE=0 HAVE_SSE3=0 ;
FFMPEG_PLATFORM_DEFINES += HAVE_ALTIVEC=1 ;
FFMPEG_PLATFORM_DEFINES += HAVE_VIS=0 ;
} else if $(TARGET_ARCH) = sparc {
defines += ARCH_X86=0 ARCH_X86_32=0 ARCH_PPC=0 ARCH_SPARC=1 ;
defines += HAVE_AMD3DNOW=0 HAVE_AMD3DNOWEXT=0 ;
defines += HAVE_MMX=0 HAVE_MMX2=0 HAVE_SSE=0 HAVE_SSE3=0 ;
defines += HAVE_ALTIVEC=0 ;
defines += HAVE_VIS=1 ;
FFMPEG_PLATFORM_DEFINES += ARCH_X86=0 ARCH_X86_32=0 ;
FFMPEG_PLATFORM_DEFINES += ARCH_PPC=0 ;
FFMPEG_PLATFORM_DEFINES += ARCH_SPARC=1 ;
FFMPEG_PLATFORM_DEFINES += HAVE_AMD3DNOW=0 HAVE_AMD3DNOWEXT=0 ;
FFMPEG_PLATFORM_DEFINES += HAVE_MMX=0 HAVE_MMX2=0 HAVE_SSE=0 HAVE_SSE3=0 ;
FFMPEG_PLATFORM_DEFINES += HAVE_ALTIVEC=0 ;
FFMPEG_PLATFORM_DEFINES += HAVE_VIS=1 ;
}
defines = [ FDefines $(defines) ] ;
SubDirCcFlags $(defines) ;
SubDirC++Flags $(defines) ;
FFMPEG_PLATFORM_DEFINES = [ FDefines $(FFMPEG_PLATFORM_DEFINES) ] ;
SubDirCcFlags $(FFMPEG_PLATFORM_DEFINES) ;
SubDirC++Flags $(FFMPEG_PLATFORM_DEFINES) ;
StaticLibrary libavcodec.a :
4xm.c

View File

@ -18,18 +18,8 @@ if $(HAIKU_GCC_VERSION[1]) >= 3 {
# Enable altivec support
SubDirCcFlags -maltivec -mabi=altivec ;
local defines ;
defines = HAVE_AV_CONFIG_H=1 ;
defines += ARCH_X86=0 ARCH_X86_32=0 ARCH_PPC=1 ARCH_SPARC=0 ;
defines += HAVE_AMD3DNOW=0 HAVE_AMD3DNOWEXT=0 ;
defines += HAVE_MMX=0 HAVE_MMX2=0 HAVE_SSE=0 HAVE_SSE3=0 ;
defines += HAVE_ALTIVEC=1 HAVE_ALTIVEC_H=1 ;
defines += HAVE_VIS=0 ;
defines = [ FDefines $(defines) ] ;
SubDirCcFlags $(defines) ;
SubDirC++Flags $(defines) ;
SubDirCcFlags $(FFMPEG_PLATFORM_DEFINES) ;
SubDirC++Flags $(FFMPEG_PLATFORM_DEFINES) ;
StaticLibrary libavcodec_ppc.a :
check_altivec.c

View File

@ -15,32 +15,8 @@ if $(HAIKU_GCC_VERSION[1]) >= 3 {
SubDirCcFlags -fomit-frame-pointer -DPIC ;
}
local defines ;
defines = HAVE_AV_CONFIG_H=1 ;
if $(TARGET_ARCH) = x86 {
defines += ARCH_X86=1 ARCH_X86_32=1 ARCH_PPC=0 ARCH_SPARC=0 ;
defines += HAVE_AMD3DNOW=0 HAVE_AMD3DNOWEXT=0 ;
defines += HAVE_MMX=1 HAVE_MMX2=1 HAVE_SSE=0 HAVE_SSE3=1 ;
defines += HAVE_ALTIVEC=0 ;
defines += HAVE_VIS=0 ;
} else if $(TARGET_ARCH) = ppc {
defines += ARCH_X86=0 ARCH_X86_32=0 ARCH_PPC=1 ARCH_SPARC=0 ;
defines += HAVE_AMD3DNOW=0 HAVE_AMD3DNOWEXT=0 ;
defines += HAVE_MMX=0 HAVE_MMX2=0 HAVE_SSE=0 HAVE_SSE3=0 ;
defines += HAVE_ALTIVEC=1 ;
defines += HAVE_VIS=0 ;
} else if $(TARGET_ARCH) = sparc {
defines += ARCH_X86=0 ARCH_X86_32=0 ARCH_PPC=0 ARCH_SPARC=1 ;
defines += HAVE_AMD3DNOW=0 HAVE_AMD3DNOWEXT=0 ;
defines += HAVE_MMX=0 HAVE_MMX2=0 HAVE_SSE=0 HAVE_SSE3=0 ;
defines += HAVE_ALTIVEC=0 ;
defines += HAVE_VIS=1 ;
}
defines = [ FDefines $(defines) ] ;
SubDirCcFlags $(defines) ;
SubDirC++Flags $(defines) ;
SubDirCcFlags $(FFMPEG_PLATFORM_DEFINES) ;
SubDirC++Flags $(FFMPEG_PLATFORM_DEFINES) ;
StaticLibrary libavcodec_sparc.a :
dsputil_vis.c

View File

@ -15,17 +15,8 @@ if $(HAIKU_GCC_VERSION[1]) >= 3 {
SubDirCcFlags -fomit-frame-pointer -DPIC ;
}
local defines ;
defines = HAVE_AV_CONFIG_H=1 ;
defines += ARCH_X86=1 ARCH_X86_32=1 ARCH_PPC=0 ARCH_SPARC=0 ;
defines += HAVE_AMD3DNOW=0 HAVE_AMD3DNOWEXT=0 ;
defines += HAVE_MMX=1 HAVE_MMX2=1 HAVE_SSE=0 HAVE_SSE3=1 ;
defines += HAVE_ALTIVEC=0 ;
defines += HAVE_VIS=0 ;
defines = [ FDefines $(defines) ] ;
SubDirCcFlags $(defines) ;
SubDirC++Flags $(defines) ;
SubDirCcFlags $(FFMPEG_PLATFORM_DEFINES) ;
SubDirC++Flags $(FFMPEG_PLATFORM_DEFINES) ;
StaticLibrary libavcodec_x86.a :
cpuid.c