]> git.proxmox.com Git - proxmox-mail-forward.git/blob - Makefile
buildsys: use full DEB_VERSION and correct DEB_HOST_ARCH
[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
30 $(DEBS): deb
31 deb: $(BUILDDIR)
32 cd $(BUILDDIR); dpkg-buildpackage -b -us -uc --no-pre-clean
33 lintian $(DEBS)
34
35 .PHONY: dsc
36 dsc: $(DSC)
37 $(DSC): $(BUILDDIR)
38 cd $(BUILDDIR); dpkg-buildpackage -S -us -uc -d -nc
39 lintian $(DSC)
40
41 .PHONY: dinstall
42 dinstall: $(DEBS)
43 dpkg -i $(DEBS)
44
45 .PHONY: cargo-build
46 cargo-build:
47 $(CARGO) build $(CARGO_BUILD_ARGS) \
48 --package proxmox-mail-forward \
49 --bin proxmox-mail-forward
50
51 install: cargo-build
52 install -dm755 $(DESTDIR)/usr/bin
53 install -m4755 -o root -g root $(COMPILEDIR)/proxmox-mail-forward $(DESTDIR)/usr/bin/proxmox-mail-forward
54
55 .PHONY: upload
56 upload: $(DEBS)
57 tar cf - $(DEBS) | ssh -X repoman@repo.proxmox.com -- upload --product "pve,pbs" --dist bullseye --arch $(DEB_HOST_ARCH)
58
59 .PHONY: distclean
60 distclean: clean
61
62 .PHONY: clean
63 clean:
64 cargo clean
65 rm -rf *.deb *.buildinfo *.changes *.dsc rust-$(PACKAGE)_*.tar.?z $(BUILDDIR) $(BUILDDIR_TMP)
66 find . -name '*~' -exec rm {} ';'