]>
Commit | Line | Data |
---|---|---|
da0e1e40 | 1 | include /usr/share/dpkg/default.mk |
6285b251 | 2 | include defines.mk |
de779814 | 3 | |
e881b8a5 | 4 | PACKAGE := proxmox-backup |
da0e1e40 | 5 | ARCH := $(DEB_BUILD_ARCH) |
209bb433 | 6 | |
bb5c7707 | 7 | SUBDIRS := etc www docs |
13b77d10 | 8 | |
6285b251 WB |
9 | # Binaries usable by users |
10 | USR_BIN := \ | |
11 | proxmox-backup-client \ | |
7c4dd946 | 12 | pxar |
6285b251 WB |
13 | |
14 | # Binaries usable by admins | |
15 | USR_SBIN := proxmox-backup-manager | |
16 | ||
17 | # Binaries for services: | |
18 | SERVICE_BIN := \ | |
19 | proxmox-backup-api \ | |
20 | proxmox-backup-proxy | |
21 | ||
13b77d10 WB |
22 | ifeq ($(BUILD_MODE), release) |
23 | CARGO_BUILD_ARGS += --release | |
6285b251 | 24 | COMPILEDIR := target/release |
13b77d10 WB |
25 | else |
26 | COMPILEDIR := target/debug | |
27 | endif | |
28 | ||
6f0069ae WB |
29 | ifeq ($(valgrind), yes) |
30 | CARGO_BUILD_ARGS += --features valgrind | |
31 | endif | |
32 | ||
da0e1e40 FG |
33 | CARGO ?= cargo |
34 | ||
6285b251 WB |
35 | COMPILED_BINS := \ |
36 | $(addprefix $(COMPILEDIR)/,$(USR_BIN) $(USR_SBIN) $(SERVICE_BIN)) | |
37 | ||
da0e1e40 FG |
38 | DEBS= ${PACKAGE}-server_${DEB_VERSION}_${ARCH}.deb ${PACKAGE}-client_${DEB_VERSION}_${ARCH}.deb |
39 | ||
40 | DOC_DEB=${PACKAGE}-docs_${DEB_VERSION}_all.deb | |
36d74cd6 | 41 | |
e881b8a5 | 42 | DSC = rust-${PACKAGE}_${DEB_VERSION}.dsc |
209bb433 DM |
43 | |
44 | DESTDIR= | |
de779814 | 45 | |
13b77d10 WB |
46 | all: cargo-build $(SUBDIRS) |
47 | ||
48 | .PHONY: $(SUBDIRS) | |
49 | $(SUBDIRS): | |
50 | $(MAKE) -C $@ | |
de779814 | 51 | |
cd3b9a06 | 52 | test: |
cc119edb | 53 | #cargo test test_broadcast_future |
3dceb9b3 | 54 | #cargo test $(CARGO_BUILD_ARGS) |
da0e1e40 | 55 | $(CARGO) test $(tests) $(CARGO_BUILD_ARGS) |
f7dd683b | 56 | |
cd3b9a06 | 57 | doc: |
da0e1e40 | 58 | $(CARGO) doc --no-deps $(CARGO_BUILD_ARGS) |
d78345bc | 59 | |
13b77d10 WB |
60 | # always re-create this dir |
61 | .PHONY: build | |
62 | build: | |
de779814 | 63 | rm -rf build |
e881b8a5 FG |
64 | debcargo package --config debian/debcargo.toml --changelog-ready --no-overlay-write-back --directory build proxmox-backup $(shell dpkg-parsechangelog -l debian/changelog -SVersion | sed -e 's/-.*//') |
65 | sed -e '1,/^$$/ ! d' build/debian/control > build/debian/control.src | |
66 | cat build/debian/control.src build/debian/control.in > build/debian/control | |
67 | rm build/debian/control.in build/debian/control.src | |
68 | rm build/Cargo.lock | |
69 | find build/debian -name "*.hint" -delete | |
b369f720 WB |
70 | $(foreach i,$(SUBDIRS), \ |
71 | $(MAKE) -C build/$(i) clean ;) | |
de779814 | 72 | |
e881b8a5 | 73 | |
720776b8 DM |
74 | .PHONY: proxmox-backup-docs |
75 | proxmox-backup-docs: $(DOC_DEB) | |
76 | $(DOC_DEB): build | |
77 | cd build; dpkg-buildpackage -b -us -uc --no-pre-clean | |
78 | lintian $(DOC_DEB) | |
79 | ||
da0e1e40 | 80 | # copy the local target/ dir as a build-cache |
13b77d10 | 81 | .PHONY: deb |
36d74cd6 DM |
82 | deb: $(DEBS) |
83 | $(DEBS): build | |
720776b8 | 84 | cd build; dpkg-buildpackage -b -us -uc --no-pre-clean --build-profiles=nodoc |
36d74cd6 | 85 | lintian $(DEBS) |
18fad344 WB |
86 | |
87 | .PHONY: dsc | |
88 | dsc: $(DSC) | |
89 | $(DSC): build | |
90 | cd build; dpkg-buildpackage -S -us -uc -d -nc | |
91 | lintian $(DSC) | |
de779814 | 92 | |
209bb433 | 93 | distclean: clean |
de779814 DM |
94 | |
95 | clean: | |
b369f720 WB |
96 | $(foreach i,$(SUBDIRS), \ |
97 | $(MAKE) -C $(i) clean ;) | |
da0e1e40 | 98 | $(CARGO) clean |
1a9cb80c | 99 | rm -rf *.deb *.dsc *.tar.gz *.buildinfo *.changes build |
d3cb69c4 DM |
100 | find . -name '*~' -exec rm {} ';' |
101 | ||
209bb433 | 102 | .PHONY: dinstall |
36d74cd6 DM |
103 | dinstall: ${DEBS} |
104 | dpkg -i ${DEBS} | |
6285b251 | 105 | |
bb5c7707 DM |
106 | # make sure we build binaries before docs |
107 | docs: cargo-build | |
108 | ||
13b77d10 | 109 | .PHONY: cargo-build |
cd3b9a06 | 110 | cargo-build: |
da0e1e40 | 111 | $(CARGO) build $(CARGO_BUILD_ARGS) |
6285b251 | 112 | |
13b77d10 | 113 | $(COMPILED_BINS): cargo-build |
6285b251 | 114 | |
d1596102 WB |
115 | .PHONY: lint |
116 | lint: | |
117 | cargo clippy -- -A clippy::all -D clippy::correctness | |
118 | ||
6285b251 WB |
119 | install: $(COMPILED_BINS) |
120 | install -dm755 $(DESTDIR)$(BINDIR) | |
121 | $(foreach i,$(USR_BIN), \ | |
122 | install -m755 $(COMPILEDIR)/$(i) $(DESTDIR)$(BINDIR)/ ;) | |
123 | install -dm755 $(DESTDIR)$(SBINDIR) | |
124 | $(foreach i,$(USR_SBIN), \ | |
125 | install -m755 $(COMPILEDIR)/$(i) $(DESTDIR)$(SBINDIR)/ ;) | |
304db5da | 126 | install -dm755 $(DESTDIR)$(LIBEXECDIR)/proxmox-backup |
6285b251 | 127 | $(foreach i,$(SERVICE_BIN), \ |
304db5da | 128 | install -m755 $(COMPILEDIR)/$(i) $(DESTDIR)$(LIBEXECDIR)/proxmox-backup/ ;) |
6285b251 | 129 | $(MAKE) -C www install |
bb5c7707 | 130 | $(MAKE) -C docs install |
729e38f4 DM |
131 | |
132 | .PHONY: upload | |
133 | upload: ${DEBS} | |
134 | # check if working directory is clean | |
135 | git diff --exit-code --stat && git diff --exit-code --stat --staged | |
136 | tar cf - ${DEBS} | ssh -X repoman@repo.proxmox.com upload --product pbs --dist buster |