]> git.proxmox.com Git - pve-lxc-syscalld.git/blame - Makefile
seq_packet, iovec
[pve-lxc-syscalld.git] / Makefile
CommitLineData
641af2dd
WB
1include /usr/share/dpkg/architecture.mk
2include /usr/share/dpkg/pkg-info.mk
3
4include defines.mk
5
6GITVERSION:=$(shell git rev-parse HEAD)
7
8SUBDIRS := etc
9
10ifeq ($(BUILD_MODE), release)
11CARGO_BUILD_ARGS += --release
12COMPILEDIR := target/release
13else
14COMPILEDIR := target/debug
15endif
16
17SERVICE_BIN := pve-lxc-syscalld
18
19COMPILED_BINS := \
20 $(addprefix $(COMPILEDIR)/,$(SERVICE_BIN))
21
22DEB=$(PACKAGE)_$(DEB_VERSION_UPSTREAM_REVISION)_$(DEB_HOST_ARCH).deb
23DSC=$(PACKAGE)_$(DEB_VERSION_UPSTREAM_REVISION).dsc
24BUILDSRC := $(PACKAGE)-$(DEB_VERSION_UPSTREAM)
25
26all: cargo-build $(SUBDIRS)
27
28.PHONY: $(SUBDIRS)
29$(SUBDIRS):
30 $(MAKE) -C $@
31
32.PHONY: cargo-build
33cargo-build:
34 cargo build $(CARGO_BUILD_ARGS)
35
2bf7e188
WB
36.PHONY: test
37test:
38 cargo test
39 cargo fmt --all -- --check
2f7071e0 40 cargo clippy
2bf7e188 41
641af2dd
WB
42$(COMPILED_BINS): cargo-build
43
44install: $(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
63deb: $(DEB)
64$(DEB): $(BUILDSRC)
65 cd $(BUILDSRC); dpkg-buildpackage -b -us -uc --no-pre-clean
66 lintian $(DEB)
67
68.PHONY: dsc
69dsc: $(DSC)
70$(DSC): $(BUILDSRC)
71 cd $(BUILDSRC); dpkg-buildpackage -S -us -uc -d -nc
72 lintian $(DSC)
73
74clean:
75 $(foreach i,$(SUBDIRS), \
76 $(MAKE) -C $(i) clean ;)
77 cargo clean
78 rm -rf *.deb *.dsc *.tar.gz *.buildinfo *.changes $(BUILDSRC)