summaryrefslogtreecommitdiff
path: root/Makefile
blob: 8854f27afddba0ecd321e96410cbafcfe5bacbd8 (plain)
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
PROG        = usb-modeswitch-data
VERS        = 20170806
RM          = /bin/rm -f
PREFIX      = $(DESTDIR)/usr
ETCDIR      = $(DESTDIR)/etc
RULESDIR    = $(DESTDIR)/lib/udev/rules.d


.PHONY:     clean

all: 40-usb_modeswitch.rules

clean:
	$(RM) 40-usb_modeswitch.rules

install: all files-install db-install

install-packed: files-install db-install-packed

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

40-usb_modeswitch.rules:
	./gen-rules.tcl

db-install: files-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; find * -print0 | LC_ALL=C sort -z | tar --no-recursion --null --files-from=- --mode=go=rX,u+rw,a-s -cf ../configPack.tar
	gzip -f9n ./configPack.tar
	install --mode=644 -t $(PREFIX)/share/usb_modeswitch ./configPack.tar.gz
	rm -f ./configPack.tar.gz

uninstall: files-uninstall

files-uninstall:
	$(RM) $(RULESDIR)/40-usb_modeswitch.rules
	$(RM) -R $(PREFIX)/share/usb_modeswitch

.PHONY:    clean install uninstall