]> git.proxmox.com Git - qemu-server.git/blob - Makefile
7f0a3c73430b39699631b3b41ce282dd8b08884a
[qemu-server.git] / Makefile
1 RELEASE=4.2
2
3 VERSION=4.0
4 PACKAGE=qemu-server
5 PKGREL=81
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 make -C PVE install
75 install -m 0755 qm ${DESTDIR}${SBINDIR}
76 install -m 0755 qmrestore ${DESTDIR}${SBINDIR}
77 install -m 0755 pve-bridge ${DESTDIR}${VARLIBDIR}/pve-bridge
78 install -m 0755 pve-bridge-hotplug ${DESTDIR}${VARLIBDIR}/pve-bridge-hotplug
79 install -m 0755 pve-bridgedown ${DESTDIR}${VARLIBDIR}/pve-bridgedown
80 install -s -m 0755 vmtar ${DESTDIR}${LIBDIR}
81 install -s -m 0755 sparsecp ${DESTDIR}${LIBDIR}
82 install -D -m 0644 modules-load.conf ${DESTDIR}/etc/modules-load.d/qemu-server.conf
83 install -m 0755 qmextract ${DESTDIR}${LIBDIR}
84 install -m 0644 qm.1 ${DESTDIR}/${MAN1DIR}
85 gzip -9 ${DESTDIR}/${MAN1DIR}/qm.1
86 install -m 0644 qmrestore.1 ${DESTDIR}/${MAN1DIR}
87 gzip -9 ${DESTDIR}/${MAN1DIR}/qmrestore.1
88 install -m 0644 qm.conf.5 ${DESTDIR}/${MAN5DIR}
89 gzip -9 ${DESTDIR}/${MAN5DIR}/qm.conf.5
90 cd ${DESTDIR}/${MAN5DIR}; ln -s qm.conf.5.gz vm.conf.5.gz
91
92 .PHONY: deb ${DEB}
93 deb ${DEB}: ${PKGSOURCES}
94 rm -rf build
95 mkdir build
96 make DESTDIR=${CURDIR}/build install
97 perl -I. ./qm verifyapi
98 install -d -m 0755 build/DEBIAN
99 install -m 0644 control build/DEBIAN
100 install -m 0644 triggers build/DEBIAN
101 echo "/etc/modules-load.d/qemu-server.conf" >>build/DEBIAN/conffiles
102 install -D -m 0644 copyright build/${DOCDIR}/${PACKAGE}/copyright
103 install -m 0644 changelog.Debian build/${DOCDIR}/${PACKAGE}/
104 gzip -9 build/${DOCDIR}/${PACKAGE}/changelog.Debian
105 echo "git clone git://git.proxmox.com/git/qemu-server.git\\ngit checkout ${GITVERSION}" > build/${DOCDIR}/${PACKAGE}/SOURCE
106 dpkg-deb --build build
107 mv build.deb ${DEB}
108 lintian ${DEB}
109
110 .PHONY: upload
111 upload:
112 umount /pve/${RELEASE}; mount /pve/${RELEASE} -o rw
113 mkdir -p /pve/${RELEASE}/extra
114 rm -rf /pve/${RELEASE}/extra/${PACKAGE}_*.deb
115 rm -rf /pve/${RELEASE}/extra/Packages*
116 cp ${DEB} /pve/${RELEASE}/extra
117 cd /pve/${RELEASE}/extra; dpkg-scanpackages . /dev/null > Packages; gzip -9c Packages > Packages.gz
118 umount /pve/${RELEASE}; mount /pve/${RELEASE} -o ro
119
120 .PHONY: clean
121 clean:
122 make cleanup-docgen
123 rm -rf build *.deb control vzsyscalls.ph _h2ph_pre.ph ${PACKAGE}-*.tar.gz dist *.1 *.5 *.pod vmtar sparsecp *.tmp *.bash-completion
124 find . -name '*~' -exec rm {} ';'
125
126
127 .PHONY: distclean
128 distclean: clean