File: Makefile

package info (click to toggle)
xr-hardware 1.1.1-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 220 kB
  • sloc: python: 244; makefile: 40
file content (52 lines) | stat: -rw-r--r-- 1,283 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
#!/usr/bin/env make -f
# Copyright 2020-2022 Collabora, Ltd
# SPDX-License-Identifier: BSL-1.0
#
# Original Author: Rylie Pavlik <rylie.pavlik@collabora.com>

RULES_FILE := 70-xrhardware.rules
HWDB_FILE := 70-xrhardware.hwdb
HWDB_RULES_FILE := 70-xrhardware-hwdb.rules

INSTALL ?= install

PYTHON ?= python3

all: $(RULES_FILE) $(HWDB_FILE) $(HWDB_RULES_FILE)
.PHONY: all

test:
	$(PYTHON) test-db.py

lint: test
	$(PYTHON) -m flake8 *.py xrhardware/*.py
	black .
.PHONY: lint

$(RULES_FILE): make-udev-rules.py xrhardware/db.py xrhardware/generate.py
	$(PYTHON) $< > $@
$(HWDB_FILE): make-hwdb-file.py xrhardware/db.py xrhardware/generate.py
	$(PYTHON) $< > $@
$(HWDB_RULES_FILE): make-hwdb-rules-file.py xrhardware/generate.py
	$(PYTHON) $< > $@

clean:
	-rm -f $(RULES_FILE) $(HWDB_FILE) $(HWDB_RULES_FILE)
.PHONY: clean

# Currently does nothing, since the generated files get committed.
clean_package:
.PHONY: clean_package

RULES_DIR ?= /etc/udev/rules.d

install: $(RULES_FILE)
	$(INSTALL) -d $(DESTDIR)$(RULES_DIR)/
	$(INSTALL) -m 644 -D $(RULES_FILE) $(DESTDIR)$(RULES_DIR)/
.PHONY: install

install_package: $(RULES_FILE)
	$(INSTALL) -d $(DESTDIR)$(PREFIX)/lib/udev/rules.d
	$(INSTALL) -m 644 -D $(RULES_FILE) $(DESTDIR)$(PREFIX)/lib/udev/rules.d/
.PHONY: install_package