]>
Commit | Line | Data |
---|---|---|
1 | RELEASE=4.3 | |
2 | ||
3 | VERSION=4.0 | |
4 | PACKAGE=qemu-server | |
5 | PKGREL=94 | |
6 | ||
7 | CFLAGS= -O2 -Werror -Wall -Wtype-limits -Wl,-z,relro | |
8 | ||
9 | DESTDIR= | |
10 | PREFIX=/usr | |
11 | BINDIR=${PREFIX}/bin | |
12 | SBINDIR=${PREFIX}/sbin | |
13 | BINDIR=${PREFIX}/bin | |
14 | LIBDIR=${PREFIX}/lib/${PACKAGE} | |
15 | VARLIBDIR=/var/lib/${PACKAGE} | |
16 | MANDIR=${PREFIX}/share/man | |
17 | DOCDIR=${PREFIX}/share/doc | |
18 | MAN1DIR=${MANDIR}/man1/ | |
19 | MAN5DIR=${MANDIR}/man5/ | |
20 | BASHCOMPLDIR=${PREFIX}/share/bash-completion/completions/ | |
21 | export PERLDIR=${PREFIX}/share/perl5 | |
22 | PERLINCDIR=${PERLDIR}/asm-x86_64 | |
23 | ||
24 | ARCH:=$(shell dpkg-architecture -qDEB_BUILD_ARCH) | |
25 | GITVERSION:=$(shell cat .git/refs/heads/master) | |
26 | ||
27 | DEB=${PACKAGE}_${VERSION}-${PKGREL}_${ARCH}.deb | |
28 | ||
29 | # this requires package pve-doc-generator | |
30 | export NOVIEW=1 | |
31 | include /usr/share/pve-doc-generator/pve-doc-generator.mk | |
32 | ||
33 | all: ${DEB} | |
34 | ||
35 | .PHONY: dinstall | |
36 | dinstall: deb | |
37 | dpkg -i ${DEB} | |
38 | ||
39 | control: control.in | |
40 | sed -e s/@@VERSION@@/${VERSION}/ -e s/@@PKGRELEASE@@/${PKGREL}/ -e s/@@ARCH@@/${ARCH}/<$< >$@ | |
41 | ||
42 | vzsyscalls.ph: vzsyscalls.h | |
43 | h2ph -d . vzsyscalls.h | |
44 | ||
45 | vmtar: vmtar.c utils.c | |
46 | gcc ${CFLAGS} -o vmtar vmtar.c | |
47 | ||
48 | sparsecp: sparsecp.c utils.c | |
49 | gcc ${CFLAGS} -o sparsecp sparsecp.c | |
50 | ||
51 | qm.bash-completion: | |
52 | perl -I. -T -e "use PVE::CLI::qm; PVE::CLI::qm->generate_bash_completions();" >$@.tmp | |
53 | mv $@.tmp $@ | |
54 | ||
55 | qmrestore.bash-completion: | |
56 | perl -I. -T -e "use PVE::CLI::qmrestore; PVE::CLI::qmrestore->generate_bash_completions();" >$@.tmp | |
57 | mv $@.tmp $@ | |
58 | ||
59 | PKGSOURCES=qm qm.1 qmrestore qmrestore.1 qmextract sparsecp vmtar control qm.conf.5 qm.bash-completion qmrestore.bash-completion | |
60 | ||
61 | .PHONY: install | |
62 | install: ${PKGSOURCES} | |
63 | install -d ${DESTDIR}/${SBINDIR} | |
64 | install -d ${DESTDIR}${LIBDIR} | |
65 | install -d ${DESTDIR}${VARLIBDIR} | |
66 | install -d ${DESTDIR}/${MAN1DIR} | |
67 | install -d ${DESTDIR}/${MAN5DIR} | |
68 | install -d ${DESTDIR}/usr/share/man/man5 | |
69 | install -d ${DESTDIR}/usr/share/${PACKAGE} | |
70 | install -m 0644 pve-usb.cfg ${DESTDIR}/usr/share/${PACKAGE} | |
71 | install -m 0644 pve-q35.cfg ${DESTDIR}/usr/share/${PACKAGE} | |
72 | install -m 0644 -D qm.bash-completion ${DESTDIR}/${BASHCOMPLDIR}/qm | |
73 | install -m 0644 -D qmrestore.bash-completion ${DESTDIR}/${BASHCOMPLDIR}/qmrestore | |
74 | install -m 0644 -D bootsplash.jpg ${DESTDIR}/usr/share/${PACKAGE} | |
75 | make -C PVE install | |
76 | install -m 0755 qm ${DESTDIR}${SBINDIR} | |
77 | install -m 0755 qmrestore ${DESTDIR}${SBINDIR} | |
78 | install -m 0755 pve-bridge ${DESTDIR}${VARLIBDIR}/pve-bridge | |
79 | install -m 0755 pve-bridge-hotplug ${DESTDIR}${VARLIBDIR}/pve-bridge-hotplug | |
80 | install -m 0755 pve-bridgedown ${DESTDIR}${VARLIBDIR}/pve-bridgedown | |
81 | install -s -m 0755 vmtar ${DESTDIR}${LIBDIR} | |
82 | install -s -m 0755 sparsecp ${DESTDIR}${LIBDIR} | |
83 | install -D -m 0644 modules-load.conf ${DESTDIR}/etc/modules-load.d/qemu-server.conf | |
84 | install -m 0755 qmextract ${DESTDIR}${LIBDIR} | |
85 | install -m 0644 qm.1 ${DESTDIR}/${MAN1DIR} | |
86 | gzip -9 ${DESTDIR}/${MAN1DIR}/qm.1 | |
87 | install -m 0644 qmrestore.1 ${DESTDIR}/${MAN1DIR} | |
88 | gzip -9 ${DESTDIR}/${MAN1DIR}/qmrestore.1 | |
89 | install -m 0644 qm.conf.5 ${DESTDIR}/${MAN5DIR} | |
90 | gzip -9 ${DESTDIR}/${MAN5DIR}/qm.conf.5 | |
91 | cd ${DESTDIR}/${MAN5DIR}; ln -s qm.conf.5.gz vm.conf.5.gz | |
92 | ||
93 | .PHONY: deb | |
94 | deb ${DEB}: ${PKGSOURCES} | |
95 | rm -f *.deb | |
96 | rm -rf build | |
97 | mkdir build | |
98 | make DESTDIR=${CURDIR}/build install | |
99 | perl -I. ./qm verifyapi | |
100 | install -d -m 0755 build/DEBIAN | |
101 | install -m 0644 control build/DEBIAN | |
102 | install -m 0644 triggers build/DEBIAN | |
103 | echo "/etc/modules-load.d/qemu-server.conf" >>build/DEBIAN/conffiles | |
104 | install -D -m 0644 copyright build/${DOCDIR}/${PACKAGE}/copyright | |
105 | install -m 0644 changelog.Debian build/${DOCDIR}/${PACKAGE}/ | |
106 | gzip -9 build/${DOCDIR}/${PACKAGE}/changelog.Debian | |
107 | echo "git clone git://git.proxmox.com/git/qemu-server.git\\ngit checkout ${GITVERSION}" > build/${DOCDIR}/${PACKAGE}/SOURCE | |
108 | dpkg-deb --build build | |
109 | mv build.deb ${DEB} | |
110 | lintian ${DEB} | |
111 | ||
112 | .PHONY: upload | |
113 | upload: ${DEB} | |
114 | tar cf - ${DEB} | ssh repoman@repo.proxmox.com upload | |
115 | ||
116 | .PHONY: clean | |
117 | clean: | |
118 | make cleanup-docgen | |
119 | rm -rf build *.deb control vzsyscalls.ph _h2ph_pre.ph ${PACKAGE}-*.tar.gz dist *.1 *.5 *.pod vmtar sparsecp *.tmp *.bash-completion | |
120 | find . -name '*~' -exec rm {} ';' | |
121 | ||
122 | ||
123 | .PHONY: distclean | |
124 | distclean: clean |