OSDN Git Service

Merge branch 'mesa_7_5_branch'
[android-x86/external-mesa.git] / scons / gallium.py
index d20d02c..6e924da 100644 (file)
@@ -42,11 +42,18 @@ import SCons.Scanner
 def quietCommandLines(env):
     # Quiet command lines
     # See also http://www.scons.org/wiki/HidingCommandLinesInOutput
-    env['CCCOMSTR'] = "Compiling $SOURCE ..."
-    env['CXXCOMSTR'] = "Compiling $SOURCE ..."
-    env['ARCOMSTR'] = "Archiving $TARGET ..."
-    env['RANLIBCOMSTR'] = ""
-    env['LINKCOMSTR'] = "Linking $TARGET ..."
+    env['ASCOMSTR'] = "  Assembling $SOURCE ..."
+    env['ASPPCOMSTR'] = "  Assembling $SOURCE ..."
+    env['CCCOMSTR'] = "  Compiling $SOURCE ..."
+    env['SHCCCOMSTR'] = "  Compiling $SOURCE ..."
+    env['CXXCOMSTR'] = "  Compiling $SOURCE ..."
+    env['SHCXXCOMSTR'] = "  Compiling $SOURCE ..."
+    env['ARCOMSTR'] = "  Archiving $TARGET ..."
+    env['RANLIBCOMSTR'] = "  Indexing $TARGET ..."
+    env['LINKCOMSTR'] = "  Linking $TARGET ..."
+    env['SHLINKCOMSTR'] = "  Linking $TARGET ..."
+    env['LDMODULECOMSTR'] = "  Linking $TARGET ..."
+    env['SWIGCOMSTR'] = "  Generating $TARGET ..."
 
 
 def createConvenienceLibBuilder(env):
@@ -185,9 +192,8 @@ def num_jobs():
 def generate(env):
     """Common environment generation code"""
 
-    # FIXME: this is already too late
-    #if env.get('quiet', False):
-    #    quietCommandLines(env)
+    if env.get('quiet', True):
+        quietCommandLines(env)
 
     # Toolchain
     platform = env['platform']
@@ -198,14 +204,17 @@ def generate(env):
             env['toolchain'] = 'wcesdk'
     env.Tool(env['toolchain'])
 
+    env['gcc'] = 'gcc' in os.path.basename(env['CC']).split('-')
+    env['msvc'] = env['CC'] == 'cl'
+
     # shortcuts
     debug = env['debug']
     machine = env['machine']
     platform = env['platform']
     x86 = env['machine'] == 'x86'
     ppc = env['machine'] == 'ppc'
-    gcc = env['platform'] in ('linux', 'freebsd', 'darwin') or env['toolchain'] == 'crossmingw'
-    msvc = env['platform'] in ('windows', 'winddk', 'wince') and env['toolchain'] != 'crossmingw'
+    gcc = env['gcc']
+    msvc = env['msvc']
 
     # Put build output in a separate dir, which depends on the current
     # configuration. See also http://www.scons.org/wiki/AdvancedBuildExample
@@ -248,19 +257,25 @@ def generate(env):
             ('WINVER', '0x0501'),
             # http://msdn2.microsoft.com/en-us/library/6dwk3a1z.aspx,
             'WIN32_LEAN_AND_MEAN',
-            'VC_EXTRALEAN',
-            '_CRT_SECURE_NO_DEPRECATE',
         ]
+        if msvc and env['toolchain'] != 'winddk':
+            cppdefines += [
+                'VC_EXTRALEAN',
+                '_CRT_SECURE_NO_DEPRECATE',
+            ]
         if debug:
             cppdefines += ['_DEBUG']
-    if platform == 'winddk':
+    if env['toolchain'] == 'winddk':
         # Mimic WINDDK's builtin flags. See also:
         # - WINDDK's bin/makefile.new i386mk.inc for more info.
         # - buildchk_wxp_x86.log files, generated by the WINDDK's build
         # - http://alter.org.ua/docs/nt_kernel/vc8_proj/
+        if machine == 'x86':
+            cppdefines += ['_X86_', 'i386']
+        if machine == 'x86_64':
+            cppdefines += ['_AMD64_', 'AMD64']
+    if platform == 'winddk':
         cppdefines += [
-            ('_X86_', '1'),
-            ('i386', '1'),
             'STD_CALL',
             ('CONDITION_HANDLING', '1'),
             ('NT_INST', '0'),
@@ -303,20 +318,13 @@ def generate(env):
         cppdefines += ['PIPE_SUBSYSTEM_WINDOWS_CE_OGL']
     env.Append(CPPDEFINES = cppdefines)
 
-    # C preprocessor includes
-    if platform == 'winddk':
-        env.Append(CPPPATH = [
-            env['SDK_INC_PATH'],
-            env['DDK_INC_PATH'],
-            env['WDM_INC_PATH'],
-            env['CRT_INC_PATH'],
-        ])
-
     # C compiler options
     cflags = []
     if gcc:
         if debug:
             cflags += ['-O0', '-g3']
+        elif env['toolchain'] == 'crossmingw':
+            cflags += ['-O0', '-g3'] # mingw 4.2.1 optimizer is broken
         else:
             cflags += ['-O3', '-g3']
         if env['profile']:
@@ -330,9 +338,14 @@ def generate(env):
             ]
         if env['machine'] == 'x86_64':
             cflags += ['-m64']
+        # See also:
+        # - http://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html
         cflags += [
+            '-Werror=declaration-after-statement',
             '-Wall',
             '-Wmissing-prototypes',
+            '-Wmissing-field-initializers',
+            '-Wpointer-arith',
             '-Wno-long-long',
             '-ffast-math',
             '-std=gnu99',
@@ -351,10 +364,8 @@ def generate(env):
             ]
         else:
             cflags += [
-              '/Ox', # maximum optimizations
-              '/Oi', # enable intrinsic functions
-              '/Ot', # favor code speed
-              #'/fp:fast', # fast floating point 
+                '/O2', # optimize for speed
+                #'/fp:fast', # fast floating point 
             ]
         if env['profile']:
             cflags += [
@@ -473,7 +484,7 @@ def generate(env):
 
             '/entry:DrvEnableDriver',
         ]
-        if env['profile']:
+        if env['debug'] or env['profile']:
             linkflags += [
                 '/MAP', # http://msdn.microsoft.com/en-us/library/k7xkk3e2.aspx
             ]