]>
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 | ||
6285b251 WB |
28 | COMPILED_BINS := \ |
29 | $(addprefix $(COMPILEDIR)/,$(USR_BIN) $(USR_SBIN) $(SERVICE_BIN)) | |
30 | ||
4b26195c DM |
31 | export PROXMOX_PKG_VERSION=${PKGVER} |
32 | export PROXMOX_PKG_RELEASE=${PKGREL} | |
33 | export PROXMOX_PKG_REPOID=${GITVERSION} | |
209bb433 | 34 | |
6285b251 | 35 | export PROXMOX_JSDIR := $(JSDIR) |
9f4962d3 | 36 | export PROXMOX_CONFIGDIR := $(SYSCONFDIR)/proxmox-backup |
6285b251 | 37 | |
209bb433 | 38 | DEB=${PACKAGE}_${PKGVER}-${PKGREL}_${ARCH}.deb |
18fad344 | 39 | DSC=${PACKAGE}_${PKGVER}-${PKGREL}.dsc |
209bb433 DM |
40 | |
41 | DESTDIR= | |
de779814 | 42 | |
13b77d10 WB |
43 | all: cargo-build $(SUBDIRS) |
44 | ||
45 | .PHONY: $(SUBDIRS) | |
46 | $(SUBDIRS): | |
47 | $(MAKE) -C $@ | |
de779814 | 48 | |
cd3b9a06 | 49 | test: |
3dceb9b3 DM |
50 | cargo test test_broadcast_future |
51 | #cargo test $(CARGO_BUILD_ARGS) | |
f7dd683b | 52 | |
cd3b9a06 | 53 | doc: |
18a1aa48 | 54 | cargo doc --no-deps $(CARGO_BUILD_ARGS) |
d78345bc | 55 | |
13b77d10 | 56 | # always re-create this dir |
7ba5fb4a | 57 | # but also copy the local target/ dir as a build-cache |
13b77d10 WB |
58 | .PHONY: build |
59 | build: | |
de779814 | 60 | rm -rf build |
05138714 | 61 | cargo build --release |
c28e6f4b | 62 | rsync -a debian Makefile defines.mk Cargo.toml Cargo.lock \ |
d721a688 | 63 | src proxmox-protocol zstd-sys $(SUBDIRS) \ |
c28e6f4b | 64 | target build/ |
b369f720 WB |
65 | $(foreach i,$(SUBDIRS), \ |
66 | $(MAKE) -C build/$(i) clean ;) | |
de779814 | 67 | |
13b77d10 WB |
68 | .PHONY: deb |
69 | deb: $(DEB) | |
70 | $(DEB): build | |
0ae7ac15 | 71 | cd build; dpkg-buildpackage -b -us -uc --no-pre-clean |
18fad344 WB |
72 | lintian $(DEB) |
73 | ||
74 | .PHONY: dsc | |
75 | dsc: $(DSC) | |
76 | $(DSC): build | |
77 | cd build; dpkg-buildpackage -S -us -uc -d -nc | |
78 | lintian $(DSC) | |
de779814 | 79 | |
209bb433 | 80 | distclean: clean |
de779814 DM |
81 | |
82 | clean: | |
b369f720 WB |
83 | $(foreach i,$(SUBDIRS), \ |
84 | $(MAKE) -C $(i) clean ;) | |
de779814 | 85 | cargo clean |
1a9cb80c | 86 | rm -rf *.deb *.dsc *.tar.gz *.buildinfo *.changes build |
d3cb69c4 DM |
87 | find . -name '*~' -exec rm {} ';' |
88 | ||
209bb433 DM |
89 | .PHONY: dinstall |
90 | dinstall: ${DEB} | |
91 | dpkg -i ${DEB} | |
6285b251 | 92 | |
bb5c7707 DM |
93 | # make sure we build binaries before docs |
94 | docs: cargo-build | |
95 | ||
13b77d10 | 96 | .PHONY: cargo-build |
cd3b9a06 | 97 | cargo-build: |
13b77d10 | 98 | cargo build $(CARGO_BUILD_ARGS) |
6285b251 | 99 | |
13b77d10 | 100 | $(COMPILED_BINS): cargo-build |
6285b251 WB |
101 | |
102 | install: $(COMPILED_BINS) | |
103 | install -dm755 $(DESTDIR)$(BINDIR) | |
104 | $(foreach i,$(USR_BIN), \ | |
105 | install -m755 $(COMPILEDIR)/$(i) $(DESTDIR)$(BINDIR)/ ;) | |
106 | install -dm755 $(DESTDIR)$(SBINDIR) | |
107 | $(foreach i,$(USR_SBIN), \ | |
108 | install -m755 $(COMPILEDIR)/$(i) $(DESTDIR)$(SBINDIR)/ ;) | |
304db5da | 109 | install -dm755 $(DESTDIR)$(LIBEXECDIR)/proxmox-backup |
6285b251 | 110 | $(foreach i,$(SERVICE_BIN), \ |
304db5da | 111 | install -m755 $(COMPILEDIR)/$(i) $(DESTDIR)$(LIBEXECDIR)/proxmox-backup/ ;) |
6285b251 | 112 | $(MAKE) -C www install |
bb5c7707 | 113 | $(MAKE) -C docs install |