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