]> git.proxmox.com Git - pve-lxc-syscalld.git/blob - Makefile
debian/ fixup
[pve-lxc-syscalld.git] / Makefile
1 include /usr/share/dpkg/architecture.mk
2 include /usr/share/dpkg/pkg-info.mk
3
4 include defines.mk
5
6 GITVERSION:=$(shell git rev-parse HEAD)
7
8 SUBDIRS := etc
9
10 ifeq ($(BUILD_MODE), release)
11 CARGO_BUILD_ARGS += --release
12 COMPILEDIR := target/release
13 else
14 COMPILEDIR := target/debug
15 endif
16
17 SERVICE_BIN := pve-lxc-syscalld
18
19 COMPILED_BINS := \
20 $(addprefix $(COMPILEDIR)/,$(SERVICE_BIN))
21
22 DEB=$(PACKAGE)_$(DEB_VERSION)_$(DEB_HOST_ARCH).deb
23 DSC=rust-$(PACKAGE)_$(DEB_VERSION).dsc
24
25 all: cargo-build $(SUBDIRS)
26
27 .PHONY: $(SUBDIRS)
28 $(SUBDIRS):
29 $(MAKE) -C $@
30
31 .PHONY: cargo-build
32 cargo-build:
33 cargo build $(CARGO_BUILD_ARGS)
34
35 .PHONY: test
36 test:
37 cargo test
38 cargo fmt --all -- --check
39 cargo clippy
40
41 $(COMPILED_BINS): cargo-build
42
43 install: $(COMPILED_BINS)
44 install -dm755 $(DESTDIR)$(LIBEXECDIR)/proxmox-backup
45 $(foreach i,$(SERVICE_BIN), \
46 install -m755 $(COMPILEDIR)/$(i) $(DESTDIR)$(LIBEXECDIR)/proxmox-backup/ ;)
47
48 .PHONY: build
49 build:
50 rm -rf build
51 debcargo package \
52 --config debian/debcargo.toml \
53 --changelog-ready \
54 --no-overlay-write-back \
55 --directory build \
56 pve-lxc-syscalld \
57 $(shell dpkg-parsechangelog -l debian/changelog -SVersion | sed -e 's/-.*//')
58 sed -e '1,/^$$/ ! d' build/debian/control > build/debian/control.src
59 cat build/debian/control.src build/debian/control.in > build/debian/control
60 rm build/debian/control.in build/debian/control.src
61 rm build/Cargo.lock
62 find build/debian -name "*.hint" -delete
63 $(foreach i,$(SUBDIRS), \
64 $(MAKE) -C build/$(i) clean ;)
65
66 .PHONY: deb
67 deb: $(DEB)
68 $(DEB): build
69 cd build; dpkg-buildpackage -b -us -uc --no-pre-clean --build-profiles=nodoc
70 lintian $(DEB)
71
72 .PHONY: dsc
73 dsc: $(DSC)
74 $(DSC): build
75 cd build; dpkg-buildpackage -S -us -uc -d -nc
76 lintian $(DSC)
77
78 clean:
79 $(foreach i,$(SUBDIRS), \
80 $(MAKE) -C $(i) clean ;)
81 cargo clean
82 rm -rf *.deb *.dsc *.tar.gz *.buildinfo *.changes build