blob: d5f44171a32fc89ccde941d54fe8b00f05096de1 [file] [log] [blame]
Alec Thileniusf79f52b2017-12-22 12:10:17 -07001project('mosys', 'c')
2
3# Include common. This is passed to all subdir build files as well
4include_common = include_directories(['include'])
5
6# Config data used for creating a config header and including it
7conf_data = configuration_data()
8
9# Set for all platforms
10conf_data.set('PROGRAM', '"mosys"')
11conf_data.set('VERSION', '"1.2.03"')
12conf_data.set('CONFIG_LITTLE_ENDIAN', 1)
13conf_data.set('CONFIG_LOGLEVEL', 4)
14conf_data.set('CONFIG_PLATFORM_EXPERIMENTAL', 1)
15conf_data.set('CONFIG_USE_IPC_LOCK', 1)
16use_cros_config = get_option('use_cros_config') == 'true'
17if use_cros_config
18 conf_data.set('CONFIG_CROS_CONFIG', 1)
19endif
20
21# Setting on a per-arch basis
22arch = get_option('arch')
23if arch == 'x86' or arch == 'x86_64' or arch == 'amd64'
24 conf_data.set('CONFIG_CHIPSET_INTEL', 1)
25 conf_data.set('CONFIG_CHIPSET_INTEL_LYNXPOINT_LP', 1)
26 conf_data.set('CONFIG_CHIPSET_INTEL_NM10', 1)
27 conf_data.set('CONFIG_CHIPSET_INTEL_SERIES6', 1)
28 conf_data.set('CONFIG_CROS_EC', 1)
29 conf_data.set('CONFIG_CROS_EC_LPC', 1)
30 conf_data.set('CONFIG_EC_ENE_KB932', 1)
31 conf_data.set('CONFIG_EC_ITE_IT8500', 1)
32 conf_data.set('CONFIG_EC_NUVOTON_NPCE781', 1)
33 conf_data.set('CONFIG_EC_SMSC_MEC1308', 1)
34 conf_data.set('CONFIG_EXPERIMENTAL_KIEV', 1)
35 conf_data.set('CONFIG_INTF_PORT_IO', 1)
36 conf_data.set('CONFIG_PLATFORM_ALEX', 1)
37 conf_data.set('CONFIG_PLATFORM_ARCH_X86', 1)
38 conf_data.set('CONFIG_PLATFORM_AURON', 1)
39 conf_data.set('CONFIG_PLATFORM_BELTINO', 1)
40 conf_data.set('CONFIG_PLATFORM_BUTTERFLY', 1)
41 conf_data.set('CONFIG_PLATFORM_CYAN', 1)
42 conf_data.set('CONFIG_PLATFORM_FIZZ', 1)
43 conf_data.set('CONFIG_PLATFORM_GLADOS', 1)
44 conf_data.set('CONFIG_PLATFORM_KAHLEE', 1)
45 conf_data.set('CONFIG_PLATFORM_LINK', 1)
46 conf_data.set('CONFIG_PLATFORM_LUMPY', 1)
47 conf_data.set('CONFIG_PLATFORM_MARIO', 1)
48 conf_data.set('CONFIG_PLATFORM_PARROT', 1)
49 conf_data.set('CONFIG_PLATFORM_RAMBI', 1)
50 conf_data.set('CONFIG_PLATFORM_REEF', 1)
51 conf_data.set('CONFIG_PLATFORM_SAMUS', 1)
52 conf_data.set('CONFIG_PLATFORM_SLIPPY', 1)
53 conf_data.set('CONFIG_PLATFORM_STOUT', 1)
54 conf_data.set('CONFIG_PLATFORM_STRAGO', 1)
55 conf_data.set('CONFIG_PLATFORM_STUMPY', 1)
56 conf_data.set('CONFIG_PLATFORM_ZGB', 1)
57 conf_data.set('CONFIG_SOC_INTEL_BAYTRAIL', 1)
58 conf_data.set('CONFIG_SOC_INTEL_BRASWELL', 1)
59 conf_data.set('CONFIG_STORAGE_SANDISK_U100', 1)
60 conf_data.set('CONFIG_SUPERIO_ITE_IT8772', 1)
61 conf_data.set('CONFIG_USE_FILE_LOCK', 1)
62elif arch == 'mip'
63 conf_data.set('CONFIG_PLATFORM_ARCH_MIPSEL', 1)
64elif arch == 'arm'
65 conf_data.set('CONFIG_CROS_EC', 1)
66 conf_data.set('CONFIG_CROS_EC_I2C', 1)
67 conf_data.set('CONFIG_PLATFORM_ARCH_ARMEL', 1)
68 conf_data.set('CONFIG_PLATFORM_CYCLONE', 1)
69 conf_data.set('CONFIG_PLATFORM_DAISY', 1)
70 conf_data.set('CONFIG_PLATFORM_GRU', 1)
71 conf_data.set('CONFIG_PLATFORM_NYAN', 1)
72 conf_data.set('CONFIG_PLATFORM_OAK', 1)
73 conf_data.set('CONFIG_PLATFORM_PEACH', 1)
74 conf_data.set('CONFIG_PLATFORM_PINKY', 1)
75 conf_data.set('CONFIG_PLATFORM_SKATE', 1)
76 conf_data.set('CONFIG_PLATFORM_SMAUG', 1)
77 conf_data.set('CONFIG_PLATFORM_SPRING', 1)
78 conf_data.set('CONFIG_PLATFORM_STORM', 1)
79 conf_data.set('CONFIG_SOC_NVIDIA', 1)
80 conf_data.set('CONFIG_SOC_NVIDIA_TEGRA124', 1)
81 conf_data.set('CONFIG_SOC_SAMSUNG', 1)
82 conf_data.set('CONFIG_SOC_SAMSUNG_EXYNOS5250', 1)
83 conf_data.set('CONFIG_SOC_SAMSUNG_EXYNOS5420', 1)
84 conf_data.set('CONFIG_TRACKPAD_CYPRESS_APA', 1)
85 conf_data.set('CONFIG_USE_FILE_LOCK', 1)
86endif
87
88# Create the config header file and include it by default while compiling
89configure_file(
90 output : 'config.h',
91 configuration : conf_data,
92)
93add_global_arguments('-include', 'config.h', language: 'c')
94
95# External libs used by Mosys
96fmap_dep = dependency('fmap')
97uuid_dep = dependency('uuid')
98
99# Subdirs with source to link against
100subdir('core')
101subdir('drivers')
102subdir('intf')
103subdir('lib')
104subdir('platform')
105
106# Lib momsys shared library target
107libmosys = static_library(
108 'mosys',
109 [],
110 dependencies: [
111 fmap_dep,
112 uuid_dep,
113 ],
114 include_directories: include_common,
115 link_with: [
116 libmosys_core,
117 libmosys_drivers,
118 libmosys_intf,
119 libmosys_lib,
120 libmosys_platform,
121 ],
122 pic: true
123)
124
125# Add static linking if static is set
126link_args = []
127if get_option('static') == 'true'
128 link_args += '-static'
129endif
130
131# Mosys dynamic executable
132executable(
133 'mosys',
134 ['mosys.c'],
135 include_directories: include_common,
136 link_args: link_args,
137 link_with: [libmosys],
138 install: true,
139 install_dir: '/usr/sbin',
140)
141
142# Mosys static executable. This will be removed by the ebuild if static is not
143# set, but is always built and installed first.
144executable(
145 'mosys_s',
146 ['mosys.c'],
147 include_directories: include_common,
148 link_args: ['-static'],
149 link_with: [libmosys],
150 install: true,
151 install_dir: '/usr/sbin',
152)
153
154# Import tests last, which can link against libmosys
155subdir('tests')