-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
71 lines (55 loc) · 1.54 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
64
65
66
67
68
69
70
71
include /usr/share/dpkg/pkg-info.mk
include /usr/share/dpkg/architecture.mk
PACKAGE=proxmox-mail-forward
BUILDDIR ?= $(PACKAGE)-$(DEB_VERSION)
DSC=rust-$(PACKAGE)_$(DEB_VERSION_UPSTREAM).dsc
DEB=$(PACKAGE)_$(DEB_VERSION)_$(DEB_HOST_ARCH).deb
DBG_DEB=$(PACKAGE)-dbgsym_$(DEB_VERSION)_$(DEB_HOST_ARCH).deb
DEBS=$(DEB) $(DBG_DEB)
ifeq ($(BUILD_MODE), release)
CARGO_BUILD_ARGS += --release
COMPILEDIR := target/release
else
COMPILEDIR := target/debug
endif
CARGO ?= cargo
$(BUILDDIR):
rm -rf $@ [email protected] && mkdir [email protected]
cp -a debian Cargo.toml src Makefile .cargo [email protected]
rm -f [email protected]/Cargo.lock
find [email protected]/debian -name "*.hint" -delete
mv [email protected] $@
.PHONY: deb dsc
$(DEBS): deb
deb: $(BUILDDIR)
cd $(BUILDDIR); dpkg-buildpackage -b -us -uc
lintian $(DEBS)
dsc: clean
$(MAKE) $(DSC)
lintian $(DSC)
$(DSC): $(BUILDDIR)
cd $(BUILDDIR); dpkg-buildpackage -S -us -uc -d
sbuild: $(DSC)
sbuild $<
.PHONY: dinstall
dinstall: $(DEBS)
dpkg -i $(DEBS)
.PHONY: cargo-build
cargo-build:
$(CARGO) build $(CARGO_BUILD_ARGS) \
--package proxmox-mail-forward \
--bin proxmox-mail-forward
install: cargo-build
install -dm755 $(DESTDIR)/usr/bin
$(CARGO) install
chmod u+s $(DESTDIR)/usr/bin/$(PACKAGE)
.PHONY: upload
upload: $(DEBS)
tar cf - $(DEBS) | ssh -X [email protected] -- upload --product "pve,pbs" --dist $(DEB_DISTRIBUTION) --arch $(DEB_HOST_ARCH)
.PHONY: distclean
distclean: clean
.PHONY: clean
clean:
cargo clean
rm -rf *.deb *.dsc *.buildinfo *.changes *.build rust-$(PACKAGE)*.tar.* $(PACKAGE)-[0-9]*/
find . -name '*~' -exec rm {} ';'