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