blob: 606fbeec5899e016f9ee152ac350d0f0dee17c53 [file] [log] [blame]
drewry@google.combd940e92009-12-07 19:13:27 +00001# -*- python -*-
2
3# Copyright (c) 2009 The Chromium OS Authors. All rights reserved.
4# Use of this source code is governed by a BSD-style license that can be
5# found in the LICENSE file.
6
Will Drewryb5518472009-12-10 12:31:47 -08007import glob
drewry@google.combd940e92009-12-07 19:13:27 +00008import os
9
10env = Environment()
11
12lib_sources = env.Split("""env.cc
13 interface.cc
14 minijail.cc
15 options.cc""")
16bin_sources = env.Split("""minijail_main.cc""")
17test_sources = env.Split("""minijail_unittest.cc
18 minijail_testrunner.cc""")
Will Drewryb5518472009-12-10 12:31:47 -080019benchmark_sources = glob.glob("*_microbenchmark.cc")
drewry@google.combd940e92009-12-07 19:13:27 +000020
21env.Append(
22 CPPPATH=['..', '../../third_party/chrome/files', '../../common'],
23 CCFLAGS=['-g', '-fno-exceptions', '-Wall', '-Werror'],
24 LIBPATH=['../../third_party/chrome'],
25 LIBS=['cap', 'base', 'pthread', 'rt'],
26)
Colin Watson3daf6022010-01-07 17:38:39 +000027for key in Split('CC CXX AR RANLIB LD NM CFLAGS CCFLAGS'):
28 value = os.environ.get(key)
29 if value != None:
30 env[key] = value
drewry@google.combd940e92009-12-07 19:13:27 +000031
32env_lib = env.Clone()
33env_lib.SharedLibrary('minijail', lib_sources)
34
35env_bin = env.Clone()
36env_bin.Program('minijail', lib_sources + bin_sources)
37
38env_test = env.Clone()
Will Drewryb5518472009-12-10 12:31:47 -080039env_test.Append(LIBS=['gtest'])
drewry@google.combd940e92009-12-07 19:13:27 +000040env_test.Program('minijail_unittests', lib_sources + test_sources)
Will Drewryb5518472009-12-10 12:31:47 -080041
42env_benchmarks = env.Clone()
43# Note, LIBS needs to have: 'gtest', 'base', 'rt', 'pthread'
44env_benchmarks.Append(LIBS=['microbenchmark_main.a',
45 # Since we want to run this on a prod image,
46 # we just statically pull in gtest.a.
47 File('/usr/lib/libgtest.a')],
48 LIBPATH=['../microbenchmark'])
49env_benchmarks.Program('minijail_benchmarks', benchmark_sources)