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