File: Makefile

package info (click to toggle)
hdmi2usb-mode-switch 0.0.0%2Bgit20161124-2
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 1,368 kB
  • ctags: 246
  • sloc: python: 2,376; makefile: 157; ansic: 68; xml: 61; sh: 57
file content (60 lines) | stat: -rw-r--r-- 1,672 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
53
54
55
56
57
58
59
60

# udev rules
install:
	@for RULE in *-hdmi2usb*.rules; do \
		echo "Installing $$RULE to /etc/udev/rules.d/$$RULE"; \
		sudo cp $$RULE /etc/udev/rules.d/$$RULE; \
		sudo chmod 644 /etc/udev/rules.d/$$RULE; \
		sudo chown root:root /etc/udev/rules.d/$$RULE; \
	done
	@for HELP in hdmi2usb-*-helper.sh; do \
		echo "Installing $$HELP to /etc/udev/rules.d/$$HELP"; \
		sudo cp $$HELP /etc/udev/rules.d/$$HELP; \
		sudo chmod 755 /etc/udev/rules.d/$$HELP; \
		sudo chown root:root /etc/udev/rules.d/$$HELP; \
	done
	echo "udev rules installed; 'make reload' to reload udev rules"

reload:
	sudo udevadm control --reload-rules

install-reload:
	make install
	make reload

check:
	@for RULE in *-hdmi2usb*.rules; do \
		echo -n "Checking installed $$RULE.."; \
		[ -e /etc/udev/rules.d/$$RULE ] || exit 1; \
		diff -u $$RULE /etc/udev/rules.d/$$RULE || exit 1; \
		echo " Good!"; \
	done
	@for HELP in hdmi2usb-*-helper.sh; do \
		echo -n "Checking installed $$HELP.."; \
		[ -e /etc/udev/rules.d/$$HELP ] || exit 1; \
		diff -u $$HELP /etc/udev/rules.d/$$HELP || exit 1; \
		echo " Good!"; \
	done
	@if ! id | grep -qF '(video)'; then \
		echo "Not a member of the video group"; exit 1; \
	fi

test:
	@for HELP in hdmi2usb-*-helper.sh; do \
		echo "Checking $$HELP.."; \
		SHELL=/bin/posh posh $$HELP test || exit 1; \
		echo " Good!"; \
	done

uninstall:
	sudo rm -f /etc/udev/rules.d/*hdmi2usb*

examine:
	make uninstall
	make install
	@echo -e "\n\n\n============================================="
	@udevadm test '/sys/class/tty/ttyACM0'
	@echo -e "\n\n\n============================================="
	@udevadm test '/sys/class/video4linux/video0'

.DEFAULT_GOAL := check