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