]> git.proxmox.com Git - proxmox-offline-mirror.git/blob - Makefile
pool: remove double quoting
[proxmox-offline-mirror.git] / Makefile
1 include /usr/share/dpkg/pkg-info.mk
2 include /usr/share/dpkg/architecture.mk
3 include defines.mk
4
5 PACKAGE=proxmox-offline-mirror
6 BUILDDIR ?= $(PACKAGE)-$(DEB_VERSION_UPSTREAM)
7 BUILDDIR_TMP ?= $(BUILDDIR).tmp
8
9 SUBDIRS := docs
10
11 DEB=$(PACKAGE)_$(DEB_VERSION_UPSTREAM_REVISION)_$(DEB_BUILD_ARCH).deb
12 LIB_DEB=librust-$(PACKAGE)-dev_$(DEB_VERSION_UPSTREAM_REVISION)_$(DEB_BUILD_ARCH).deb
13 DBG_DEB=$(PACKAGE)-dbgsym_$(DEB_VERSION_UPSTREAM_REVISION)_$(DEB_BUILD_ARCH).deb
14 DOC_DEB=$(PACKAGE)-docs_$(DEB_VERSION_UPSTREAM_REVISION)_all.deb
15 DSC=rust-$(PACKAGE)_$(DEB_VERSION_UPSTREAM_REVISION).dsc
16
17 ifeq ($(BUILD_MODE), release)
18 CARGO_BUILD_ARGS += --release
19 COMPILEDIR := target/release
20 else
21 COMPILEDIR := target/debug
22 endif
23
24 all: cargo-build $(SUBDIRS)
25
26 .PHONY: cargo-build
27 cargo-build:
28 cargo build $(CARGO_BUILD_ARGS)
29
30 .PHONY: $(SUBDIRS)
31 $(SUBDIRS):
32 $(MAKE) -C $@
33
34 .PHONY: build
35 build:
36 rm -rf $(BUILDDIR) $(BUILDDIR_TMP); mkdir $(BUILDDIR_TMP)
37 rm -f debian/control
38 debcargo package \
39 --config debian/debcargo.toml \
40 --changelog-ready \
41 --no-overlay-write-back \
42 --directory $(BUILDDIR_TMP) \
43 $(PACKAGE) \
44 $(shell dpkg-parsechangelog -l debian/changelog -SVersion | sed -e 's/-.*//')
45 cat $(BUILDDIR_TMP)/debian/control debian/control.docs > debian/control
46 cp -a debian/control $(BUILDDIR_TMP)/debian/control
47 rm -f $(BUILDDIR_TMP)/Cargo.lock
48 find $(BUILDDIR_TMP)/debian -name "*.hint" -delete
49 mv $(BUILDDIR_TMP) $(BUILDDIR)
50
51 .PHONY: deb
52 deb: $(DEB)
53 $(DEB): build
54 cd $(BUILDDIR); dpkg-buildpackage -b -us -uc --no-pre-clean
55 lintian $(DEB)
56
57 .PHONY: dsc
58 dsc: $(DSC)
59 $(DSC): build
60 cd $(BUILDDIR); dpkg-buildpackage -S -us -uc -d -nc
61 lintian $(DSC)
62
63 .PHONY: dinstall
64 dinstall: $(DEB)
65 dpkg -i $(DEB) $(DBG_DEB) $(DOC_DEB)
66
67 .PHONY: upload
68 upload: $(DEB)
69 tar cf - $(DEB) $(DBG_DEB) $(DOC_DEB) | ssh -X repoman@repo.proxmox.com -- upload --product pve,pmg,pbs,pbs-client --dist bullseye --arch $(DEB_BUILD_ARCH)
70
71 .PHONY: distclean
72 distclean: clean
73
74 .PHONY: clean
75 clean:
76 cargo clean
77 rm -rf *.deb *.buildinfo *.changes *.dsc rust-$(PACKAGE)_*.tar.?z $(BUILDDIR) $(BUILDDIR_TMP)
78 find . -name '*~' -exec rm {} ';'