2 # Copyright 2008, Google Inc.
5 # Redistribution and use in source and binary forms, with or without
6 # modification, are permitted provided that the following conditions are
9 # * Redistributions of source code must retain the above copyright
10 # notice, this list of conditions and the following disclaimer.
11 # * Redistributions in binary form must reproduce the above
12 # copyright notice, this list of conditions and the following disclaimer
13 # in the documentation and/or other materials provided with the
15 # * Neither the name of Google Inc. nor the names of its
16 # contributors may be used to endorse or promote products derived from
17 # this software without specific prior written permission.
19 # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
20 # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
21 # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
22 # A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
23 # OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
24 # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
25 # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
26 # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
27 # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
28 # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
29 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
38 '$SOURCE_ROOT/googleclient',
39 # So we can use generated things with paths from googleclient.
40 # TODO: figure out a better way to do this.
45 if env['TARGET_PLATFORM'] != 'WINDOWS':
52 # TODO: clean this up more
56 if env.Bit('windows'):
57 sdl_dll += sdl_env.Replicate('$STAGING_DIR', '$SDL_DIR/lib/SDL.dll')
58 sdl_dll += sdl_env.Replicate('.', '$SDL_DIR/lib/SDL.dll')
60 sdl_dll += sdl_env.Replicate('$TARGET_ROOT/Frameworks',
61 '$SDL_DIR/SDL.framework')
62 sdl_dll += sdl_env.Replicate('$OBJ_ROOT/Frameworks', '$SDL_DIR/SDL.framework')
63 elif env.Bit('linux'):
64 sdl_dll += sdl_env.Replicate('$STAGING_DIR', '$SDL_DIR/lib/libSDL-1.2.so.0')
65 sdl_dll += sdl_env.Replicate('.', '$SDL_DIR/lib/libSDL-1.2.so.0')
67 # Make a copy of debug CRT for now.
68 # TODO: there should be a better way to generalize this requirement.
70 if env.AllBits('windows', 'debug'):
71 for i in ['.', '$STAGING_DIR']:
72 crt += env.Replicate(i, '$VC80_DIR/vc/redist/Debug_NonRedist/'
73 'x86/Microsoft.VC80.DebugCRT')
74 crt += env.Replicate(i, '$VC80_DIR/vc/redist/x86/Microsoft.VC80.CRT')
77 # Isolate the environment for ncdecode_table to prevent a cycle.
78 env_decode_table = env.Clone()
79 env_decode_table['COVERAGE_LINKCOM_EXTRAS'] = None
80 ncdecode_table = env_decode_table.ComponentProgram('ncdecode_table',
82 env.Requires(ncdecode_table, crt)
83 env.Requires(ncdecode_table, sdl_dll)
85 # Link everyone else to ncvalidate.
86 env.Append(LIBS = ['ncvalidate', 'ncvtest'])
99 env.ComponentLibrary('ncvalidate', ncvalidate_inputs)
100 env.ComponentLibrary('ncvtest', ncv_test_inputs)
102 ncv_generated_headers = ['native_client/ncv/ncdecodetab.h',
103 'native_client/ncv/ncdisasmtab.h']
105 for f in ncv_generated_headers:
106 src_f = os.path.join(env['SOURCE_ROOT'],'googleclient',f)
107 if os.path.exists(src_f):
108 print >>sys.stderr, 'A copy of generated file %s exists in the source' % f
109 print >>sys.stderr, 'at %s' % src_f
110 print >>sys.stderr, 'and will shadow the generated version. PLEASE FIX.'
114 ncv_generated_headers,
116 'cd ${TARGET.dir} && ${SOURCE.abspath}')
118 env.Append(LIBS = ['platform_qual_lib'])
119 nacl_cpuid = env.ComponentProgram('nacl_cpuid', 'nacl_cpuid_test.c')
120 env.Requires(nacl_cpuid, crt)
121 env.Requires(nacl_cpuid, sdl_dll)
123 env.ComponentProgram('ncdis', 'ncdis.c')
124 ncval = env.ComponentProgram('ncval', ['ncval.c', 'ncval_tests.c'])
125 env.Requires(ncval, crt)
126 env.Requires(ncval, sdl_dll)
129 # TODO: get OSX and Windows working below here
130 if env['TARGET_PLATFORM'] in ['WINDOWS', 'MAC']:
134 node = env.Command('nacl_cpuid_test.out',
136 '${SOURCES[0].abspath} > ${TARGET}')
138 env.ComponentTestOutput('cpuid_test', node)
140 env.AddNodeToLargeTestsSuite(node)