]> git.proxmox.com Git - proxmox-backup.git/blob - Makefile
packaging: fix docs install path
[proxmox-backup.git] / Makefile
1 include /usr/share/dpkg/default.mk
2 include defines.mk
3
4 PACKAGE := $(DEB_SOURCE)
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 := proxmox-backup-manager
16
17 # Binaries for services:
18 SERVICE_BIN := \
19 proxmox-backup-api \
20 proxmox-backup-proxy
21
22 ifeq ($(BUILD_MODE), release)
23 CARGO_BUILD_ARGS += --release
24 COMPILEDIR := target/release
25 else
26 COMPILEDIR := target/debug
27 endif
28
29 ifeq ($(valgrind), yes)
30 CARGO_BUILD_ARGS += --features valgrind
31 endif
32
33 CARGO ?= cargo
34
35 COMPILED_BINS := \
36 $(addprefix $(COMPILEDIR)/,$(USR_BIN) $(USR_SBIN) $(SERVICE_BIN))
37
38 DEBS= ${PACKAGE}-server_${DEB_VERSION}_${ARCH}.deb ${PACKAGE}-client_${DEB_VERSION}_${ARCH}.deb
39
40 DOC_DEB=${PACKAGE}-docs_${DEB_VERSION}_all.deb
41
42 DSC = ${PACKAGE}_${DEB_VERSION}.dsc
43
44 DESTDIR=
45
46 all: cargo-build $(SUBDIRS)
47
48 .PHONY: $(SUBDIRS)
49 $(SUBDIRS):
50 $(MAKE) -C $@
51
52 test:
53 #cargo test test_broadcast_future
54 #cargo test $(CARGO_BUILD_ARGS)
55 $(CARGO) test $(tests) $(CARGO_BUILD_ARGS)
56
57 doc:
58 $(CARGO) doc --no-deps $(CARGO_BUILD_ARGS)
59
60 # always re-create this dir
61 .PHONY: build
62 build:
63 rm -rf build
64 rsync -a debian Makefile defines.mk Cargo.toml \
65 src $(SUBDIRS) \
66 tests build/
67 $(foreach i,$(SUBDIRS), \
68 $(MAKE) -C build/$(i) clean ;)
69
70 .PHONY: proxmox-backup-docs
71 proxmox-backup-docs: $(DOC_DEB)
72 $(DOC_DEB): build
73 cd build; dpkg-buildpackage -b -us -uc --no-pre-clean
74 lintian $(DOC_DEB)
75
76 # copy the local target/ dir as a build-cache
77 .PHONY: deb
78 deb: $(DEBS)
79 $(DEBS): build
80 cd build; dpkg-buildpackage -b -us -uc --no-pre-clean --build-profiles=nodoc
81 lintian $(DEBS)
82
83 .PHONY: dsc
84 dsc: $(DSC)
85 $(DSC): build
86 cd build; dpkg-buildpackage -S -us -uc -d -nc
87 lintian $(DSC)
88
89 distclean: clean
90
91 clean:
92 $(foreach i,$(SUBDIRS), \
93 $(MAKE) -C $(i) clean ;)
94 $(CARGO) clean
95 rm -rf *.deb *.dsc *.tar.gz *.buildinfo *.changes build
96 find . -name '*~' -exec rm {} ';'
97
98 .PHONY: dinstall
99 dinstall: ${DEBS}
100 dpkg -i ${DEBS}
101
102 # make sure we build binaries before docs
103 docs: cargo-build
104
105 .PHONY: cargo-build
106 cargo-build:
107 $(CARGO) build $(CARGO_BUILD_ARGS)
108
109 $(COMPILED_BINS): cargo-build
110
111 .PHONY: lint
112 lint:
113 cargo clippy -- -A clippy::all -D clippy::correctness
114
115 install: $(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)/ ;)
122 install -dm755 $(DESTDIR)$(LIBEXECDIR)/proxmox-backup
123 $(foreach i,$(SERVICE_BIN), \
124 install -m755 $(COMPILEDIR)/$(i) $(DESTDIR)$(LIBEXECDIR)/proxmox-backup/ ;)
125 $(MAKE) -C www install
126 $(MAKE) -C docs install
127
128 .PHONY: upload
129 upload: ${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