]> git.proxmox.com Git - proxmox-backup.git/blob - Makefile
client: check fingerprint after downloading manifest
[proxmox-backup.git] / Makefile
1 include /usr/share/dpkg/default.mk
2 include defines.mk
3
4 PACKAGE := proxmox-backup
5 ARCH := $(DEB_BUILD_ARCH)
6
7 SUBDIRS := etc www docs
8
9 # Binaries usable by users
10 USR_BIN := \
11 proxmox-backup-client \
12 pxar
13
14 # Binaries usable by admins
15 USR_SBIN := \
16 proxmox-backup-manager
17
18 # Binaries for services:
19 SERVICE_BIN := \
20 proxmox-backup-api \
21 proxmox-backup-banner \
22 proxmox-backup-proxy \
23 proxmox-daily-update \
24
25 ifeq ($(BUILD_MODE), release)
26 CARGO_BUILD_ARGS += --release
27 COMPILEDIR := target/release
28 else
29 COMPILEDIR := target/debug
30 endif
31
32 ifeq ($(valgrind), yes)
33 CARGO_BUILD_ARGS += --features valgrind
34 endif
35
36 CARGO ?= cargo
37
38 COMPILED_BINS := \
39 $(addprefix $(COMPILEDIR)/,$(USR_BIN) $(USR_SBIN) $(SERVICE_BIN))
40
41 export DEB_VERSION DEB_VERSION_UPSTREAM
42
43 SERVER_DEB=${PACKAGE}-server_${DEB_VERSION}_${ARCH}.deb
44 SERVER_DBG_DEB=${PACKAGE}-server-dbgsym_${DEB_VERSION}_${ARCH}.deb
45 CLIENT_DEB=${PACKAGE}-client_${DEB_VERSION}_${ARCH}.deb
46 CLIENT_DBG_DEB=${PACKAGE}-client-dbgsym_${DEB_VERSION}_${ARCH}.deb
47 DOC_DEB=${PACKAGE}-docs_${DEB_VERSION}_all.deb
48
49 DEBS=${SERVER_DEB} ${SERVER_DBG_DEB} ${CLIENT_DEB} ${CLIENT_DBG_DEB}
50
51 DSC = rust-${PACKAGE}_${DEB_VERSION}.dsc
52
53 DESTDIR=
54
55 all: cargo-build $(SUBDIRS)
56
57 .PHONY: $(SUBDIRS)
58 $(SUBDIRS):
59 $(MAKE) -C $@
60
61 test:
62 #cargo test test_broadcast_future
63 #cargo test $(CARGO_BUILD_ARGS)
64 $(CARGO) test $(tests) $(CARGO_BUILD_ARGS)
65
66 doc:
67 $(CARGO) doc --no-deps $(CARGO_BUILD_ARGS)
68
69 # always re-create this dir
70 .PHONY: build
71 build:
72 rm -rf build
73 rm -f debian/control
74 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/-.*//')
75 sed -e '1,/^$$/ ! d' build/debian/control > build/debian/control.src
76 cat build/debian/control.src build/debian/control.in > build/debian/control
77 rm build/debian/control.in build/debian/control.src
78 cp build/debian/control debian/control
79 rm build/Cargo.lock
80 find build/debian -name "*.hint" -delete
81 $(foreach i,$(SUBDIRS), \
82 $(MAKE) -C build/$(i) clean ;)
83
84
85 .PHONY: proxmox-backup-docs
86 $(DOC_DEB) $(DEBS): proxmox-backup-docs
87 proxmox-backup-docs: build
88 cd build; dpkg-buildpackage -b -us -uc --no-pre-clean
89 lintian $(DOC_DEB)
90
91 # copy the local target/ dir as a build-cache
92 .PHONY: deb
93 $(DEBS): deb
94 deb: build
95 cd build; dpkg-buildpackage -b -us -uc --no-pre-clean --build-profiles=nodoc
96 lintian $(DEBS)
97
98 .PHONY: deb-all
99 deb-all: $(DOC_DEB) $(DEBS)
100
101 .PHONY: dsc
102 dsc: $(DSC)
103 $(DSC): build
104 cd build; dpkg-buildpackage -S -us -uc -d -nc
105 lintian $(DSC)
106
107 distclean: clean
108
109 clean:
110 $(foreach i,$(SUBDIRS), \
111 $(MAKE) -C $(i) clean ;)
112 $(CARGO) clean
113 rm -rf *.deb *.dsc *.tar.gz *.buildinfo *.changes build
114 find . -name '*~' -exec rm {} ';'
115
116 .PHONY: dinstall
117 dinstall: ${DEBS}
118 dpkg -i ${DEBS}
119
120 # make sure we build binaries before docs
121 docs: cargo-build
122
123 .PHONY: cargo-build
124 cargo-build:
125 $(CARGO) build $(CARGO_BUILD_ARGS)
126
127 $(COMPILED_BINS): cargo-build
128
129 .PHONY: lint
130 lint:
131 cargo clippy -- -A clippy::all -D clippy::correctness
132
133 install: $(COMPILED_BINS)
134 install -dm755 $(DESTDIR)$(BINDIR)
135 install -dm755 $(DESTDIR)$(ZSH_COMPL_DEST)
136 $(foreach i,$(USR_BIN), \
137 install -m755 $(COMPILEDIR)/$(i) $(DESTDIR)$(BINDIR)/ ; \
138 install -m644 zsh-completions/_$(i) $(DESTDIR)$(ZSH_COMPL_DEST)/ ;)
139 install -dm755 $(DESTDIR)$(SBINDIR)
140 $(foreach i,$(USR_SBIN), \
141 install -m755 $(COMPILEDIR)/$(i) $(DESTDIR)$(SBINDIR)/ ; \
142 install -m644 zsh-completions/_$(i) $(DESTDIR)$(ZSH_COMPL_DEST)/ ;)
143 install -dm755 $(DESTDIR)$(LIBEXECDIR)/proxmox-backup
144 $(foreach i,$(SERVICE_BIN), \
145 install -m755 $(COMPILEDIR)/$(i) $(DESTDIR)$(LIBEXECDIR)/proxmox-backup/ ;)
146 $(MAKE) -C www install
147 $(MAKE) -C docs install
148
149 .PHONY: upload
150 upload: ${SERVER_DEB} ${CLIENT_DEB} ${DOC_DEB}
151 # check if working directory is clean
152 git diff --exit-code --stat && git diff --exit-code --stat --staged
153 tar cf - ${SERVER_DEB} ${SERVER_DBG_DEB} ${DOC_DEB} | ssh -X repoman@repo.proxmox.com upload --product pbs --dist buster
154 tar cf - ${CLIENT_DEB} ${CLIENT_DBG_DEB} | ssh -X repoman@repo.proxmox.com upload --product "pbs,pve,pmg" --dist buster