-
Notifications
You must be signed in to change notification settings - Fork 5
/
Makefile
63 lines (48 loc) · 1.62 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
60
61
62
63
NAME:=prefixdevname
MAJOR:=0
MINOR:=2
PATCH:=0
VERSION:=$(MAJOR).$(MINOR).$(PATCH)
ARCHIVE:=$(NAME)-$(VERSION).tar.gz
VENDOR:=$(NAME)-$(VERSION)-vendor.tar.gz
FEDORA_VERSION:=rawhide
all: release
debug:
@cargo build
release:
@cargo build --release
.PHONY: check install uninstall dist srpm rpm clean vendor
check:
@unshare -m -u -r test/test.sh
install:
mkdir -p $(DESTDIR)/usr/lib/udev/rules.d
mkdir -p $(DESTDIR)/usr/lib/dracut/modules.d/71prefixdevname
mkdir -p $(DESTDIR)/usr/lib/dracut/modules.d/71prefixdevname-tools
install -p -m 0755 target/release/$(NAME) $(DESTDIR)/usr/lib/udev/
install -p -m 644 rules/71-prefixdevname.rules $(DESTDIR)/usr/lib/udev/rules.d/
install -p -m 0755 dracut/71prefixdevname/module-setup.sh $(DESTDIR)/usr/lib/dracut/modules.d/71prefixdevname/
install -p -m 0755 dracut/71prefixdevname-tools/module-setup.sh $(DESTDIR)/usr/lib/dracut/modules.d/71prefixdevname-tools/
uninstall:
rm -f $(DESTDIR)/usr/lib/udev/$(NAME)
rm -f $(DESTDIR)/usr/lib/udev/rules/71-prefixdevname.rules
rm -rf $(DESTDIR)/usr/lib/dracut/modules.d/71prefixdevname
dist:
@git archive HEAD --prefix $(NAME)-$(VERSION)/ | gzip > $(ARCHIVE)
vendor:
@rm -rf vendor
@cargo vendor
@rm -f vendor/winapi*/lib/*
@tar -czf $(VENDOR) vendor
srpm: dist
@cp $(ARCHIVE) $(VENDOR) ~/rpmbuild/SOURCES
@cp redhat/$(NAME).spec ~/rpmbuild/SPECS
@rpmbuild -bs ~/rpmbuild/SPECS/$(NAME).spec
rpm: srpm
$(eval SRPM:=$(shell ls ~/rpmbuild/SRPMS/$(NAME)*.src.rpm))
@rpmbuild --rebuild $(SRPM)
mock-rpm: srpm
$(eval SRPM:=$(shell ls ~/rpmbuild/SRPMS/$(NAME)*.src.rpm))
@mock -r --rebuild $(SRPM)
clean:
@cargo clean
@rm -f $(ARCHIVE)