]> git.proxmox.com Git - proxmox-backup.git/blame - Makefile
update to first proxmox crate split
[proxmox-backup.git] / Makefile
CommitLineData
da0e1e40 1include /usr/share/dpkg/default.mk
6285b251 2include defines.mk
de779814 3
e881b8a5 4PACKAGE := proxmox-backup
da0e1e40 5ARCH := $(DEB_BUILD_ARCH)
209bb433 6
bb5c7707 7SUBDIRS := etc www docs
13b77d10 8
6285b251
WB
9# Binaries usable by users
10USR_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 19USR_SBIN := \
7c72ae04
HL
20 proxmox-backup-manager \
21 proxmox-backup-debug \
6285b251
WB
22
23# Binaries for services:
24SERVICE_BIN := \
25 proxmox-backup-api \
b69b8af2 26 proxmox-backup-banner \
bc00289b 27 proxmox-backup-proxy \
b27c3282 28 proxmox-daily-update
6285b251 29
dd9cef56
SR
30# Single file restore daemon
31RESTORE_BIN := \
32 proxmox-restore-daemon
33
01fd2447 34SUBCRATES := \
86fb3877 35 pbs-api-types \
d420962f 36 pbs-buildcfg \
2b7f8dd5 37 pbs-client \
21211748 38 pbs-config \
f323e906 39 pbs-datastore \
eb5e0ae6 40 pbs-fuse-loop \
770a36e5 41 pbs-runtime \
037f6b6d 42 proxmox-rest-server \
d1c3bc53 43 proxmox-rrd-api-types \
09340f28 44 proxmox-rrd \
84af82e8 45 proxmox-systemd \
048b43af 46 pbs-tape \
b9c5cd82 47 pbs-tools \
58a3fae7 48 proxmox-backup-banner \
e351ac78 49 proxmox-backup-client \
6c76aa43 50 proxmox-file-restore \
6523588c 51 proxmox-restore-daemon \
58a3fae7 52 pxar-bin
01fd2447 53
13b77d10
WB
54ifeq ($(BUILD_MODE), release)
55CARGO_BUILD_ARGS += --release
6285b251 56COMPILEDIR := target/release
13b77d10
WB
57else
58COMPILEDIR := target/debug
59endif
60
6f0069ae
WB
61ifeq ($(valgrind), yes)
62CARGO_BUILD_ARGS += --features valgrind
63endif
64
da0e1e40
FG
65CARGO ?= cargo
66
6285b251 67COMPILED_BINS := \
dd9cef56 68 $(addprefix $(COMPILEDIR)/,$(USR_BIN) $(USR_SBIN) $(SERVICE_BIN) $(RESTORE_BIN))
6285b251 69
1f6a4f58
TL
70export DEB_VERSION DEB_VERSION_UPSTREAM
71
10426c17 72SERVER_DEB=${PACKAGE}-server_${DEB_VERSION}_${ARCH}.deb
3ec6e249 73SERVER_DBG_DEB=${PACKAGE}-server-dbgsym_${DEB_VERSION}_${ARCH}.deb
10426c17 74CLIENT_DEB=${PACKAGE}-client_${DEB_VERSION}_${ARCH}.deb
3ec6e249 75CLIENT_DBG_DEB=${PACKAGE}-client-dbgsym_${DEB_VERSION}_${ARCH}.deb
a5322f3c
TL
76RESTORE_DEB=proxmox-backup-file-restore_${DEB_VERSION}_${ARCH}.deb
77RESTORE_DBG_DEB=proxmox-backup-file-restore-dbgsym_${DEB_VERSION}_${ARCH}.deb
da0e1e40 78DOC_DEB=${PACKAGE}-docs_${DEB_VERSION}_all.deb
36d74cd6 79
76425d84 80DEBS=${SERVER_DEB} ${SERVER_DBG_DEB} ${CLIENT_DEB} ${CLIENT_DBG_DEB} \
df12c9ec 81 ${RESTORE_DEB} ${RESTORE_DBG_DEB} ${DEBUG_DEB} ${DEBUG_DBG_DEB}
10426c17 82
e881b8a5 83DSC = rust-${PACKAGE}_${DEB_VERSION}.dsc
209bb433
DM
84
85DESTDIR=
de779814 86
314d360f
WB
87tests ?= --workspace
88
424d2d68 89all: $(SUBDIRS)
13b77d10
WB
90
91.PHONY: $(SUBDIRS)
92$(SUBDIRS):
93 $(MAKE) -C $@
de779814 94
cd3b9a06 95test:
cc119edb 96 #cargo test test_broadcast_future
3dceb9b3 97 #cargo test $(CARGO_BUILD_ARGS)
c47a900c 98 $(CARGO) test $(tests) $(CARGO_BUILD_ARGS)
f7dd683b 99
cd3b9a06 100doc:
314d360f 101 $(CARGO) doc --workspace --no-deps $(CARGO_BUILD_ARGS)
d78345bc 102
13b77d10
WB
103# always re-create this dir
104.PHONY: build
105build:
f9c0a941
WB
106 @echo "Setting pkg-buildcfg version to: $(DEB_VERSION_UPSTREAM)"
107 sed -i -e 's/^version =.*$$/version = "$(DEB_VERSION_UPSTREAM)"/' \
108 pbs-buildcfg/Cargo.toml
de779814 109 rm -rf build
01fd2447
WB
110 mkdir build
111 cp -a debian \
a6eac535 112 Cargo.toml src \
01fd2447
WB
113 $(SUBCRATES) \
114 docs etc examples tests www zsh-completions \
115 defines.mk Makefile \
116 ./build/
117 rm -f build/Cargo.lock
e881b8a5 118 find build/debian -name "*.hint" -delete
b369f720
WB
119 $(foreach i,$(SUBDIRS), \
120 $(MAKE) -C build/$(i) clean ;)
de779814 121
e881b8a5 122
720776b8 123.PHONY: proxmox-backup-docs
37e53b4c
TL
124$(DOC_DEB) $(DEBS): proxmox-backup-docs
125proxmox-backup-docs: build
720776b8
DM
126 cd build; dpkg-buildpackage -b -us -uc --no-pre-clean
127 lintian $(DOC_DEB)
128
da0e1e40 129# copy the local target/ dir as a build-cache
13b77d10 130.PHONY: deb
37e53b4c
TL
131$(DEBS): deb
132deb: build
720776b8 133 cd build; dpkg-buildpackage -b -us -uc --no-pre-clean --build-profiles=nodoc
36d74cd6 134 lintian $(DEBS)
18fad344 135
37e53b4c 136.PHONY: deb-all
a2c73c78
TL
137deb-all: build
138 cd build; dpkg-buildpackage -b -us -uc --no-pre-clean
139 lintian $(DEBS) $(DOC_DEB)
37e53b4c 140
18fad344
WB
141.PHONY: dsc
142dsc: $(DSC)
143$(DSC): build
144 cd build; dpkg-buildpackage -S -us -uc -d -nc
145 lintian $(DSC)
de779814 146
1900d781 147.PHONY: clean distclean deb clean
209bb433 148distclean: clean
6b85671d 149clean: clean-deb
b369f720
WB
150 $(foreach i,$(SUBDIRS), \
151 $(MAKE) -C $(i) clean ;)
da0e1e40 152 $(CARGO) clean
424d2d68 153 rm -f .do-cargo-build
d3cb69c4
DM
154 find . -name '*~' -exec rm {} ';'
155
1900d781
TL
156# allows one to avoid running cargo clean when one just wants to tidy up after a packgae build
157clean-deb:
158 rm -rf *.deb *.dsc *.tar.gz *.buildinfo *.changes build/
159
209bb433 160.PHONY: dinstall
df12c9ec
WB
161dinstall: ${SERVER_DEB} ${SERVER_DBG_DEB} ${CLIENT_DEB} ${CLIENT_DBG_DEB} \
162 ${DEBUG_DEB} ${DEBUG_DBG_DEB}
c287b287 163 dpkg -i $^
6285b251 164
bb5c7707 165# make sure we build binaries before docs
424d2d68 166docs: $(COMPILEDIR)/dump-catalog-shell-cli $(COMPILEDIR)/docgen
bb5c7707 167
13b77d10 168.PHONY: cargo-build
cd3b9a06 169cargo-build:
424d2d68
TL
170 rm -f .do-cargo-build
171 $(MAKE) $(COMPILED_BINS)
172
173$(COMPILED_BINS) $(COMPILEDIR)/dump-catalog-shell-cli $(COMPILEDIR)/docgen: .do-cargo-build
174.do-cargo-build:
e678a50e 175 $(CARGO) build $(CARGO_BUILD_ARGS) \
b9c5cd82
WB
176 --package proxmox-backup-banner \
177 --bin proxmox-backup-banner \
e351ac78
WB
178 --package proxmox-backup-client \
179 --bin proxmox-backup-client \
a844fa0b 180 --bin dump-catalog-shell-cli \
e5f9b7f7 181 --bin proxmox-backup-debug \
6c76aa43
WB
182 --package proxmox-file-restore \
183 --bin proxmox-file-restore \
58a3fae7
WB
184 --package pxar-bin \
185 --bin pxar \
048b43af
DM
186 --package pbs-tape \
187 --bin pmt \
188 --bin pmtx \
6523588c
DM
189 --package proxmox-restore-daemon \
190 --bin proxmox-restore-daemon \
b9c5cd82 191 --package proxmox-backup \
4d4f94de
TL
192 --bin docgen \
193 --bin proxmox-backup-api \
194 --bin proxmox-backup-manager \
195 --bin proxmox-backup-proxy \
991be99c
TL
196 --bin proxmox-daily-update \
197 --bin proxmox-file-restore \
991be99c 198 --bin proxmox-tape \
991be99c 199 --bin sg-tape-cmd
424d2d68 200 touch "$@"
6285b251 201
6285b251 202
d1596102
WB
203.PHONY: lint
204lint:
205 cargo clippy -- -A clippy::all -D clippy::correctness
206
6285b251
WB
207install: $(COMPILED_BINS)
208 install -dm755 $(DESTDIR)$(BINDIR)
6dea60aa 209 install -dm755 $(DESTDIR)$(ZSH_COMPL_DEST)
6285b251 210 $(foreach i,$(USR_BIN), \
6dea60aa
CE
211 install -m755 $(COMPILEDIR)/$(i) $(DESTDIR)$(BINDIR)/ ; \
212 install -m644 zsh-completions/_$(i) $(DESTDIR)$(ZSH_COMPL_DEST)/ ;)
6285b251
WB
213 install -dm755 $(DESTDIR)$(SBINDIR)
214 $(foreach i,$(USR_SBIN), \
6dea60aa
CE
215 install -m755 $(COMPILEDIR)/$(i) $(DESTDIR)$(SBINDIR)/ ; \
216 install -m644 zsh-completions/_$(i) $(DESTDIR)$(ZSH_COMPL_DEST)/ ;)
304db5da 217 install -dm755 $(DESTDIR)$(LIBEXECDIR)/proxmox-backup
dd9cef56
SR
218 install -dm755 $(DESTDIR)$(LIBEXECDIR)/proxmox-backup/file-restore
219 $(foreach i,$(RESTORE_BIN), \
220 install -m755 $(COMPILEDIR)/$(i) $(DESTDIR)$(LIBEXECDIR)/proxmox-backup/file-restore/ ;)
b27c3282 221 # install sg-tape-cmd as setuid binary
df3a74d7 222 install -m4755 -o root -g root $(COMPILEDIR)/sg-tape-cmd $(DESTDIR)$(LIBEXECDIR)/proxmox-backup/sg-tape-cmd
6285b251 223 $(foreach i,$(SERVICE_BIN), \
304db5da 224 install -m755 $(COMPILEDIR)/$(i) $(DESTDIR)$(LIBEXECDIR)/proxmox-backup/ ;)
6285b251 225 $(MAKE) -C www install
bb5c7707 226 $(MAKE) -C docs install
b29292a8 227ifeq (,$(filter nocheck,$(DEB_BUILD_OPTIONS)))
7190cbf2 228 $(MAKE) test # HACK, only test now to avoid clobbering build files with wrong config
b29292a8 229endif
729e38f4
DM
230
231.PHONY: upload
df12c9ec 232upload: ${SERVER_DEB} ${CLIENT_DEB} ${RESTORE_DEB} ${DOC_DEB} ${DEBUG_DEB}
729e38f4
DM
233 # check if working directory is clean
234 git diff --exit-code --stat && git diff --exit-code --stat --staged
df12c9ec
WB
235 tar cf - ${SERVER_DEB} ${SERVER_DBG_DEB} ${DOC_DEB} ${CLIENT_DEB} \
236 ${CLIENT_DBG_DEB} ${DEBUG_DEB} ${DEBUG_DBG_DEB} \
237 | ssh -X repoman@repo.proxmox.com upload --product pbs --dist bullseye
d9d81741
TL
238 tar cf - ${CLIENT_DEB} ${CLIENT_DBG_DEB} | ssh -X repoman@repo.proxmox.com upload --product "pve,pmg,pbs-client" --dist bullseye
239 tar cf - ${RESTORE_DEB} ${RESTORE_DBG_DEB} | ssh -X repoman@repo.proxmox.com upload --product "pve" --dist bullseye