]> git.proxmox.com Git - proxmox-offline-mirror.git/blob - Makefile
bump version to 0.6.6
[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
8 SUBDIRS := docs
9
10 DEB=$(PACKAGE)_$(DEB_VERSION_UPSTREAM_REVISION)_$(DEB_HOST_ARCH).deb
11 HELPER_DEB=$(PACKAGE)-helper_$(DEB_VERSION_UPSTREAM_REVISION)_$(DEB_HOST_ARCH).deb
12 DBG_DEB=$(PACKAGE)-dbgsym_$(DEB_VERSION_UPSTREAM_REVISION)_$(DEB_HOST_ARCH).deb
13 HELPER_DBG_DEB=$(PACKAGE)-helper-dbgsym_$(DEB_VERSION_UPSTREAM_REVISION)_$(DEB_HOST_ARCH).deb
14 DOC_DEB=$(PACKAGE)-docs_$(DEB_VERSION_UPSTREAM_REVISION)_all.deb
15 DSC=rust-$(PACKAGE)_$(DEB_VERSION_UPSTREAM_REVISION).dsc
16
17 DEBS = $(DEB) $(HELPER_DEB) $(DBG_DEB) $(HELPER_DBG_DEB) $(DOC_DEB)
18
19 ifeq ($(BUILD_MODE), release)
20 CARGO_BUILD_ARGS += --release
21 COMPILEDIR := target/release
22 else
23 COMPILEDIR := target/debug
24 endif
25
26 USR_BIN := \
27 proxmox-offline-mirror \
28 proxmox-offline-mirror-helper
29
30 COMPILED_BINS := \
31 $(addprefix $(COMPILEDIR)/,$(USR_BIN))
32
33 all: cargo-build $(SUBDIRS)
34
35 .PHONY: cargo-build
36 cargo-build:
37 cargo build $(CARGO_BUILD_ARGS)
38
39 .PHONY: $(SUBDIRS)
40 $(SUBDIRS): cargo-build
41 $(MAKE) -C $@
42
43 $(COMPILED_BINS): cargo-build
44
45 install: $(COMPILED_BINS)
46 $(MAKE) -C docs install DESTDIR=../debian/proxmox-offline-mirror-docs
47 install -dm755 $(DESTDIR)$(BINDIR)
48 $(foreach i,$(USR_BIN), \
49 install -m755 $(COMPILEDIR)/$(i) $(DESTDIR)$(BINDIR)/ ;)
50
51 update-dcontrol: #$(BUILDDIR)
52 debcargo package \
53 --config debian/debcargo.toml \
54 --changelog-ready \
55 --no-overlay-write-back \
56 --directory $(BUILDDIR) \
57 $(PACKAGE) \
58 $(shell dpkg-parsechangelog -l debian/changelog -SVersion | sed -e 's/-.*//')
59 cat $(BUILDDIR)/debian/control debian/control.extra > debian/control
60 wrap-and-sort -t -k -f debian/control
61
62 .PHONY: build
63 build: $(BUILDDIR)
64 $(BUILDDIR):
65 rm -rf $@ $@.tmp; mkdir $@.tmp
66 cp -a src docs debian Cargo.toml Makefile defines.mk $@.tmp/
67 mv $@.tmp $@
68
69 .PHONY: deb
70 deb: $(DEB)
71 $(HELPER_DEB) $(DBG_DEB) $(HELPER_DBG_DEB) $(DOC_DEB): $(DEB)
72 $(DEB): $(BUILDDIR)
73 cd $(BUILDDIR); dpkg-buildpackage -b -us -uc --no-pre-clean
74 lintian $(DEB) $(DOC_DEB) $(HELPER_DEB)
75
76 .PHONY: dsc
77 dsc:
78 rm -rf $(BUILDDIR) $(DSC)
79 $(MAKE) $(DSC)
80 lintian $(DSC)
81 $(DSC): $(BUILDDIR)
82 cd $(BUILDDIR); dpkg-buildpackage -S -us -uc -d -nc
83
84 sbuild: $(DSC)
85 sbuild $<
86
87 .PHONY: dinstall
88 dinstall: $(DEB)
89 dpkg -i $(DEB) $(DBG_DEB) $(DOC_DEB)
90
91 .PHONY: upload
92 upload: UPLOAD_DIST ?= $(DEB_DISTRIBUTION)
93 upload: $(DEBS)
94 tar cf - $(DEBS) | ssh -X repoman@repo.proxmox.com -- upload --product pve,pmg,pbs,pbs-client --dist $(UPLOAD_DIST) --arch $(DEB_HOST_ARCH)
95
96 .PHONY: distclean
97 distclean: clean
98
99 .PHONY: clean
100 clean:
101 cargo clean
102 rm -f *.deb *.build *.buildinfo *.changes *.dsc rust-$(PACKAGE)*.tar*
103 rm -rf $(PACKAGE)-[0-9]*/
104 find . -name '*~' -exec rm {} ';'