-
Notifications
You must be signed in to change notification settings - Fork 41
/
Makefile
33 lines (26 loc) · 1.48 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
ROOT_DIR := $(shell dirname "$(realpath $(MAKEFILE_LIST))")
.PHONY = test install dist rpm srpm clean
test:
cd $(ROOT_DIR) && \
tox --current-env
install:
if test x"$(DESTDIR)" = x; then echo "DESTDIR unset."; exit 1; fi
mkdir -p $(DESTDIR)
python3 setup.py bdist_dumb
tar zxvmf dist/zfs-tools-*.linux-*.tar.gz -C $(DESTDIR)
mv $(DESTDIR)/usr/local/* $(DESTDIR)/usr
rmdir $(DESTDIR)/usr/local
mkdir -p $(DESTDIR)/etc/sudoers.d
cp contrib/sudoers.zfs-tools $(DESTDIR)/etc/sudoers.d/zfs-shell
chmod 440 $(DESTDIR)/etc/sudoers.d/zfs-shell
clean:
cd $(ROOT_DIR) && find -name '*~' -print0 | xargs -0r rm -fv && rm -fr *.tar.gz *.rpm src/*.egg-info *.egg-info dist build
dist: clean
cd $(ROOT_DIR) || exit $$? ; python3 -m build
srpm: dist
@which rpmbuild || { echo 'rpmbuild is not available. Please install the rpm-build package with the command `dnf install rpm-build` to continue, then rerun this step.' ; exit 1 ; }
cd $(ROOT_DIR) || exit $$? ; rpmbuild --define "_srcrpmdir ." -ts dist/`rpmspec -q --queryformat '%{name}-%{version}.tar.gz\n' *spec | head -1`
rpm: dist
@which rpmbuild || { echo 'rpmbuild is not available. Please install the rpm-build package with the command `dnf install rpm-build` to continue, then rerun this step.' ; exit 1 ; }
cd $(ROOT_DIR) || exit $$? ; rpmbuild --define "_srcrpmdir ." --define "_rpmdir builddir.rpm" -ta dist/`rpmspec -q --queryformat '%{name}-%{version}.tar.gz\n' *spec | head -1`
cd $(ROOT_DIR) ; mv -f builddir.rpm/*/* . && rm -rf builddir.rpm