#!/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




configure: configure-stamp
configure-stamp:
	dh_testdir
	# Add here commands to configure the package.

	touch configure-stamp

	# uncomment the next line if you want
	# translations to be automatically downloaded 
	# at configure time
	# python setup.py get_translations

	python setup.py configure --no-install-init --no-install-man # --no-install-license --no-install-install

	cp -v init/debian/wicd debian/wicd.init
	# cp -v man/wicd.8 debian/wicd.8


build: build-stamp

build-stamp: configure-stamp 
	dh_testdir

	# Add here commands to compile the package.

	python setup.py build
	# rm -f $(CURDIR)/**/*.pyc

	touch $@

clean:
	dh_testdir
	dh_testroot
	rm -f build-stamp configure-stamp

	# Add here commands to clean up after the build process.
	# Remove the build directory
	rm -rf $(CURDIR)/build/
	# Remove the downloaded translations
	# Disabled, because Wicd ships with
	# translations by default
	# rm -rf $(CURDIR)/translations/*
	# Remove the last builds
	rm -rf $(CURDIR)/debian/wicd

	# Clean out all the generated files
	python $(CURDIR)/debian/clean_out.py

	dh_clean 

install: build
	dh_testdir
	dh_testroot
	dh_clean -k 
	dh_installdirs

	# Add here commands to install the package into debian/wicd.
	# $(MAKE) DESTDIR=$(CURDIR)/debian/wicd install
	
	python setup.py install --root $(CURDIR)/debian/wicd --no-compile
	rm -f   $(CURDIR)/debian/wicd/usr/share/doc/wicd/INSTALL \
		$(CURDIR)/debian/wicd/usr/share/doc/wicd/LICENSE


# Build architecture-independent files here.
binary-indep: build install
# We have nothing to do by default.

# Build architecture-dependent files here.
#binary-arch: build install
	dh_testdir
	dh_testroot
	dh_installchangelogs 
	dh_installdocs
	dh_installexamples
#	dh_install
#	dh_installmenu
#	dh_installdebconf	
#	dh_installlogrotate
#	dh_installemacsen
#	dh_installpam
#	dh_installmime
#	dh_python
#	dh_pycentral
	dh_installinit
#	dh_installcron
#	dh_installinfo
	dh_installman man/wicd.8 man/wicd-manager-settings.conf.5 man/wicd-wired-settings.conf.5 man/wicd-wireless-settings.conf.5
	dh_icons
	dh_link
	dh_strip
	dh_compress
	dh_fixperms
#	dh_perl
#	dh_makeshlibs
	dh_installdeb
	dh_shlibdeps
	dh_gencontrol
	dh_md5sums
	dh_builddeb

binary: binary-indep binary-arch
.PHONY: build clean binary-indep binary-arch binary install configure
