blob: 99072b089dec5eeefd233232cc6fdf2d1cdbf002 [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)
Jason D. Clintona7fd67d2018-04-17 13:34:08 -060015use_cros_config = get_option('use_cros_config') == true
Alec Thileniusf79f52b2017-12-22 12:10:17 -070016if use_cros_config
17 conf_data.set('CONFIG_CROS_CONFIG', 1)
18endif
19
20# Setting on a per-arch basis
21arch = get_option('arch')
22if arch == 'x86' or arch == 'x86_64' or arch == 'amd64'
23 conf_data.set('CONFIG_CHIPSET_INTEL', 1)
24 conf_data.set('CONFIG_CHIPSET_INTEL_LYNXPOINT_LP', 1)
25 conf_data.set('CONFIG_CHIPSET_INTEL_NM10', 1)
26 conf_data.set('CONFIG_CHIPSET_INTEL_SERIES6', 1)
27 conf_data.set('CONFIG_CROS_EC', 1)
28 conf_data.set('CONFIG_CROS_EC_LPC', 1)
29 conf_data.set('CONFIG_EC_ENE_KB932', 1)
30 conf_data.set('CONFIG_EC_ITE_IT8500', 1)
31 conf_data.set('CONFIG_EC_NUVOTON_NPCE781', 1)
32 conf_data.set('CONFIG_EC_SMSC_MEC1308', 1)
33 conf_data.set('CONFIG_EXPERIMENTAL_KIEV', 1)
34 conf_data.set('CONFIG_INTF_PORT_IO', 1)
35 conf_data.set('CONFIG_PLATFORM_ALEX', 1)
36 conf_data.set('CONFIG_PLATFORM_ARCH_X86', 1)
37 conf_data.set('CONFIG_PLATFORM_AURON', 1)
38 conf_data.set('CONFIG_PLATFORM_BELTINO', 1)
39 conf_data.set('CONFIG_PLATFORM_BUTTERFLY', 1)
40 conf_data.set('CONFIG_PLATFORM_CYAN', 1)
41 conf_data.set('CONFIG_PLATFORM_FIZZ', 1)
42 conf_data.set('CONFIG_PLATFORM_GLADOS', 1)
43 conf_data.set('CONFIG_PLATFORM_KAHLEE', 1)
44 conf_data.set('CONFIG_PLATFORM_LINK', 1)
45 conf_data.set('CONFIG_PLATFORM_LUMPY', 1)
46 conf_data.set('CONFIG_PLATFORM_MARIO', 1)
C Shapiroed0a3af2018-04-16 17:12:00 -060047 conf_data.set('CONFIG_PLATFORM_OCTOPUS', 1)
Alec Thileniusf79f52b2017-12-22 12:10:17 -070048 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)
Alec Thileniusf79f52b2017-12-22 12:10:17 -070061elif arch == 'mip'
62 conf_data.set('CONFIG_PLATFORM_ARCH_MIPSEL', 1)
63elif arch == 'arm'
64 conf_data.set('CONFIG_CROS_EC', 1)
65 conf_data.set('CONFIG_CROS_EC_I2C', 1)
66 conf_data.set('CONFIG_PLATFORM_ARCH_ARMEL', 1)
67 conf_data.set('CONFIG_PLATFORM_CYCLONE', 1)
68 conf_data.set('CONFIG_PLATFORM_DAISY', 1)
69 conf_data.set('CONFIG_PLATFORM_GRU', 1)
70 conf_data.set('CONFIG_PLATFORM_NYAN', 1)
71 conf_data.set('CONFIG_PLATFORM_OAK', 1)
72 conf_data.set('CONFIG_PLATFORM_PEACH', 1)
73 conf_data.set('CONFIG_PLATFORM_PINKY', 1)
74 conf_data.set('CONFIG_PLATFORM_SKATE', 1)
75 conf_data.set('CONFIG_PLATFORM_SMAUG', 1)
76 conf_data.set('CONFIG_PLATFORM_SPRING', 1)
77 conf_data.set('CONFIG_PLATFORM_STORM', 1)
78 conf_data.set('CONFIG_SOC_NVIDIA', 1)
79 conf_data.set('CONFIG_SOC_NVIDIA_TEGRA124', 1)
80 conf_data.set('CONFIG_SOC_SAMSUNG', 1)
81 conf_data.set('CONFIG_SOC_SAMSUNG_EXYNOS5250', 1)
82 conf_data.set('CONFIG_SOC_SAMSUNG_EXYNOS5420', 1)
83 conf_data.set('CONFIG_TRACKPAD_CYPRESS_APA', 1)
Alec Thileniusf79f52b2017-12-22 12:10:17 -070084endif
85
86# Create the config header file and include it by default while compiling
87configure_file(
88 output : 'config.h',
89 configuration : conf_data,
90)
91add_global_arguments('-include', 'config.h', language: 'c')
Jason D. Clintona7fd67d2018-04-17 13:34:08 -060092add_global_arguments('-std=gnu99', language : 'c')
Alec Thileniusf79f52b2017-12-22 12:10:17 -070093
94# External libs used by Mosys
95fmap_dep = dependency('fmap')
96uuid_dep = dependency('uuid')
97
Jason D. Clinton3a2b39c2018-04-16 11:42:49 -060098libmosys_src = files()
99
Alec Thileniusf79f52b2017-12-22 12:10:17 -0700100# Subdirs with source to link against
101subdir('core')
102subdir('drivers')
103subdir('intf')
104subdir('lib')
105subdir('platform')
106
Jason D. Clinton3a2b39c2018-04-16 11:42:49 -0600107deps = [
108 fmap_dep,
109 uuid_dep,
110]
111link_whole = []
112
113# Cros config is a special snowflake.
114if use_cros_config
115 libmosys_src += mosys_lib_cros_config_src
116 fdt_dep = meson.get_compiler('c').find_library('fdt')
117 deps += fdt_dep
118 dtb_lib = static_library(
119 'cros_config_dtb',
120 cros_config_dtb_src,
121 c_args: [
122 '-Itools/vpd_encode',
123 '-D__ASSEMBLY__',
124 '-c',
125 ],
126 link_args: [
127 '-znoexecstack',
128 '-r',
129 ],
130 )
131 link_whole += dtb_lib
132endif
133
Alec Thileniusf79f52b2017-12-22 12:10:17 -0700134# Lib momsys shared library target
135libmosys = static_library(
136 'mosys',
Jason D. Clinton3a2b39c2018-04-16 11:42:49 -0600137 libmosys_src,
138 dependencies: deps,
Alec Thileniusf79f52b2017-12-22 12:10:17 -0700139 include_directories: include_common,
Jason D. Clinton3a2b39c2018-04-16 11:42:49 -0600140 link_whole: link_whole,
141 pic: true,
Alec Thileniusf79f52b2017-12-22 12:10:17 -0700142)
143
144# Add static linking if static is set
145link_args = []
Jason D. Clintona7fd67d2018-04-17 13:34:08 -0600146if get_option('static') == true
Alec Thileniusf79f52b2017-12-22 12:10:17 -0700147 link_args += '-static'
148endif
149
150# Mosys dynamic executable
151executable(
152 'mosys',
153 ['mosys.c'],
154 include_directories: include_common,
155 link_args: link_args,
156 link_with: [libmosys],
157 install: true,
158 install_dir: '/usr/sbin',
159)
160
161# Mosys static executable. This will be removed by the ebuild if static is not
162# set, but is always built and installed first.
163executable(
164 'mosys_s',
165 ['mosys.c'],
166 include_directories: include_common,
167 link_args: ['-static'],
168 link_with: [libmosys],
169 install: true,
170 install_dir: '/usr/sbin',
171)