blob: 1f4ed1fe388146a4e42f56bf3e16e2fb31b58ae3 [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
Will Drewry4dd0e662010-01-19 14:43:50 -080018 options_unittest.cc
drewry@google.combd940e92009-12-07 19:13:27 +000019 minijail_testrunner.cc""")
Will Drewryb5518472009-12-10 12:31:47 -080020benchmark_sources = glob.glob("*_microbenchmark.cc")
drewry@google.combd940e92009-12-07 19:13:27 +000021
22env.Append(
23 CPPPATH=['..', '../../third_party/chrome/files', '../../common'],
24 CCFLAGS=['-g', '-fno-exceptions', '-Wall', '-Werror'],
25 LIBPATH=['../../third_party/chrome'],
26 LIBS=['cap', 'base', 'pthread', 'rt'],
27)
Colin Watson3daf6022010-01-07 17:38:39 +000028for key in Split('CC CXX AR RANLIB LD NM CFLAGS CCFLAGS'):
29 value = os.environ.get(key)
30 if value != None:
31 env[key] = value
drewry@google.combd940e92009-12-07 19:13:27 +000032
33env_lib = env.Clone()
34env_lib.SharedLibrary('minijail', lib_sources)
35
36env_bin = env.Clone()
37env_bin.Program('minijail', lib_sources + bin_sources)
38
39env_test = env.Clone()
Will Drewry4dd0e662010-01-19 14:43:50 -080040env_test.Append(LIBS=['gtest', 'gmock'])
drewry@google.combd940e92009-12-07 19:13:27 +000041env_test.Program('minijail_unittests', lib_sources + test_sources)
Will Drewryb5518472009-12-10 12:31:47 -080042
43env_benchmarks = env.Clone()
44# Note, LIBS needs to have: 'gtest', 'base', 'rt', 'pthread'
45env_benchmarks.Append(LIBS=['microbenchmark_main.a',
46 # Since we want to run this on a prod image,
47 # we just statically pull in gtest.a.
Will Drewry4dd0e662010-01-19 14:43:50 -080048 File('/usr/lib/libgtest.a')])
Will Drewryb5518472009-12-10 12:31:47 -080049env_benchmarks.Program('minijail_benchmarks', benchmark_sources)