]> git.proxmox.com Git - proxmox-backup.git/blob - Makefile
also apply cargo build flags to tests
[proxmox-backup.git] / Makefile
1 include defines.mk
2
3 ARCH:=$(shell dpkg-architecture -qDEB_BUILD_ARCH)
4 GITVERSION:=$(shell git rev-parse HEAD)
5
6 SUBDIRS := etc www
7
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
21 ifeq ($(BUILD_MODE), release)
22 CARGO_BUILD_ARGS += --release
23 COMPILEDIR := target/release
24 else
25 COMPILEDIR := target/debug
26 endif
27
28 COMPILED_BINS := \
29 $(addprefix $(COMPILEDIR)/,$(USR_BIN) $(USR_SBIN) $(SERVICE_BIN))
30
31 export PROXMOX_PKG_VERSION=${PKGVER}
32 export PROXMOX_PKG_RELEASE=${PKGREL}
33 export PROXMOX_PKG_REPOID=${GITVERSION}
34
35 export PROXMOX_JSDIR := $(JSDIR)
36
37 DEB=${PACKAGE}_${PKGVER}-${PKGREL}_${ARCH}.deb
38
39 DESTDIR=
40
41 all: cargo-build $(SUBDIRS)
42
43 .PHONY: $(SUBDIRS)
44 $(SUBDIRS):
45 $(MAKE) -C $@
46
47 test:
48 cargo test $(CARGO_BUILD_ARGS)
49
50 # always re-create this dir
51 .PHONY: build
52 build:
53 rm -rf build
54 rsync -a debian Makefile defines.mk Cargo.toml src $(SUBDIRS) build/
55
56 .PHONY: deb
57 deb: $(DEB)
58 $(DEB): build
59 cd build; dpkg-buildpackage -b -us -uc
60
61 distclean: clean
62
63 clean:
64 $(MAKE) -C www clean
65 cargo clean
66 rm -rf *.deb *.buildinfo *.changes build
67 find . -name '*~' -exec rm {} ';'
68
69 .PHONY: dinstall
70 dinstall: ${DEB}
71 dpkg -i ${DEB}
72
73 .PHONY: cargo-build
74 cargo-build:
75 cargo build $(CARGO_BUILD_ARGS)
76
77 $(COMPILED_BINS): cargo-build
78
79 install: $(COMPILED_BINS)
80 install -dm755 $(DESTDIR)$(BINDIR)
81 $(foreach i,$(USR_BIN), \
82 install -m755 $(COMPILEDIR)/$(i) $(DESTDIR)$(BINDIR)/ ;)
83 install -dm755 $(DESTDIR)$(SBINDIR)
84 $(foreach i,$(USR_SBIN), \
85 install -m755 $(COMPILEDIR)/$(i) $(DESTDIR)$(SBINDIR)/ ;)
86 install -dm755 $(DESTDIR)$(LIBDIR)/proxmox-backup
87 $(foreach i,$(SERVICE_BIN), \
88 install -m755 $(COMPILEDIR)/$(i) $(DESTDIR)$(LIBDIR)/proxmox-backup/ ;)
89 $(MAKE) -C www install