1firmware_inc = include_directories('.')
2
3# phosphor-ipmi-flash config
4config_data = []
5if get_option('update-type') == 'static-layout'
6  if get_option('reboot-update')
7    config_data += 'config-static-bmc-reboot.json'
8  else
9    if get_option('update-status')
10      config_data += 'config-static-bmc-with-update-status.json'
11    else
12      config_data += 'config-static-bmc.json'
13    endif
14  endif
15endif
16
17if get_option('host-bios')
18  config_data += 'config-bios.json'
19endif
20
21foreach data : config_data
22  configure_file(
23    input: data + '.in',
24    output: data,
25    configuration: conf_data,
26    install: true,
27    install_dir: get_option('datadir') / 'phosphor-ipmi-flash')
28endforeach
29
30# temp files
31install_data(
32  'phosphor-ipmi-flash.conf',
33  install_dir: get_option('libdir') / 'tmpfiles.d')
34
35# systemd configs
36systemd_data = [
37  'phosphor-ipmi-flash-bmc-prepare.target',
38  'phosphor-ipmi-flash-bmc-verify.target',
39  'phosphor-ipmi-flash-bmc-update.target',
40]
41
42if get_option('host-bios')
43  systemd_data += [
44    'phosphor-ipmi-flash-bios-prepare.target',
45    'phosphor-ipmi-flash-bios-verify.target',
46    'phosphor-ipmi-flash-bios-update.target']
47endif
48
49systemd = dependency('systemd')
50if systemd.found()
51  foreach data : systemd_data
52    configure_file(
53      input: data + '.in',
54      output: data,
55      configuration: conf_data,
56      install: true,
57      install_dir: systemd.get_variable('systemdsystemunitdir'))
58  endforeach
59endif
60
61firmware_source = [
62  'firmware_handlers_builder.cpp',
63  'firmware_handler.cpp',
64  'lpc_handler.cpp']
65
66if (get_option('lpc-type') == 'aspeed-lpc' or
67    not get_option('tests').disabled())
68  firmware_source += 'lpc_aspeed.cpp'
69endif
70
71if (get_option('lpc-type') == 'nuvoton-lpc' or
72    not get_option('tests').disabled())
73  firmware_source += 'lpc_nuvoton.cpp'
74endif
75
76if (get_option('p2a-type') == 'aspeed-p2a' or
77    not get_option('tests').disabled())
78  firmware_source += 'pci_handler.cpp'
79endif
80
81if get_option('p2a-type') == 'nuvoton-p2a-vga'
82  firmware_source += 'pci_nuvoton_handler.cpp'
83endif
84
85if get_option('p2a-type') == 'nuvoton-p2a-mbox'
86  firmware_source += 'pci_nuvoton_handler.cpp'
87endif
88
89if get_option('net-bridge')
90  firmware_source += 'net_handler.cpp'
91endif
92
93firmware_pre = declare_dependency(
94  include_directories: [root_inc, bmc_inc, firmware_inc],
95  dependencies: [
96    dependency('sdbusplus', fallback: ['sdbusplus', 'sdbusplus_dep']),
97    common_dep,
98    blobs_dep,
99    sys_dep,
100  ])
101
102firmware_lib = static_library(
103  'firmwareblob',
104  firmware_source,
105  conf_h,
106  implicit_include_directories: false,
107  dependencies: firmware_pre)
108
109firmware_dep = declare_dependency(
110  link_with: firmware_lib,
111  dependencies: firmware_pre)
112
113shared_module(
114  'firmwareblob',
115  'main.cpp',
116  implicit_include_directories: false,
117  dependencies: [
118    firmware_dep,
119    dependency('libipmid'),
120  ],
121  install: true,
122  install_dir: get_option('libdir') / 'blob-ipmid')
123
124if not get_option('tests').disabled()
125  subdir('test')
126endif
127