-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
65 lines (51 loc) · 1.87 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
include /usr/share/dpkg/default.mk
PACKAGE=libproxmox-backup-qemu0
ARCH:=$(shell dpkg-architecture -qDEB_BUILD_ARCH)
export GITVERSION:=$(shell git rev-parse HEAD)
MAIN_DEB=${PACKAGE}_${DEB_VERSION}_${ARCH}.deb
OTHER_DEBS= \
${PACKAGE}-dev_${DEB_VERSION}_${ARCH}.deb \
${PACKAGE}-dbgsym_${DEB_VERSION}_${ARCH}.deb
DEBS=$(MAIN_DEB) $(OTHER_DEBS)
DESTDIR=
ifeq ($(BUILD_MODE), release)
CARGO_BUILD_ARGS += --release
endif
all:
ifneq ($(BUILD_MODE), skip)
cargo build $(CARGO_BUILD_ARGS)
diff -up current-api.h proxmox-backup-qemu.h
endif
# always re-create this dir
# but also copy the local target/ dir as a build-cache
.PHONY: build
build:
rm -rf build
cargo build --release
diff -I 'PROXMOX_BACKUP_QEMU_VERSION' -up current-api.h proxmox-backup-qemu.h
rsync -a debian Makefile Cargo.toml Cargo.lock build.rs proxmox-backup-qemu.h src target current-api.h build/
.PHONY: install
install: target/release/libproxmox_backup_qemu.so
install -D -m 0755 target/release/libproxmox_backup_qemu.so ${DESTDIR}/usr/lib//libproxmox_backup_qemu.so.0
cd ${DESTDIR}/usr/lib/; ls *; ln -s libproxmox_backup_qemu.so.0 libproxmox_backup_qemu.so
.PHONY: deb
deb: $(OTHER_DEBS)
$(OTHER_DEBS): $(MAIN_DEB)
$(MAIN_DEB): build
cd build; dpkg-buildpackage -b -us -uc --no-pre-clean
lintian $(DEBS)
simpletest: simpletest.c proxmox-backup-qemu.h
gcc simpletest.c -o simpletest -lc -Wl,-rpath=./target/$(BUILD_MODE) -L ./target/$(BUILD_MODE) -l proxmox_backup_qemu
distclean: clean
clean:
cargo clean
rm -rf *.deb *.dsc *.tar.gz *.buildinfo *.changes Cargo.lock proxmox-backup-qemu.h build
find . -name '*~' -exec rm {} ';'
.PHONY: dinstall
dinstall: ${DEBS}
dpkg -i ${DEBS}
.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 [email protected] upload --product pve --dist buster