blob: a75e1223f63e508f9af2fe6b6d37f7bc15850631 [file] [log] [blame]
Andrew Jeffery1d72cfa2022-01-20 07:53:37 +10301project('debug-trigger', 'c',
2 license: 'Apache-2.0',
3 version: '0.1',
4 default_options: [
5 'warning_level=3',
6 'werror=true',
7 'c_std=gnu18',
8 ])
Andrew Jeffery86094692022-01-13 17:15:15 +10309
10config = configuration_data()
11debug_trigger_deps = []
Andrew Jeffery11cd2542021-05-03 11:03:30 +093012
13if get_option('systemd')
14 systemd = dependency('systemd')
15 unitdir = systemd.get_pkgconfig_variable('systemdsystemunitdir')
16 configure_file(input: 'systemd/system/debug-trigger@.service',
17 output: 'debug-trigger@.service',
18 copy: true,
19 install_dir: unitdir)
Andrew Jeffery86094692022-01-13 17:15:15 +103020 debug_trigger_deps += dependency('libsystemd')
Andrew Jeffery11cd2542021-05-03 11:03:30 +093021endif
22
Andrew Jeffery86094692022-01-13 17:15:15 +103023config.set10('HAVE_SYSTEMD', get_option('systemd'))
24config_h = configure_file(configuration: config, output: 'config.h')
25
Andrew Jeffery11cd2542021-05-03 11:03:30 +093026udev = dependency('udev')
27udevdir = udev.get_pkgconfig_variable('udevdir')
Andrew Jeffery11cd2542021-05-03 11:03:30 +093028
Andrew Jeffery20017152021-06-10 11:16:58 +093029triggers = get_option('triggers')
30foreach trigger : triggers
31 src = 'udev/rules.d/debug-trigger-' + trigger + '.rules'
32 dst = 'debug-trigger-' + trigger + '.rules'
33 rulesdir = udevdir + '/rules.d'
34 configure_file(input: src, output: dst, copy: true, install_dir: rulesdir)
Andrew Jeffery11cd2542021-05-03 11:03:30 +093035endforeach
Andrew Jeffery86094692022-01-13 17:15:15 +103036
37executable('debug-trigger', 'main.c', config_h,
38 dependencies: debug_trigger_deps,
39 install: true)