1# SPDX-License-Identifier: LGPL-2.1-or-later
2
3install_data(
4        'README',
5        install_dir : udevrulesdir)
6
7rules = [
8        [files('60-autosuspend.rules',
9               '60-block.rules',
10               '60-cdrom_id.rules',
11               '60-drm.rules',
12               '60-evdev.rules',
13               '60-fido-id.rules',
14               '60-input-id.rules',
15               '60-persistent-alsa.rules',
16               '60-persistent-input.rules',
17               '60-persistent-storage.rules',
18               '60-persistent-storage-tape.rules',
19               '60-persistent-v4l.rules',
20               '60-sensor.rules',
21               '60-serial.rules',
22               '70-camera.rules',
23               '70-joystick.rules',
24               '70-mouse.rules',
25               '70-touchpad.rules',
26               '75-net-description.rules',
27               '75-probe_mtd.rules',
28               '78-sound-card.rules',
29               '80-net-setup-link.rules',
30               '81-net-dhcp.rules',
31              )],
32
33        [files('80-drivers.rules'),
34         conf.get('HAVE_KMOD') == 1],
35
36        [files('70-memory.rules'),
37         dmi_arches.contains(host_machine.cpu_family())],
38
39        [files('70-power-switch.rules'),
40         enable_logind],
41]
42
43all_rules = []
44
45foreach tuple : rules
46        if tuple.length() == 1 or tuple[1]
47                install_data(tuple[0],
48                             install_dir : udevrulesdir)
49                all_rules += tuple[0]
50        endif
51endforeach
52
53rules_in = [
54        ['50-udev-default.rules'],
55        ['64-btrfs.rules'],
56        ['99-systemd.rules'],
57
58        ['70-uaccess.rules',   enable_logind and conf.get('HAVE_ACL') == 1],
59        ['71-seat.rules',      enable_logind],
60        ['73-seat-late.rules', enable_logind],
61
62        ['90-vconsole.rules',  conf.get('ENABLE_VCONSOLE') == 1],
63]
64
65foreach tuple : rules_in
66        want = tuple.length() == 1 or tuple[1]
67
68        rule = custom_target(
69                tuple[0],
70                input : tuple[0] + '.in',
71                output: tuple[0],
72                command : [jinja2_cmdline, '@INPUT@', '@OUTPUT@'],
73                install : want,
74                install_dir : udevrulesdir)
75
76        if want
77                all_rules += rule
78        endif
79endforeach
80