-
Notifications
You must be signed in to change notification settings - Fork 14
/
Copy pathMakefile
59 lines (46 loc) · 1.55 KB
/
Makefile
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
PROG = usb-modeswitch-data
VERS = 20120531
RM = /bin/rm -f
PREFIX = $(DESTDIR)/usr
ETCDIR = $(DESTDIR)/etc
RULESDIR = $(DESTDIR)/lib/udev/rules.d
.PHONY: clean
all:
clean:
install: files-install db-install rules-reload
install-packed: files-install db-install-packed rules-reload
files-install:
install -d $(PREFIX)/share/usb_modeswitch
install -d $(ETCDIR)/usb_modeswitch.d
install -D --mode=644 40-usb_modeswitch.rules $(RULESDIR)/40-usb_modeswitch.rules
db-install:
install --mode=644 -t $(PREFIX)/share/usb_modeswitch ./usb_modeswitch.d/*
db-install-packed:
@# Create a compressed tar without gzip timestamp, so tar.gz
@# differs only if content is different
cd ./usb_modeswitch.d; tar -cf ../configPack.tar *
gzip -f9n ./configPack.tar
install --mode=644 -t $(PREFIX)/share/usb_modeswitch ./configPack.tar.gz
rm -f ./configPack.tar.gz
rules-reload:
@if [ -f $(ETCDIR)/issue ]; then \
UDEVADM=`which udevadm 2>/dev/null`; \
if [ "x$$UDEVADM" != "x" ]; then \
UDEVADM_VER=`$$UDEVADM -V 2>/dev/null`; \
if [ -z $$UDEVADM_VER ]; then \
UDEVADM_VER=`$$UDEVADM --version 2>/dev/null`; \
fi; \
if [ $$UDEVADM_VER -gt 127 ]; then \
$$UDEVADM control --reload-rules; \
else \
$$UDEVADM control --reload_rules; \
fi \
elif [ `which udevcontrol 2>/dev/null` ]; then \
`which udevcontrol` reload_rules; \
fi \
fi
uninstall: files-uninstall rules-reload
files-uninstall:
$(RM) $(RULESDIR)/40-usb_modeswitch.rules
$(RM) -R $(PREFIX)/share/usb_modeswitch
.PHONY: clean install uninstall