]> git.proxmox.com Git - proxmox-backup.git/blame - Makefile
add login banner service
[proxmox-backup.git] / Makefile
CommitLineData
da0e1e40 1include /usr/share/dpkg/default.mk
6285b251 2include defines.mk
de779814 3
e881b8a5 4PACKAGE := proxmox-backup
da0e1e40 5ARCH := $(DEB_BUILD_ARCH)
209bb433 6
bb5c7707 7SUBDIRS := etc www docs
13b77d10 8
6285b251
WB
9# Binaries usable by users
10USR_BIN := \
11 proxmox-backup-client \
7c4dd946 12 pxar
6285b251
WB
13
14# Binaries usable by admins
274b0c7b
TL
15USR_SBIN := proxmox-backup-manager \
16 pbsbanner
6285b251
WB
17
18# Binaries for services:
19SERVICE_BIN := \
20 proxmox-backup-api \
21 proxmox-backup-proxy
22
13b77d10
WB
23ifeq ($(BUILD_MODE), release)
24CARGO_BUILD_ARGS += --release
6285b251 25COMPILEDIR := target/release
13b77d10
WB
26else
27COMPILEDIR := target/debug
28endif
29
6f0069ae
WB
30ifeq ($(valgrind), yes)
31CARGO_BUILD_ARGS += --features valgrind
32endif
33
da0e1e40
FG
34CARGO ?= cargo
35
6285b251
WB
36COMPILED_BINS := \
37 $(addprefix $(COMPILEDIR)/,$(USR_BIN) $(USR_SBIN) $(SERVICE_BIN))
38
da0e1e40
FG
39DEBS= ${PACKAGE}-server_${DEB_VERSION}_${ARCH}.deb ${PACKAGE}-client_${DEB_VERSION}_${ARCH}.deb
40
41DOC_DEB=${PACKAGE}-docs_${DEB_VERSION}_all.deb
36d74cd6 42
e881b8a5 43DSC = rust-${PACKAGE}_${DEB_VERSION}.dsc
209bb433
DM
44
45DESTDIR=
de779814 46
13b77d10
WB
47all: cargo-build $(SUBDIRS)
48
49.PHONY: $(SUBDIRS)
50$(SUBDIRS):
51 $(MAKE) -C $@
de779814 52
cd3b9a06 53test:
cc119edb 54 #cargo test test_broadcast_future
3dceb9b3 55 #cargo test $(CARGO_BUILD_ARGS)
da0e1e40 56 $(CARGO) test $(tests) $(CARGO_BUILD_ARGS)
f7dd683b 57
cd3b9a06 58doc:
da0e1e40 59 $(CARGO) doc --no-deps $(CARGO_BUILD_ARGS)
d78345bc 60
13b77d10
WB
61# always re-create this dir
62.PHONY: build
63build:
de779814 64 rm -rf build
e881b8a5
FG
65 debcargo package --config debian/debcargo.toml --changelog-ready --no-overlay-write-back --directory build proxmox-backup $(shell dpkg-parsechangelog -l debian/changelog -SVersion | sed -e 's/-.*//')
66 sed -e '1,/^$$/ ! d' build/debian/control > build/debian/control.src
67 cat build/debian/control.src build/debian/control.in > build/debian/control
68 rm build/debian/control.in build/debian/control.src
69 rm build/Cargo.lock
70 find build/debian -name "*.hint" -delete
b369f720
WB
71 $(foreach i,$(SUBDIRS), \
72 $(MAKE) -C build/$(i) clean ;)
de779814 73
e881b8a5 74
720776b8
DM
75.PHONY: proxmox-backup-docs
76proxmox-backup-docs: $(DOC_DEB)
77$(DOC_DEB): build
78 cd build; dpkg-buildpackage -b -us -uc --no-pre-clean
79 lintian $(DOC_DEB)
80
da0e1e40 81# copy the local target/ dir as a build-cache
13b77d10 82.PHONY: deb
36d74cd6
DM
83deb: $(DEBS)
84$(DEBS): build
720776b8 85 cd build; dpkg-buildpackage -b -us -uc --no-pre-clean --build-profiles=nodoc
36d74cd6 86 lintian $(DEBS)
18fad344
WB
87
88.PHONY: dsc
89dsc: $(DSC)
90$(DSC): build
91 cd build; dpkg-buildpackage -S -us -uc -d -nc
92 lintian $(DSC)
de779814 93
209bb433 94distclean: clean
de779814
DM
95
96clean:
b369f720
WB
97 $(foreach i,$(SUBDIRS), \
98 $(MAKE) -C $(i) clean ;)
da0e1e40 99 $(CARGO) clean
1a9cb80c 100 rm -rf *.deb *.dsc *.tar.gz *.buildinfo *.changes build
d3cb69c4
DM
101 find . -name '*~' -exec rm {} ';'
102
209bb433 103.PHONY: dinstall
36d74cd6
DM
104dinstall: ${DEBS}
105 dpkg -i ${DEBS}
6285b251 106
bb5c7707
DM
107# make sure we build binaries before docs
108docs: cargo-build
109
13b77d10 110.PHONY: cargo-build
cd3b9a06 111cargo-build:
da0e1e40 112 $(CARGO) build $(CARGO_BUILD_ARGS)
6285b251 113
13b77d10 114$(COMPILED_BINS): cargo-build
6285b251 115
d1596102
WB
116.PHONY: lint
117lint:
118 cargo clippy -- -A clippy::all -D clippy::correctness
119
6285b251
WB
120install: $(COMPILED_BINS)
121 install -dm755 $(DESTDIR)$(BINDIR)
122 $(foreach i,$(USR_BIN), \
123 install -m755 $(COMPILEDIR)/$(i) $(DESTDIR)$(BINDIR)/ ;)
124 install -dm755 $(DESTDIR)$(SBINDIR)
125 $(foreach i,$(USR_SBIN), \
126 install -m755 $(COMPILEDIR)/$(i) $(DESTDIR)$(SBINDIR)/ ;)
304db5da 127 install -dm755 $(DESTDIR)$(LIBEXECDIR)/proxmox-backup
6285b251 128 $(foreach i,$(SERVICE_BIN), \
304db5da 129 install -m755 $(COMPILEDIR)/$(i) $(DESTDIR)$(LIBEXECDIR)/proxmox-backup/ ;)
6285b251 130 $(MAKE) -C www install
bb5c7707 131 $(MAKE) -C docs install
729e38f4
DM
132
133.PHONY: upload
134upload: ${DEBS}
135 # check if working directory is clean
136 git diff --exit-code --stat && git diff --exit-code --stat --staged
137 tar cf - ${DEBS} | ssh -X repoman@repo.proxmox.com upload --product pbs --dist buster