]> git.proxmox.com Git - proxmox-mail-forward.git/blob - Makefile
bump version to 0.2.0
[proxmox-mail-forward.git] / Makefile
1 include /usr/share/dpkg/pkg-info.mk
2 include /usr/share/dpkg/architecture.mk
3
4 PACKAGE=proxmox-mail-forward
5 BUILDDIR ?= $(PACKAGE)-$(DEB_VERSION)
6
7 DSC=rust-$(PACKAGE)_$(DEB_VERSION_UPSTREAM).dsc
8 DEB=$(PACKAGE)_$(DEB_VERSION)_$(DEB_HOST_ARCH).deb
9 DBG_DEB=$(PACKAGE)-dbgsym_$(DEB_VERSION)_$(DEB_HOST_ARCH).deb
10
11 DEBS=$(DEB) $(DBG_DEB)
12
13 ifeq ($(BUILD_MODE), release)
14 CARGO_BUILD_ARGS += --release
15 COMPILEDIR := target/release
16 else
17 COMPILEDIR := target/debug
18 endif
19
20 CARGO ?= cargo
21
22 $(BUILDDIR):
23 rm -rf $@ $@.tmp && mkdir $@.tmp
24 cp -a debian Cargo.toml src Makefile .cargo $@.tmp
25 rm -f $@.tmp/Cargo.lock
26 find $@.tmp/debian -name "*.hint" -delete
27 mv $@.tmp $@
28
29 .PHONY: deb dsc
30 $(DEBS): deb
31 deb: $(BUILDDIR)
32 cd $(BUILDDIR); dpkg-buildpackage -b -us -uc
33 lintian $(DEBS)
34
35 dsc: clean
36 $(MAKE) $(DSC)
37 lintian $(DSC)
38
39 $(DSC): $(BUILDDIR)
40 cd $(BUILDDIR); dpkg-buildpackage -S -us -uc -d
41
42 sbuild: $(DSC)
43 sbuild $<
44
45 .PHONY: dinstall
46 dinstall: $(DEBS)
47 dpkg -i $(DEBS)
48
49 .PHONY: cargo-build
50 cargo-build:
51 $(CARGO) build $(CARGO_BUILD_ARGS) \
52 --package proxmox-mail-forward \
53 --bin proxmox-mail-forward
54
55 install: cargo-build
56 install -dm755 $(DESTDIR)/usr/bin
57 install -m4755 -o root -g root $(COMPILEDIR)/proxmox-mail-forward $(DESTDIR)/usr/bin/proxmox-mail-forward
58
59 .PHONY: upload
60 upload: $(DEBS)
61 tar cf - $(DEBS) | ssh -X repoman@repo.proxmox.com -- upload --product "pve,pbs" --dist bullseye --arch $(DEB_HOST_ARCH)
62
63 .PHONY: distclean
64 distclean: clean
65
66 .PHONY: clean
67 clean:
68 cargo clean
69 rm -rf *.deb *.dsc *.buildinfo *.changes *.build rust-$(PACKAGE)*.tar.* $(PACKAGE)-[0-9]*/
70 find . -name '*~' -exec rm {} ';'