2019-01-31 12:43:09 +00:00
|
|
|
include defines.mk
|
2018-11-30 12:39:40 +00:00
|
|
|
|
2018-12-01 12:44:13 +00:00
|
|
|
ARCH:=$(shell dpkg-architecture -qDEB_BUILD_ARCH)
|
|
|
|
GITVERSION:=$(shell git rev-parse HEAD)
|
|
|
|
|
2019-02-24 08:51:10 +00:00
|
|
|
SUBDIRS := etc www docs
|
2019-01-31 14:42:47 +00:00
|
|
|
|
2019-01-31 12:43:09 +00:00
|
|
|
# Binaries usable by users
|
|
|
|
USR_BIN := \
|
|
|
|
proxmox-backup-client \
|
2019-03-14 09:14:32 +00:00
|
|
|
pxar
|
2019-01-31 12:43:09 +00:00
|
|
|
|
|
|
|
# Binaries usable by admins
|
|
|
|
USR_SBIN := proxmox-backup-manager
|
|
|
|
|
|
|
|
# Binaries for services:
|
|
|
|
SERVICE_BIN := \
|
|
|
|
proxmox-backup-api \
|
|
|
|
proxmox-backup-proxy
|
|
|
|
|
2019-01-31 14:42:47 +00:00
|
|
|
ifeq ($(BUILD_MODE), release)
|
|
|
|
CARGO_BUILD_ARGS += --release
|
2019-01-31 12:43:09 +00:00
|
|
|
COMPILEDIR := target/release
|
2019-01-31 14:42:47 +00:00
|
|
|
else
|
|
|
|
COMPILEDIR := target/debug
|
|
|
|
endif
|
|
|
|
|
2019-05-22 13:41:20 +00:00
|
|
|
ifeq ($(valgrind), yes)
|
|
|
|
CARGO_BUILD_ARGS += --features valgrind
|
|
|
|
endif
|
|
|
|
|
2019-01-31 12:43:09 +00:00
|
|
|
COMPILED_BINS := \
|
|
|
|
$(addprefix $(COMPILEDIR)/,$(USR_BIN) $(USR_SBIN) $(SERVICE_BIN))
|
|
|
|
|
2019-11-11 07:35:33 +00:00
|
|
|
DEBS= ${PACKAGE}-server_${PKGVER}-${PKGREL}_${ARCH}.deb ${PACKAGE}-client_${PKGVER}-${PKGREL}_${ARCH}.deb
|
|
|
|
|
2019-12-13 13:14:28 +00:00
|
|
|
DOC_DEB=${PACKAGE}-docs_${PKGVER}-${PKGREL}_all.deb
|
2018-12-01 12:44:13 +00:00
|
|
|
|
|
|
|
DESTDIR=
|
2018-11-30 12:39:40 +00:00
|
|
|
|
2019-01-31 14:42:47 +00:00
|
|
|
all: cargo-build $(SUBDIRS)
|
|
|
|
|
|
|
|
.PHONY: $(SUBDIRS)
|
|
|
|
$(SUBDIRS):
|
|
|
|
$(MAKE) -C $@
|
2018-11-30 12:39:40 +00:00
|
|
|
|
2019-03-07 10:44:48 +00:00
|
|
|
test:
|
2019-05-21 15:54:49 +00:00
|
|
|
#cargo test test_broadcast_future
|
2019-04-27 08:56:49 +00:00
|
|
|
#cargo test $(CARGO_BUILD_ARGS)
|
2019-05-21 15:54:49 +00:00
|
|
|
cargo test $(tests) $(CARGO_BUILD_ARGS)
|
2018-12-19 12:54:22 +00:00
|
|
|
|
2019-03-07 10:44:48 +00:00
|
|
|
doc:
|
2019-02-14 09:17:10 +00:00
|
|
|
cargo doc --no-deps $(CARGO_BUILD_ARGS)
|
2019-02-12 12:27:11 +00:00
|
|
|
|
2019-01-31 14:42:47 +00:00
|
|
|
# always re-create this dir
|
2019-02-01 09:18:50 +00:00
|
|
|
# but also copy the local target/ dir as a build-cache
|
2019-01-31 14:42:47 +00:00
|
|
|
.PHONY: build
|
|
|
|
build:
|
2018-11-30 12:39:40 +00:00
|
|
|
rm -rf build
|
2019-12-16 13:07:14 +00:00
|
|
|
cargo build --release --lib
|
2019-03-06 09:39:00 +00:00
|
|
|
rsync -a debian Makefile defines.mk Cargo.toml Cargo.lock \
|
2019-09-03 06:58:46 +00:00
|
|
|
src zstd-sys $(SUBDIRS) \
|
2019-05-22 10:00:23 +00:00
|
|
|
target tests build/
|
2019-02-01 10:08:36 +00:00
|
|
|
$(foreach i,$(SUBDIRS), \
|
|
|
|
$(MAKE) -C build/$(i) clean ;)
|
2018-11-30 12:39:40 +00:00
|
|
|
|
2019-12-13 13:14:28 +00:00
|
|
|
.PHONY: proxmox-backup-docs
|
|
|
|
proxmox-backup-docs: $(DOC_DEB)
|
|
|
|
$(DOC_DEB): build
|
|
|
|
cd build; dpkg-buildpackage -b -us -uc --no-pre-clean
|
|
|
|
lintian $(DOC_DEB)
|
|
|
|
|
2019-01-31 14:42:47 +00:00
|
|
|
.PHONY: deb
|
2019-11-11 07:35:33 +00:00
|
|
|
deb: $(DEBS)
|
|
|
|
$(DEBS): build
|
2019-12-13 13:14:28 +00:00
|
|
|
cd build; dpkg-buildpackage -b -us -uc --no-pre-clean --build-profiles=nodoc
|
2019-11-11 07:35:33 +00:00
|
|
|
lintian $(DEBS)
|
2019-02-01 09:07:22 +00:00
|
|
|
|
|
|
|
.PHONY: dsc
|
|
|
|
dsc: $(DSC)
|
|
|
|
$(DSC): build
|
|
|
|
cd build; dpkg-buildpackage -S -us -uc -d -nc
|
|
|
|
lintian $(DSC)
|
2018-11-30 12:39:40 +00:00
|
|
|
|
2018-12-01 12:44:13 +00:00
|
|
|
distclean: clean
|
2018-11-30 12:39:40 +00:00
|
|
|
|
|
|
|
clean:
|
2019-02-01 10:08:36 +00:00
|
|
|
$(foreach i,$(SUBDIRS), \
|
|
|
|
$(MAKE) -C $(i) clean ;)
|
2018-11-30 12:39:40 +00:00
|
|
|
cargo clean
|
2019-02-01 09:36:28 +00:00
|
|
|
rm -rf *.deb *.dsc *.tar.gz *.buildinfo *.changes build
|
2018-11-30 16:09:50 +00:00
|
|
|
find . -name '*~' -exec rm {} ';'
|
|
|
|
|
2018-12-01 12:44:13 +00:00
|
|
|
.PHONY: dinstall
|
2019-11-11 07:35:33 +00:00
|
|
|
dinstall: ${DEBS}
|
|
|
|
dpkg -i ${DEBS}
|
2019-01-31 12:43:09 +00:00
|
|
|
|
2019-02-24 08:51:10 +00:00
|
|
|
# make sure we build binaries before docs
|
|
|
|
docs: cargo-build
|
|
|
|
|
2019-01-31 14:42:47 +00:00
|
|
|
.PHONY: cargo-build
|
2019-03-07 10:44:48 +00:00
|
|
|
cargo-build:
|
2019-01-31 14:42:47 +00:00
|
|
|
cargo build $(CARGO_BUILD_ARGS)
|
2019-01-31 12:43:09 +00:00
|
|
|
|
2019-01-31 14:42:47 +00:00
|
|
|
$(COMPILED_BINS): cargo-build
|
2019-01-31 12:43:09 +00:00
|
|
|
|
2019-09-11 11:59:56 +00:00
|
|
|
.PHONY: lint
|
|
|
|
lint:
|
|
|
|
cargo clippy -- -A clippy::all -D clippy::correctness
|
|
|
|
|
2019-01-31 12:43:09 +00:00
|
|
|
install: $(COMPILED_BINS)
|
|
|
|
install -dm755 $(DESTDIR)$(BINDIR)
|
|
|
|
$(foreach i,$(USR_BIN), \
|
|
|
|
install -m755 $(COMPILEDIR)/$(i) $(DESTDIR)$(BINDIR)/ ;)
|
|
|
|
install -dm755 $(DESTDIR)$(SBINDIR)
|
|
|
|
$(foreach i,$(USR_SBIN), \
|
|
|
|
install -m755 $(COMPILEDIR)/$(i) $(DESTDIR)$(SBINDIR)/ ;)
|
2019-02-01 09:05:14 +00:00
|
|
|
install -dm755 $(DESTDIR)$(LIBEXECDIR)/proxmox-backup
|
2019-01-31 12:43:09 +00:00
|
|
|
$(foreach i,$(SERVICE_BIN), \
|
2019-02-01 09:05:14 +00:00
|
|
|
install -m755 $(COMPILEDIR)/$(i) $(DESTDIR)$(LIBEXECDIR)/proxmox-backup/ ;)
|
2019-01-31 12:43:09 +00:00
|
|
|
$(MAKE) -C www install
|
2019-02-24 08:51:10 +00:00
|
|
|
$(MAKE) -C docs install
|
2019-12-13 09:35:43 +00:00
|
|
|
|
|
|
|
.PHONY: upload
|
|
|
|
upload: ${DEBS}
|
|
|
|
# check if working directory is clean
|
|
|
|
git diff --exit-code --stat && git diff --exit-code --stat --staged
|
|
|
|
tar cf - ${DEBS} | ssh -X repoman@repo.proxmox.com upload --product pbs --dist buster
|