]>
Commit | Line | Data |
---|---|---|
6285b251 | 1 | include defines.mk |
de779814 | 2 | |
209bb433 DM |
3 | ARCH:=$(shell dpkg-architecture -qDEB_BUILD_ARCH) |
4 | GITVERSION:=$(shell git rev-parse HEAD) | |
5 | ||
bb5c7707 | 6 | SUBDIRS := etc www docs |
13b77d10 | 7 | |
6285b251 WB |
8 | # Binaries usable by users |
9 | USR_BIN := \ | |
10 | proxmox-backup-client \ | |
7c4dd946 | 11 | pxar |
6285b251 WB |
12 | |
13 | # Binaries usable by admins | |
14 | USR_SBIN := proxmox-backup-manager | |
15 | ||
16 | # Binaries for services: | |
17 | SERVICE_BIN := \ | |
18 | proxmox-backup-api \ | |
19 | proxmox-backup-proxy | |
20 | ||
13b77d10 WB |
21 | ifeq ($(BUILD_MODE), release) |
22 | CARGO_BUILD_ARGS += --release | |
6285b251 | 23 | COMPILEDIR := target/release |
13b77d10 WB |
24 | else |
25 | COMPILEDIR := target/debug | |
26 | endif | |
27 | ||
6f0069ae WB |
28 | ifeq ($(valgrind), yes) |
29 | CARGO_BUILD_ARGS += --features valgrind | |
30 | endif | |
31 | ||
6285b251 WB |
32 | COMPILED_BINS := \ |
33 | $(addprefix $(COMPILEDIR)/,$(USR_BIN) $(USR_SBIN) $(SERVICE_BIN)) | |
34 | ||
4b26195c DM |
35 | export PROXMOX_PKG_VERSION=${PKGVER} |
36 | export PROXMOX_PKG_RELEASE=${PKGREL} | |
37 | export PROXMOX_PKG_REPOID=${GITVERSION} | |
209bb433 | 38 | |
6285b251 | 39 | export PROXMOX_JSDIR := $(JSDIR) |
9f4962d3 | 40 | export PROXMOX_CONFIGDIR := $(SYSCONFDIR)/proxmox-backup |
6285b251 | 41 | |
209bb433 | 42 | DEB=${PACKAGE}_${PKGVER}-${PKGREL}_${ARCH}.deb |
18fad344 | 43 | DSC=${PACKAGE}_${PKGVER}-${PKGREL}.dsc |
209bb433 DM |
44 | |
45 | DESTDIR= | |
de779814 | 46 | |
13b77d10 WB |
47 | all: cargo-build $(SUBDIRS) |
48 | ||
49 | .PHONY: $(SUBDIRS) | |
50 | $(SUBDIRS): | |
51 | $(MAKE) -C $@ | |
de779814 | 52 | |
cd3b9a06 | 53 | test: |
cc119edb | 54 | #cargo test test_broadcast_future |
3dceb9b3 | 55 | #cargo test $(CARGO_BUILD_ARGS) |
cc119edb | 56 | cargo test $(tests) $(CARGO_BUILD_ARGS) |
f7dd683b | 57 | |
cd3b9a06 | 58 | doc: |
18a1aa48 | 59 | cargo doc --no-deps $(CARGO_BUILD_ARGS) |
d78345bc | 60 | |
13b77d10 | 61 | # always re-create this dir |
7ba5fb4a | 62 | # but also copy the local target/ dir as a build-cache |
13b77d10 WB |
63 | .PHONY: build |
64 | build: | |
de779814 | 65 | rm -rf build |
05138714 | 66 | cargo build --release |
c28e6f4b | 67 | rsync -a debian Makefile defines.mk Cargo.toml Cargo.lock \ |
d721a688 | 68 | src proxmox-protocol zstd-sys $(SUBDIRS) \ |
ec56f07b | 69 | target tests build/ |
b369f720 WB |
70 | $(foreach i,$(SUBDIRS), \ |
71 | $(MAKE) -C build/$(i) clean ;) | |
de779814 | 72 | |
13b77d10 WB |
73 | .PHONY: deb |
74 | deb: $(DEB) | |
75 | $(DEB): build | |
0ae7ac15 | 76 | cd build; dpkg-buildpackage -b -us -uc --no-pre-clean |
18fad344 WB |
77 | lintian $(DEB) |
78 | ||
79 | .PHONY: dsc | |
80 | dsc: $(DSC) | |
81 | $(DSC): build | |
82 | cd build; dpkg-buildpackage -S -us -uc -d -nc | |
83 | lintian $(DSC) | |
de779814 | 84 | |
209bb433 | 85 | distclean: clean |
de779814 DM |
86 | |
87 | clean: | |
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 DM |
94 | .PHONY: dinstall |
95 | dinstall: ${DEB} | |
96 | dpkg -i ${DEB} | |
6285b251 | 97 | |
bb5c7707 DM |
98 | # make sure we build binaries before docs |
99 | docs: cargo-build | |
100 | ||
13b77d10 | 101 | .PHONY: cargo-build |
cd3b9a06 | 102 | cargo-build: |
13b77d10 | 103 | cargo build $(CARGO_BUILD_ARGS) |
6285b251 | 104 | |
13b77d10 | 105 | $(COMPILED_BINS): cargo-build |
6285b251 WB |
106 | |
107 | install: $(COMPILED_BINS) | |
108 | install -dm755 $(DESTDIR)$(BINDIR) | |
109 | $(foreach i,$(USR_BIN), \ | |
110 | install -m755 $(COMPILEDIR)/$(i) $(DESTDIR)$(BINDIR)/ ;) | |
111 | install -dm755 $(DESTDIR)$(SBINDIR) | |
112 | $(foreach i,$(USR_SBIN), \ | |
113 | install -m755 $(COMPILEDIR)/$(i) $(DESTDIR)$(SBINDIR)/ ;) | |
304db5da | 114 | install -dm755 $(DESTDIR)$(LIBEXECDIR)/proxmox-backup |
6285b251 | 115 | $(foreach i,$(SERVICE_BIN), \ |
304db5da | 116 | install -m755 $(COMPILEDIR)/$(i) $(DESTDIR)$(LIBEXECDIR)/proxmox-backup/ ;) |
6285b251 | 117 | $(MAKE) -C www install |
bb5c7707 | 118 | $(MAKE) -C docs install |