2017-03-13 14:00:25 +03:00
VERSION = 5.0
2011-08-23 09:47:04 +04:00
PACKAGE = qemu-server
2019-02-01 15:05:50 +03:00
PKGREL = 46
2011-08-23 09:47:04 +04:00
2018-11-19 17:18:01 +03:00
CFLAGS += -O2 -Werror -Wall -Wextra -Wpedantic -Wtype-limits -Wl,-z,relro -std= gnu11
2018-11-14 16:59:56 +03:00
JSON_CFLAGS = $( shell pkg-config --cflags json-c)
JSON_LIBS = $( shell pkg-config --libs json-c)
2015-02-27 18:01:51 +03:00
2011-08-23 09:47:04 +04:00
DESTDIR =
PREFIX = /usr
BINDIR = ${ PREFIX } /bin
SBINDIR = ${ PREFIX } /sbin
BINDIR = ${ PREFIX } /bin
LIBDIR = ${ PREFIX } /lib/${ PACKAGE }
2018-11-14 16:59:56 +03:00
SERVICEDIR = /lib/systemd/system
2011-08-23 09:47:04 +04:00
VARLIBDIR = /var/lib/${ PACKAGE }
MANDIR = ${ PREFIX } /share/man
DOCDIR = ${ PREFIX } /share/doc
MAN1DIR = ${ MANDIR } /man1/
2016-04-09 11:11:36 +03:00
MAN5DIR = ${ MANDIR } /man5/
2018-11-14 16:59:56 +03:00
MAN8DIR = ${ MANDIR } /man8/
2015-09-06 16:44:53 +03:00
BASHCOMPLDIR = ${ PREFIX } /share/bash-completion/completions/
2011-08-23 09:47:04 +04:00
export PERLDIR = ${ PREFIX } /share/perl5
PERLINCDIR = ${ PERLDIR } /asm-x86_64
ARCH := $( shell dpkg-architecture -qDEB_BUILD_ARCH)
2018-02-27 12:11:51 +03:00
GITVERSION := $( shell git rev-parse HEAD)
2013-09-05 15:05:47 +04:00
2011-08-23 09:47:04 +04:00
DEB = ${ PACKAGE } _${ VERSION } -${ PKGREL } _${ ARCH } .deb
2018-11-19 16:41:14 +03:00
DBG_DEB = ${ PACKAGE } -dbgsym_${ VERSION } -${ PKGREL } _${ ARCH } .deb
DEBS = ${ DEB } ${ DBG_DEB }
2011-08-23 09:47:04 +04:00
2016-04-08 08:36:29 +03:00
# this requires package pve-doc-generator
export NOVIEW = 1
i n c l u d e / u s r / s h a r e / p v e - d o c - g e n e r a t o r / p v e - d o c - g e n e r a t o r . m k
2017-06-09 19:37:03 +03:00
export SOURCE_DATE_EPOCH ?= $( shell dpkg-parsechangelog -STimestamp)
all :
2011-08-23 09:47:04 +04:00
.PHONY : dinstall
dinstall : deb
dpkg -i ${ DEB }
2018-11-14 16:59:56 +03:00
qmeventd : qmeventd .c
$( CC) $( CFLAGS) ${ JSON_CFLAGS } -o $@ $< ${ JSON_LIBS }
2015-09-06 16:44:53 +03:00
qm.bash-completion :
2017-02-06 18:12:18 +03:00
PVE_GENERATING_DOCS = 1 perl -I. -T -e "use PVE::CLI::qm; PVE::CLI::qm->generate_bash_completions();" >$@ .tmp
2015-09-06 16:44:53 +03:00
mv $@ .tmp $@
2011-08-23 09:47:04 +04:00
2015-10-05 14:10:24 +03:00
qmrestore.bash-completion :
2017-02-06 18:12:18 +03:00
PVE_GENERATING_DOCS = 1 perl -I. -T -e "use PVE::CLI::qmrestore; PVE::CLI::qmrestore->generate_bash_completions();" >$@ .tmp
2015-10-05 14:10:24 +03:00
mv $@ .tmp $@
2011-10-17 15:49:48 +04:00
2018-11-14 16:59:56 +03:00
PKGSOURCES = qm qm.1 qmrestore qmrestore.1 qmextract qm.conf.5 qm.bash-completion qmrestore.bash-completion qmeventd qmeventd.8
2011-08-23 09:47:04 +04:00
.PHONY : install
install : ${PKGSOURCES }
install -d ${ DESTDIR } /${ SBINDIR }
install -d ${ DESTDIR } ${ LIBDIR }
install -d ${ DESTDIR } ${ VARLIBDIR }
2018-11-14 16:59:56 +03:00
install -d ${ DESTDIR } ${ SERVICEDIR }
2016-04-09 11:11:36 +03:00
install -d ${ DESTDIR } /${ MAN1DIR }
install -d ${ DESTDIR } /${ MAN5DIR }
2018-11-14 16:59:56 +03:00
install -d ${ DESTDIR } /${ MAN8DIR }
2011-08-23 09:47:04 +04:00
install -d ${ DESTDIR } /usr/share/man/man5
install -d ${ DESTDIR } /usr/share/${ PACKAGE }
install -m 0644 pve-usb.cfg ${ DESTDIR } /usr/share/${ PACKAGE }
2014-05-26 11:49:56 +04:00
install -m 0644 pve-q35.cfg ${ DESTDIR } /usr/share/${ PACKAGE }
2015-09-06 16:44:53 +03:00
install -m 0644 -D qm.bash-completion ${ DESTDIR } /${ BASHCOMPLDIR } /qm
2015-10-05 14:10:24 +03:00
install -m 0644 -D qmrestore.bash-completion ${ DESTDIR } /${ BASHCOMPLDIR } /qmrestore
2016-09-08 10:25:57 +03:00
install -m 0644 -D bootsplash.jpg ${ DESTDIR } /usr/share/${ PACKAGE }
2011-08-23 09:47:04 +04:00
make -C PVE install
install -m 0755 qm ${ DESTDIR } ${ SBINDIR }
install -m 0755 qmrestore ${ DESTDIR } ${ SBINDIR }
2018-11-14 16:59:56 +03:00
install -m 0755 qmeventd ${ DESTDIR } ${ SBINDIR }
install -m 0644 qmeventd.service ${ DESTDIR } ${ SERVICEDIR }
2011-08-23 09:47:04 +04:00
install -m 0755 pve-bridge ${ DESTDIR } ${ VARLIBDIR } /pve-bridge
2015-11-06 17:05:59 +03:00
install -m 0755 pve-bridge-hotplug ${ DESTDIR } ${ VARLIBDIR } /pve-bridge-hotplug
2014-05-07 12:42:43 +04:00
install -m 0755 pve-bridgedown ${ DESTDIR } ${ VARLIBDIR } /pve-bridgedown
2015-02-27 18:01:51 +03:00
install -D -m 0644 modules-load.conf ${ DESTDIR } /etc/modules-load.d/qemu-server.conf
2011-10-17 15:49:48 +04:00
install -m 0755 qmextract ${ DESTDIR } ${ LIBDIR }
2016-04-09 11:11:36 +03:00
install -m 0644 qm.1 ${ DESTDIR } /${ MAN1DIR }
2017-09-13 17:10:21 +03:00
gzip -9 -n -f ${ DESTDIR } /${ MAN1DIR } /qm.1
2018-11-14 16:59:56 +03:00
install -m 0644 qmeventd.8 ${ DESTDIR } /${ MAN8DIR }
gzip -9 -n -f ${ DESTDIR } /${ MAN8DIR } /qmeventd.8
2016-04-09 11:11:36 +03:00
install -m 0644 qmrestore.1 ${ DESTDIR } /${ MAN1DIR }
2017-09-13 17:10:21 +03:00
gzip -9 -n -f ${ DESTDIR } /${ MAN1DIR } /qmrestore.1
2016-04-09 11:11:36 +03:00
install -m 0644 qm.conf.5 ${ DESTDIR } /${ MAN5DIR }
2017-09-13 17:10:21 +03:00
gzip -9 -n -f ${ DESTDIR } /${ MAN5DIR } /qm.conf.5
cd ${ DESTDIR } /${ MAN5DIR } ; ln -s -f qm.conf.5.gz vm.conf.5.gz
2011-08-23 09:47:04 +04:00
2016-07-04 09:33:57 +03:00
.PHONY : deb
2018-11-19 16:41:14 +03:00
deb : ${DEBS }
${DBG_DEB} : ${DEB }
2017-06-09 19:37:03 +03:00
${DEB} :
2011-08-24 13:08:33 +04:00
rm -rf build
2017-06-09 19:37:03 +03:00
rsync -a * build
echo " git clone git://git.proxmox.com/git/qemu-server.git\\ngit checkout ${ GITVERSION } " > build/debian/SOURCE
2017-06-12 11:00:25 +03:00
cd build; dpkg-buildpackage -b -us -uc
2018-11-19 16:41:14 +03:00
lintian ${ DEBS }
2011-08-23 09:47:04 +04:00
2017-06-09 19:37:03 +03:00
.PHONY : test
test :
PVE_GENERATING_DOCS = 1 perl -I. ./qm verifyapi
2017-05-17 13:40:58 +03:00
make -C test
2011-08-23 09:47:04 +04:00
.PHONY : upload
2016-06-28 09:20:50 +03:00
upload : ${DEB }
2018-11-19 16:41:14 +03:00
tar cf - ${ DEBS } | ssh repoman@repo.proxmox.com upload --product pve --dist stretch
2011-08-23 09:47:04 +04:00
.PHONY : clean
2017-06-09 19:37:03 +03:00
clean :
2016-04-08 08:36:29 +03:00
make cleanup-docgen
2018-11-14 16:59:56 +03:00
rm -rf build *.deb *.buildinfo *.changes qmeventd
2011-08-23 09:47:04 +04:00
find . -name '*~' -exec rm { } ';'
.PHONY : distclean
distclean : clean