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