Andrew Jeffery | 1d72cfa | 2022-01-20 07:53:37 +1030 | [diff] [blame] | 1 | project('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 Jeffery | 8609469 | 2022-01-13 17:15:15 +1030 | [diff] [blame] | 9 | |
| 10 | config = configuration_data() |
| 11 | debug_trigger_deps = [] |
Andrew Jeffery | 11cd254 | 2021-05-03 11:03:30 +0930 | [diff] [blame] | 12 | |
| 13 | if 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 Jeffery | 8609469 | 2022-01-13 17:15:15 +1030 | [diff] [blame] | 20 | debug_trigger_deps += dependency('libsystemd') |
Andrew Jeffery | 11cd254 | 2021-05-03 11:03:30 +0930 | [diff] [blame] | 21 | endif |
| 22 | |
Andrew Jeffery | 8609469 | 2022-01-13 17:15:15 +1030 | [diff] [blame] | 23 | config.set10('HAVE_SYSTEMD', get_option('systemd')) |
| 24 | config_h = configure_file(configuration: config, output: 'config.h') |
| 25 | |
Andrew Jeffery | 11cd254 | 2021-05-03 11:03:30 +0930 | [diff] [blame] | 26 | udev = dependency('udev') |
| 27 | udevdir = udev.get_pkgconfig_variable('udevdir') |
Andrew Jeffery | 11cd254 | 2021-05-03 11:03:30 +0930 | [diff] [blame] | 28 | |
Andrew Jeffery | 2001715 | 2021-06-10 11:16:58 +0930 | [diff] [blame] | 29 | triggers = get_option('triggers') |
| 30 | foreach 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 Jeffery | 11cd254 | 2021-05-03 11:03:30 +0930 | [diff] [blame] | 35 | endforeach |
Andrew Jeffery | 8609469 | 2022-01-13 17:15:15 +1030 | [diff] [blame] | 36 | |
| 37 | executable('debug-trigger', 'main.c', config_h, |
| 38 | dependencies: debug_trigger_deps, |
| 39 | install: true) |