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