]>
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 | ||
13b77d10 WB |
6 | SUBDIRS := etc www |
7 | ||
6285b251 WB |
8 | # Binaries usable by users |
9 | USR_BIN := \ | |
10 | proxmox-backup-client \ | |
11 | catar | |
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 WB |
35 | export PROXMOX_JSDIR := $(JSDIR) |
36 | ||
209bb433 | 37 | DEB=${PACKAGE}_${PKGVER}-${PKGREL}_${ARCH}.deb |
18fad344 | 38 | DSC=${PACKAGE}_${PKGVER}-${PKGREL}.dsc |
209bb433 DM |
39 | |
40 | DESTDIR= | |
de779814 | 41 | |
13b77d10 WB |
42 | all: cargo-build $(SUBDIRS) |
43 | ||
44 | .PHONY: $(SUBDIRS) | |
45 | $(SUBDIRS): | |
46 | $(MAKE) -C $@ | |
de779814 | 47 | |
f7dd683b | 48 | test: |
069f2d16 | 49 | cargo test $(CARGO_BUILD_ARGS) |
f7dd683b | 50 | |
13b77d10 WB |
51 | # always re-create this dir |
52 | .PHONY: build | |
53 | build: | |
de779814 | 54 | rm -rf build |
13b77d10 | 55 | rsync -a debian Makefile defines.mk Cargo.toml src $(SUBDIRS) build/ |
de779814 | 56 | |
13b77d10 WB |
57 | .PHONY: deb |
58 | deb: $(DEB) | |
59 | $(DEB): build | |
60 | cd build; dpkg-buildpackage -b -us -uc | |
18fad344 WB |
61 | lintian $(DEB) |
62 | ||
63 | .PHONY: dsc | |
64 | dsc: $(DSC) | |
65 | $(DSC): build | |
66 | cd build; dpkg-buildpackage -S -us -uc -d -nc | |
67 | lintian $(DSC) | |
de779814 | 68 | |
209bb433 | 69 | distclean: clean |
de779814 DM |
70 | |
71 | clean: | |
6285b251 | 72 | $(MAKE) -C www clean |
de779814 | 73 | cargo clean |
d3cb69c4 DM |
74 | rm -rf *.deb *.buildinfo *.changes build |
75 | find . -name '*~' -exec rm {} ';' | |
76 | ||
209bb433 DM |
77 | .PHONY: dinstall |
78 | dinstall: ${DEB} | |
79 | dpkg -i ${DEB} | |
6285b251 | 80 | |
13b77d10 WB |
81 | .PHONY: cargo-build |
82 | cargo-build: | |
83 | cargo build $(CARGO_BUILD_ARGS) | |
6285b251 | 84 | |
13b77d10 | 85 | $(COMPILED_BINS): cargo-build |
6285b251 WB |
86 | |
87 | install: $(COMPILED_BINS) | |
88 | install -dm755 $(DESTDIR)$(BINDIR) | |
89 | $(foreach i,$(USR_BIN), \ | |
90 | install -m755 $(COMPILEDIR)/$(i) $(DESTDIR)$(BINDIR)/ ;) | |
91 | install -dm755 $(DESTDIR)$(SBINDIR) | |
92 | $(foreach i,$(USR_SBIN), \ | |
93 | install -m755 $(COMPILEDIR)/$(i) $(DESTDIR)$(SBINDIR)/ ;) | |
304db5da | 94 | install -dm755 $(DESTDIR)$(LIBEXECDIR)/proxmox-backup |
6285b251 | 95 | $(foreach i,$(SERVICE_BIN), \ |
304db5da | 96 | install -m755 $(COMPILEDIR)/$(i) $(DESTDIR)$(LIBEXECDIR)/proxmox-backup/ ;) |
6285b251 | 97 | $(MAKE) -C www install |