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