xref: /openbmc/phosphor-ipmi-flash/bmc/firmware-handler/meson.build (revision 32e9ea165419725691d5e54be60073bc2cc4f7e0)
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',
28    )
29endforeach
30
31# temp files
32install_data(
33    'phosphor-ipmi-flash.conf',
34    install_dir: get_option('libdir') / 'tmpfiles.d',
35)
36
37# systemd configs
38systemd_data = [
39    'phosphor-ipmi-flash-bmc-prepare.target',
40    'phosphor-ipmi-flash-bmc-verify.target',
41    'phosphor-ipmi-flash-bmc-update.target',
42]
43
44if get_option('host-bios')
45    systemd_data += [
46        'phosphor-ipmi-flash-bios-prepare.target',
47        'phosphor-ipmi-flash-bios-verify.target',
48        'phosphor-ipmi-flash-bios-update.target',
49    ]
50endif
51
52systemd = dependency('systemd')
53if systemd.found()
54    foreach data : systemd_data
55        configure_file(
56            input: data + '.in',
57            output: data,
58            configuration: conf_data,
59            install: true,
60            install_dir: systemd.get_variable('systemdsystemunitdir'),
61        )
62    endforeach
63endif
64
65firmware_source = [
66    'firmware_handlers_builder.cpp',
67    'firmware_handler.cpp',
68    'lpc_handler.cpp',
69]
70
71if (get_option('lpc-type') == 'aspeed-lpc' or
72get_option('tests').allowed())
73    firmware_source += 'lpc_aspeed.cpp'
74endif
75
76if (get_option('lpc-type') == 'nuvoton-lpc' or
77get_option('tests').allowed())
78    firmware_source += 'lpc_nuvoton.cpp'
79endif
80
81if (get_option('p2a-type') == 'aspeed-p2a' or
82get_option('tests').allowed())
83    firmware_source += 'pci_handler.cpp'
84endif
85
86if get_option('p2a-type') == 'nuvoton-p2a-vga'
87    firmware_source += 'pci_nuvoton_handler.cpp'
88endif
89
90if get_option('p2a-type') == 'nuvoton-p2a-mbox'
91    firmware_source += 'pci_nuvoton_handler.cpp'
92endif
93
94if get_option('net-bridge')
95    firmware_source += 'net_handler.cpp'
96endif
97
98firmware_pre = declare_dependency(
99    include_directories: [root_inc, bmc_inc, firmware_inc],
100    dependencies: [
101        dependency('sdbusplus', fallback: ['sdbusplus', 'sdbusplus_dep']),
102        common_dep,
103        blobs_dep,
104        sys_dep,
105    ],
106)
107
108firmware_lib = static_library(
109    'firmwareblob',
110    firmware_source,
111    conf_h,
112    implicit_include_directories: false,
113    dependencies: firmware_pre,
114)
115
116firmware_dep = declare_dependency(
117    link_with: firmware_lib,
118    dependencies: firmware_pre,
119)
120
121shared_module(
122    'firmwareblob',
123    'main.cpp',
124    implicit_include_directories: false,
125    dependencies: [firmware_dep, dependency('libipmid')],
126    install: true,
127    install_dir: get_option('libdir') / 'blob-ipmid',
128)
129
130if get_option('tests').allowed()
131    subdir('test')
132endif
133