]>
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 := \ | |
c9727044 | 11 | proxmox-backup-client \ |
76425d84 | 12 | proxmox-file-restore \ |
c9727044 | 13 | pxar \ |
cc2c5c77 | 14 | proxmox-tape \ |
4c209d6b DM |
15 | pmtx \ |
16 | pmt | |
6285b251 WB |
17 | |
18 | # Binaries usable by admins | |
b69b8af2 TL |
19 | USR_SBIN := \ |
20 | proxmox-backup-manager | |
6285b251 WB |
21 | |
22 | # Binaries for services: | |
23 | SERVICE_BIN := \ | |
24 | proxmox-backup-api \ | |
b69b8af2 | 25 | proxmox-backup-banner \ |
bc00289b | 26 | proxmox-backup-proxy \ |
b27c3282 | 27 | proxmox-daily-update |
6285b251 | 28 | |
dd9cef56 SR |
29 | # Single file restore daemon |
30 | RESTORE_BIN := \ | |
31 | proxmox-restore-daemon | |
32 | ||
01fd2447 WB |
33 | SUBCRATES := \ |
34 | pbs-buildcfg | |
35 | ||
13b77d10 WB |
36 | ifeq ($(BUILD_MODE), release) |
37 | CARGO_BUILD_ARGS += --release | |
6285b251 | 38 | COMPILEDIR := target/release |
13b77d10 WB |
39 | else |
40 | COMPILEDIR := target/debug | |
41 | endif | |
42 | ||
6f0069ae WB |
43 | ifeq ($(valgrind), yes) |
44 | CARGO_BUILD_ARGS += --features valgrind | |
45 | endif | |
46 | ||
da0e1e40 FG |
47 | CARGO ?= cargo |
48 | ||
6285b251 | 49 | COMPILED_BINS := \ |
dd9cef56 | 50 | $(addprefix $(COMPILEDIR)/,$(USR_BIN) $(USR_SBIN) $(SERVICE_BIN) $(RESTORE_BIN)) |
6285b251 | 51 | |
1f6a4f58 TL |
52 | export DEB_VERSION DEB_VERSION_UPSTREAM |
53 | ||
10426c17 | 54 | SERVER_DEB=${PACKAGE}-server_${DEB_VERSION}_${ARCH}.deb |
3ec6e249 | 55 | SERVER_DBG_DEB=${PACKAGE}-server-dbgsym_${DEB_VERSION}_${ARCH}.deb |
10426c17 | 56 | CLIENT_DEB=${PACKAGE}-client_${DEB_VERSION}_${ARCH}.deb |
3ec6e249 | 57 | CLIENT_DBG_DEB=${PACKAGE}-client-dbgsym_${DEB_VERSION}_${ARCH}.deb |
a5322f3c TL |
58 | RESTORE_DEB=proxmox-backup-file-restore_${DEB_VERSION}_${ARCH}.deb |
59 | RESTORE_DBG_DEB=proxmox-backup-file-restore-dbgsym_${DEB_VERSION}_${ARCH}.deb | |
da0e1e40 | 60 | DOC_DEB=${PACKAGE}-docs_${DEB_VERSION}_all.deb |
36d74cd6 | 61 | |
76425d84 DC |
62 | DEBS=${SERVER_DEB} ${SERVER_DBG_DEB} ${CLIENT_DEB} ${CLIENT_DBG_DEB} \ |
63 | ${RESTORE_DEB} ${RESTORE_DBG_DEB} | |
10426c17 | 64 | |
e881b8a5 | 65 | DSC = rust-${PACKAGE}_${DEB_VERSION}.dsc |
209bb433 DM |
66 | |
67 | DESTDIR= | |
de779814 | 68 | |
13b77d10 WB |
69 | all: cargo-build $(SUBDIRS) |
70 | ||
71 | .PHONY: $(SUBDIRS) | |
72 | $(SUBDIRS): | |
73 | $(MAKE) -C $@ | |
de779814 | 74 | |
cd3b9a06 | 75 | test: |
cc119edb | 76 | #cargo test test_broadcast_future |
3dceb9b3 | 77 | #cargo test $(CARGO_BUILD_ARGS) |
c47a900c | 78 | $(CARGO) test $(tests) $(CARGO_BUILD_ARGS) |
f7dd683b | 79 | |
cd3b9a06 | 80 | doc: |
da0e1e40 | 81 | $(CARGO) doc --no-deps $(CARGO_BUILD_ARGS) |
d78345bc | 82 | |
13b77d10 WB |
83 | # always re-create this dir |
84 | .PHONY: build | |
85 | build: | |
de779814 | 86 | rm -rf build |
01fd2447 WB |
87 | mkdir build |
88 | cp -a debian \ | |
89 | Cargo.toml build.rs src \ | |
90 | $(SUBCRATES) \ | |
91 | docs etc examples tests www zsh-completions \ | |
92 | defines.mk Makefile \ | |
93 | ./build/ | |
94 | rm -f build/Cargo.lock | |
e881b8a5 | 95 | find build/debian -name "*.hint" -delete |
b369f720 WB |
96 | $(foreach i,$(SUBDIRS), \ |
97 | $(MAKE) -C build/$(i) clean ;) | |
de779814 | 98 | |
e881b8a5 | 99 | |
720776b8 | 100 | .PHONY: proxmox-backup-docs |
37e53b4c TL |
101 | $(DOC_DEB) $(DEBS): proxmox-backup-docs |
102 | proxmox-backup-docs: build | |
720776b8 DM |
103 | cd build; dpkg-buildpackage -b -us -uc --no-pre-clean |
104 | lintian $(DOC_DEB) | |
105 | ||
da0e1e40 | 106 | # copy the local target/ dir as a build-cache |
13b77d10 | 107 | .PHONY: deb |
37e53b4c TL |
108 | $(DEBS): deb |
109 | deb: build | |
720776b8 | 110 | cd build; dpkg-buildpackage -b -us -uc --no-pre-clean --build-profiles=nodoc |
36d74cd6 | 111 | lintian $(DEBS) |
18fad344 | 112 | |
37e53b4c | 113 | .PHONY: deb-all |
a2c73c78 TL |
114 | deb-all: build |
115 | cd build; dpkg-buildpackage -b -us -uc --no-pre-clean | |
116 | lintian $(DEBS) $(DOC_DEB) | |
37e53b4c | 117 | |
18fad344 WB |
118 | .PHONY: dsc |
119 | dsc: $(DSC) | |
120 | $(DSC): build | |
121 | cd build; dpkg-buildpackage -S -us -uc -d -nc | |
122 | lintian $(DSC) | |
de779814 | 123 | |
209bb433 | 124 | distclean: clean |
de779814 DM |
125 | |
126 | clean: | |
b369f720 WB |
127 | $(foreach i,$(SUBDIRS), \ |
128 | $(MAKE) -C $(i) clean ;) | |
da0e1e40 | 129 | $(CARGO) clean |
1a9cb80c | 130 | rm -rf *.deb *.dsc *.tar.gz *.buildinfo *.changes build |
d3cb69c4 DM |
131 | find . -name '*~' -exec rm {} ';' |
132 | ||
209bb433 | 133 | .PHONY: dinstall |
c287b287 TL |
134 | dinstall: ${SERVER_DEB} ${SERVER_DBG_DEB} ${CLIENT_DEB} ${CLIENT_DBG_DEB} |
135 | dpkg -i $^ | |
6285b251 | 136 | |
bb5c7707 DM |
137 | # make sure we build binaries before docs |
138 | docs: cargo-build | |
139 | ||
13b77d10 | 140 | .PHONY: cargo-build |
cd3b9a06 | 141 | cargo-build: |
da0e1e40 | 142 | $(CARGO) build $(CARGO_BUILD_ARGS) |
6285b251 | 143 | |
13b77d10 | 144 | $(COMPILED_BINS): cargo-build |
6285b251 | 145 | |
d1596102 WB |
146 | .PHONY: lint |
147 | lint: | |
148 | cargo clippy -- -A clippy::all -D clippy::correctness | |
149 | ||
6285b251 WB |
150 | install: $(COMPILED_BINS) |
151 | install -dm755 $(DESTDIR)$(BINDIR) | |
6dea60aa | 152 | install -dm755 $(DESTDIR)$(ZSH_COMPL_DEST) |
6285b251 | 153 | $(foreach i,$(USR_BIN), \ |
6dea60aa CE |
154 | install -m755 $(COMPILEDIR)/$(i) $(DESTDIR)$(BINDIR)/ ; \ |
155 | install -m644 zsh-completions/_$(i) $(DESTDIR)$(ZSH_COMPL_DEST)/ ;) | |
6285b251 WB |
156 | install -dm755 $(DESTDIR)$(SBINDIR) |
157 | $(foreach i,$(USR_SBIN), \ | |
6dea60aa CE |
158 | install -m755 $(COMPILEDIR)/$(i) $(DESTDIR)$(SBINDIR)/ ; \ |
159 | install -m644 zsh-completions/_$(i) $(DESTDIR)$(ZSH_COMPL_DEST)/ ;) | |
304db5da | 160 | install -dm755 $(DESTDIR)$(LIBEXECDIR)/proxmox-backup |
dd9cef56 SR |
161 | install -dm755 $(DESTDIR)$(LIBEXECDIR)/proxmox-backup/file-restore |
162 | $(foreach i,$(RESTORE_BIN), \ | |
163 | install -m755 $(COMPILEDIR)/$(i) $(DESTDIR)$(LIBEXECDIR)/proxmox-backup/file-restore/ ;) | |
b27c3282 | 164 | # install sg-tape-cmd as setuid binary |
df3a74d7 | 165 | install -m4755 -o root -g root $(COMPILEDIR)/sg-tape-cmd $(DESTDIR)$(LIBEXECDIR)/proxmox-backup/sg-tape-cmd |
6285b251 | 166 | $(foreach i,$(SERVICE_BIN), \ |
304db5da | 167 | install -m755 $(COMPILEDIR)/$(i) $(DESTDIR)$(LIBEXECDIR)/proxmox-backup/ ;) |
6285b251 | 168 | $(MAKE) -C www install |
bb5c7707 | 169 | $(MAKE) -C docs install |
729e38f4 DM |
170 | |
171 | .PHONY: upload | |
76425d84 | 172 | upload: ${SERVER_DEB} ${CLIENT_DEB} ${RESTORE_DEB} ${DOC_DEB} |
729e38f4 DM |
173 | # check if working directory is clean |
174 | git diff --exit-code --stat && git diff --exit-code --stat --staged | |
59648eac | 175 | tar cf - ${SERVER_DEB} ${SERVER_DBG_DEB} ${DOC_DEB} ${CLIENT_DEB} ${CLIENT_DBG_DEB} | \ |
d9d81741 TL |
176 | ssh -X repoman@repo.proxmox.com upload --product pbs --dist bullseye |
177 | tar cf - ${CLIENT_DEB} ${CLIENT_DBG_DEB} | ssh -X repoman@repo.proxmox.com upload --product "pve,pmg,pbs-client" --dist bullseye | |
178 | tar cf - ${RESTORE_DEB} ${RESTORE_DBG_DEB} | ssh -X repoman@repo.proxmox.com upload --product "pve" --dist bullseye |