#!/usr/bin/make -f
# -*- makefile -*-
# Sample debian/rules that uses debhelper.
# This file was originally written by Joey Hess and Craig Small.
# As a special exception, when this file is copied by dh-make into a
# dh-make output file, you may use that output file without restriction.
# This special exception was added by Craig Small in version 0.37 of dh-make.

# Uncomment this to turn on verbose mode.
#export DH_VERBOSE=1

export DEB_BUILD_HARDENING=1

#CFLAGS = -Wall -g
#
#ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS)))
#	CFLAGS += -O0
#else
#	CFLAGS += -O2
#endif

override_dh_auto_configure:
	# Add here commands to configure the package.
	vzdir=/var/lib/vz ./configure \
		--prefix=/usr --libexecdir=/usr/lib/vzctl \
		--sysconfdir=/etc --mandir=/usr/share/man \
		--localstatedir=/var \
		--enable-logrotate \
		--enable-bashcomp \
		--with-vz \
		--without-ploop \
		--with-cgroup \
		--disable-udev		
#		--with-ploop \

override_dh_auto_build:
	# Add here commands to compile the package.
	$(MAKE) vzdir=/var/lib/vz

override_dh_auto_clean:
	# Add here commands to clean up after the build process.
	[ ! -f Makefile ] || $(MAKE) distclean
	-rm config.log config.status

override_dh_auto_install:
	# Add here commands to install the package into debian/vzctl.
	$(MAKE) install install-debian \
		DESTDIR=$(CURDIR)/debian/vzctl \
		vzdir=/var/lib/vz \
		VPSCONFDIR=/etc/vz/conf NETSCRIPTS=
	# Useless udev rules file is not needed #520190
	rm -Rf $(CURDIR)/debian/vzctl/etc/udev
	# Added to fix a lintian error.
	# See https://wiki.debian.org/ReleaseGoals/LAFileRemoval
	sed -i "/dependency_libs/ s/'.*'/''/" `find debian/vzctl -name '*.la'`

%:
	dh $@
