]> git.proxmox.com Git - pve-lxc-syscalld.git/blob - Makefile
buildsys: run clippy in 'make test'
[pve-lxc-syscalld.git] / Makefile
1 include /usr/share/dpkg/architecture.mk
2 include /usr/share/dpkg/pkg-info.mk
3
4 include defines.mk
5
6 GITVERSION:=$(shell git rev-parse HEAD)
7
8 SUBDIRS := etc
9
10 ifeq ($(BUILD_MODE), release)
11 CARGO_BUILD_ARGS += --release
12 COMPILEDIR := target/release
13 else
14 COMPILEDIR := target/debug
15 endif
16
17 SERVICE_BIN := pve-lxc-syscalld
18
19 COMPILED_BINS := \
20 $(addprefix $(COMPILEDIR)/,$(SERVICE_BIN))
21
22 DEB=$(PACKAGE)_$(DEB_VERSION_UPSTREAM_REVISION)_$(DEB_HOST_ARCH).deb
23 DSC=$(PACKAGE)_$(DEB_VERSION_UPSTREAM_REVISION).dsc
24 BUILDSRC := $(PACKAGE)-$(DEB_VERSION_UPSTREAM)
25
26 all: cargo-build $(SUBDIRS)
27
28 .PHONY: $(SUBDIRS)
29 $(SUBDIRS):
30 $(MAKE) -C $@
31
32 .PHONY: cargo-build
33 cargo-build:
34 cargo build $(CARGO_BUILD_ARGS)
35
36 .PHONY: test
37 test:
38 cargo test
39 cargo fmt --all -- --check
40 cargo clippy
41
42 $(COMPILED_BINS): cargo-build
43
44 install: $(COMPILED_BINS)
45 install -dm755 $(DESTDIR)$(LIBEXECDIR)/proxmox-backup
46 $(foreach i,$(SERVICE_BIN), \
47 install -m755 $(COMPILEDIR)/$(i) $(DESTDIR)$(LIBEXECDIR)/proxmox-backup/ ;)
48
49 # always re-create this dir
50 # but also copy the local target/ dir as a build-cache
51 .PHONY: $(BUILDSRC)
52 $(BUILDSRC):
53 rm -rf $(BUILDSRC)
54 cargo build --release
55 rsync -a debian Makefile defines.mk Cargo.toml Cargo.lock \
56 src $(SUBDIRS) \
57 target \
58 $(BUILDSRC)/
59 $(foreach i,$(SUBDIRS), \
60 $(MAKE) -C $(BUILDSRC)/$(i) clean ;)
61
62 .PHONY: deb
63 deb: $(DEB)
64 $(DEB): $(BUILDSRC)
65 cd $(BUILDSRC); dpkg-buildpackage -b -us -uc --no-pre-clean
66 lintian $(DEB)
67
68 .PHONY: dsc
69 dsc: $(DSC)
70 $(DSC): $(BUILDSRC)
71 cd $(BUILDSRC); dpkg-buildpackage -S -us -uc -d -nc
72 lintian $(DSC)
73
74 clean:
75 $(foreach i,$(SUBDIRS), \
76 $(MAKE) -C $(i) clean ;)
77 cargo clean
78 rm -rf *.deb *.dsc *.tar.gz *.buildinfo *.changes $(BUILDSRC)