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