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