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




CFLAGS = -Wall -g

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

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

	touch configure-stamp


build: build-stamp

build-stamp: configure-stamp
	dh_testdir
	touch build-stamp
	$(MAKE)

clean:
	dh_testdir
	dh_testroot
	rm -f build-stamp configure-stamp
	-$(MAKE) clean
	dh_clean

install: build
	dh_testdir
	dh_testroot
	dh_clean -k
	dh_installdirs

	# ======================================================
	#$(MAKE) DESTDIR="$(CURDIR)/debian/fheroes2" install
	mkdir -p "$(CURDIR)/debian/fheroes2"
	mkdir -p "$(CURDIR)/debian/fheroes2/opt/fheroes2/files/maps/"
	mkdir -p "$(CURDIR)/debian/fheroes2/opt/fheroes2/files/data/"
	mkdir -p "$(CURDIR)/debian/fheroes2/opt/fheroes2/files/lang/fr/LC_MESSAGES/"
	cp -a "instsrc/opt/fheroes2/files/lang/fr/LC_MESSAGES/Makefile" "$(CURDIR)/debian/fheroes2/opt/fheroes2/files/lang/fr/LC_MESSAGES/Makefile"
	mkdir -p "$(CURDIR)/debian/fheroes2/opt/fheroes2/files/lang/fr/LC_MESSAGES/"
	cp -a "instsrc/opt/fheroes2/files/lang/fr/LC_MESSAGES/fheroes2.po" "$(CURDIR)/debian/fheroes2/opt/fheroes2/files/lang/fr/LC_MESSAGES/fheroes2.po"
	mkdir -p "$(CURDIR)/debian/fheroes2/opt/fheroes2/files/images/"
	cp -a "instsrc/opt/fheroes2/files/images/README" "$(CURDIR)/debian/fheroes2/opt/fheroes2/files/images/README"
	mkdir -p "$(CURDIR)/debian/fheroes2/opt/fheroes2/files/lang/es/LC_MESSAGES/"
	cp -a "instsrc/opt/fheroes2/files/lang/es/LC_MESSAGES/Makefile" "$(CURDIR)/debian/fheroes2/opt/fheroes2/files/lang/es/LC_MESSAGES/Makefile"
	mkdir -p "$(CURDIR)/debian/fheroes2/opt/fheroes2/files/lang/es/LC_MESSAGES/"
	cp -a "instsrc/opt/fheroes2/files/lang/es/LC_MESSAGES/fheroes2.po" "$(CURDIR)/debian/fheroes2/opt/fheroes2/files/lang/es/LC_MESSAGES/fheroes2.po"
	mkdir -p "$(CURDIR)/debian/fheroes2/opt/fheroes2/files/lang/pt_BR/LC_MESSAGES/"
	cp -a "instsrc/opt/fheroes2/files/lang/pt_BR/LC_MESSAGES/Makefile" "$(CURDIR)/debian/fheroes2/opt/fheroes2/files/lang/pt_BR/LC_MESSAGES/Makefile"
	mkdir -p "$(CURDIR)/debian/fheroes2/opt/fheroes2/files/lang/pt_BR/LC_MESSAGES/"
	cp -a "instsrc/opt/fheroes2/files/lang/pt_BR/LC_MESSAGES/fheroes2.po" "$(CURDIR)/debian/fheroes2/opt/fheroes2/files/lang/pt_BR/LC_MESSAGES/fheroes2.po"
	mkdir -p "$(CURDIR)/debian/fheroes2/opt/fheroes2/"
	cp -a "instsrc/opt/fheroes2/AUTHORS" "$(CURDIR)/debian/fheroes2/opt/fheroes2/AUTHORS"
	cp -a "fheroes2" "$(CURDIR)/debian/fheroes2/opt/fheroes2/fheroes2"
	mkdir -p "$(CURDIR)/debian/fheroes2/opt/fheroes2/"
	cp -a "instsrc/opt/fheroes2/COPYING" "$(CURDIR)/debian/fheroes2/opt/fheroes2/COPYING"
	mkdir -p "$(CURDIR)/debian/fheroes2/opt/fheroes2/"
	cp -a "instsrc/opt/fheroes2/README" "$(CURDIR)/debian/fheroes2/opt/fheroes2/README"
	mkdir -p "$(CURDIR)/debian/fheroes2/opt/fheroes2/"
	cp -a "instsrc/opt/fheroes2/fheroes2" "$(CURDIR)/debian/fheroes2/opt/fheroes2/fheroes2"
	mkdir -p "$(CURDIR)/debian/fheroes2/opt/fheroes2/"
	cp -a "instsrc/opt/fheroes2/fheroes2-docs.conf" "$(CURDIR)/debian/fheroes2/opt/fheroes2/fheroes2-docs.conf"
	mkdir -p "$(CURDIR)/debian/fheroes2/opt/fheroes2/"
	cp -a "instsrc/opt/fheroes2/fheroes2_default.cfg" "$(CURDIR)/debian/fheroes2/opt/fheroes2/fheroes2_default.cfg"
	mkdir -p "$(CURDIR)/debian/fheroes2/opt/fheroes2/files/lang/tr/LC_MESSAGES/"
	cp -a "instsrc/opt/fheroes2/files/lang/tr/LC_MESSAGES/Makefile" "$(CURDIR)/debian/fheroes2/opt/fheroes2/files/lang/tr/LC_MESSAGES/Makefile"
	mkdir -p "$(CURDIR)/debian/fheroes2/opt/fheroes2/files/lang/tr/LC_MESSAGES/"
	cp -a "instsrc/opt/fheroes2/files/lang/tr/LC_MESSAGES/fheroes2.po" "$(CURDIR)/debian/fheroes2/opt/fheroes2/files/lang/tr/LC_MESSAGES/fheroes2.po"
	mkdir -p "$(CURDIR)/debian/fheroes2/opt/fheroes2/files/images/name.icn/"
	cp -a "instsrc/opt/fheroes2/files/images/name.icn/spec.xml" "$(CURDIR)/debian/fheroes2/opt/fheroes2/files/images/name.icn/spec.xml"
	mkdir -p "$(CURDIR)/debian/fheroes2/opt/fheroes2/files/lang/ru/LC_MESSAGES/"
	cp -a "instsrc/opt/fheroes2/files/lang/ru/LC_MESSAGES/Makefile" "$(CURDIR)/debian/fheroes2/opt/fheroes2/files/lang/ru/LC_MESSAGES/Makefile"
	mkdir -p "$(CURDIR)/debian/fheroes2/opt/fheroes2/files/lang/ru/LC_MESSAGES/"
	cp -a "instsrc/opt/fheroes2/files/lang/ru/LC_MESSAGES/fheroes2.po" "$(CURDIR)/debian/fheroes2/opt/fheroes2/files/lang/ru/LC_MESSAGES/fheroes2.po"
	mkdir -p "$(CURDIR)/debian/fheroes2/opt/fheroes2/files/lang/sv/LC_MESSAGES/"
	cp -a "instsrc/opt/fheroes2/files/lang/sv/LC_MESSAGES/Makefile" "$(CURDIR)/debian/fheroes2/opt/fheroes2/files/lang/sv/LC_MESSAGES/Makefile"
	mkdir -p "$(CURDIR)/debian/fheroes2/opt/fheroes2/files/lang/sv/LC_MESSAGES/"
	cp -a "instsrc/opt/fheroes2/files/lang/sv/LC_MESSAGES/fheroes2.po" "$(CURDIR)/debian/fheroes2/opt/fheroes2/files/lang/sv/LC_MESSAGES/fheroes2.po"
	mkdir -p "$(CURDIR)/debian/fheroes2/opt/fheroes2/files/lang/cs/LC_MESSAGES/"
	cp -a "instsrc/opt/fheroes2/files/lang/cs/LC_MESSAGES/Makefile" "$(CURDIR)/debian/fheroes2/opt/fheroes2/files/lang/cs/LC_MESSAGES/Makefile"
	mkdir -p "$(CURDIR)/debian/fheroes2/opt/fheroes2/files/lang/cs/LC_MESSAGES/"
	cp -a "instsrc/opt/fheroes2/files/lang/cs/LC_MESSAGES/fheroes2.po" "$(CURDIR)/debian/fheroes2/opt/fheroes2/files/lang/cs/LC_MESSAGES/fheroes2.po"
	mkdir -p "$(CURDIR)/debian/fheroes2/opt/fheroes2/files/music/"
	cp -a "instsrc/opt/fheroes2/files/music/README" "$(CURDIR)/debian/fheroes2/opt/fheroes2/files/music/README"
	mkdir -p "$(CURDIR)/debian/fheroes2/opt/fheroes2/files/lang/pl/LC_MESSAGES/"
	cp -a "instsrc/opt/fheroes2/files/lang/pl/LC_MESSAGES/Makefile" "$(CURDIR)/debian/fheroes2/opt/fheroes2/files/lang/pl/LC_MESSAGES/Makefile"
	mkdir -p "$(CURDIR)/debian/fheroes2/opt/fheroes2/files/lang/pl/LC_MESSAGES/"
	cp -a "instsrc/opt/fheroes2/files/lang/pl/LC_MESSAGES/fheroes2.po" "$(CURDIR)/debian/fheroes2/opt/fheroes2/files/lang/pl/LC_MESSAGES/fheroes2.po"
	mkdir -p "$(CURDIR)/debian/fheroes2/opt/fheroes2/files/sounds/"
	cp -a "instsrc/opt/fheroes2/files/sounds/sound.txt" "$(CURDIR)/debian/fheroes2/opt/fheroes2/files/sounds/sound.txt"
	mkdir -p "$(CURDIR)/debian/fheroes2/opt/fheroes2/files/lang/hu/LC_MESSAGES/"
	cp -a "instsrc/opt/fheroes2/files/lang/hu/LC_MESSAGES/Makefile" "$(CURDIR)/debian/fheroes2/opt/fheroes2/files/lang/hu/LC_MESSAGES/Makefile"
	mkdir -p "$(CURDIR)/debian/fheroes2/opt/fheroes2/files/lang/hu/LC_MESSAGES/"
	cp -a "instsrc/opt/fheroes2/files/lang/hu/LC_MESSAGES/fheroes2.po" "$(CURDIR)/debian/fheroes2/opt/fheroes2/files/lang/hu/LC_MESSAGES/fheroes2.po"
	mkdir -p "$(CURDIR)/debian/fheroes2/opt/fheroes2/files/fonts/"
	cp -a "instsrc/opt/fheroes2/files/fonts/dejavusans.ttf" "$(CURDIR)/debian/fheroes2/opt/fheroes2/files/fonts/dejavusans.ttf"
	mkdir -p "$(CURDIR)/debian/fheroes2/opt/fheroes2/files/stats/"
	cp -a "instsrc/opt/fheroes2/files/stats/battle.xml" "$(CURDIR)/debian/fheroes2/opt/fheroes2/files/stats/battle.xml"
	mkdir -p "$(CURDIR)/debian/fheroes2/opt/fheroes2/files/stats/"
	cp -a "instsrc/opt/fheroes2/files/stats/buildings.xml" "$(CURDIR)/debian/fheroes2/opt/fheroes2/files/stats/buildings.xml"
	mkdir -p "$(CURDIR)/debian/fheroes2/opt/fheroes2/files/stats/"
	cp -a "instsrc/opt/fheroes2/files/stats/globals.xml" "$(CURDIR)/debian/fheroes2/opt/fheroes2/files/stats/globals.xml"
	mkdir -p "$(CURDIR)/debian/fheroes2/opt/fheroes2/files/stats/"
	cp -a "instsrc/opt/fheroes2/files/stats/monsters.xml" "$(CURDIR)/debian/fheroes2/opt/fheroes2/files/stats/monsters.xml"
	mkdir -p "$(CURDIR)/debian/fheroes2/opt/fheroes2/files/stats/"
	cp -a "instsrc/opt/fheroes2/files/stats/payments.xml" "$(CURDIR)/debian/fheroes2/opt/fheroes2/files/stats/payments.xml"
	mkdir -p "$(CURDIR)/debian/fheroes2/opt/fheroes2/files/stats/"
	cp -a "instsrc/opt/fheroes2/files/stats/profits.xml" "$(CURDIR)/debian/fheroes2/opt/fheroes2/files/stats/profits.xml"
	mkdir -p "$(CURDIR)/debian/fheroes2/opt/fheroes2/files/stats/"
	cp -a "instsrc/opt/fheroes2/files/stats/skills.xml" "$(CURDIR)/debian/fheroes2/opt/fheroes2/files/stats/skills.xml"
	mkdir -p "$(CURDIR)/debian/fheroes2/opt/fheroes2/files/stats/"
	cp -a "instsrc/opt/fheroes2/files/stats/spells.xml" "$(CURDIR)/debian/fheroes2/opt/fheroes2/files/stats/spells.xml"
	mkdir -p "$(CURDIR)/debian/fheroes2/opt/fheroes2/files/lang/"
	cp -a "instsrc/opt/fheroes2/files/lang/README" "$(CURDIR)/debian/fheroes2/opt/fheroes2/files/lang/README"
	mkdir -p "$(CURDIR)/debian/fheroes2/opt/fheroes2/files/lang/"
	cp -a "instsrc/opt/fheroes2/files/lang/fheroes2.pot" "$(CURDIR)/debian/fheroes2/opt/fheroes2/files/lang/fheroes2.pot"
	mkdir -p "$(CURDIR)/debian/fheroes2/opt/fheroes2/files/lang/nl/LC_MESSAGES/"
	cp -a "instsrc/opt/fheroes2/files/lang/nl/LC_MESSAGES/Makefile" "$(CURDIR)/debian/fheroes2/opt/fheroes2/files/lang/nl/LC_MESSAGES/Makefile"
	mkdir -p "$(CURDIR)/debian/fheroes2/opt/fheroes2/files/lang/nl/LC_MESSAGES/"
	cp -a "instsrc/opt/fheroes2/files/lang/nl/LC_MESSAGES/fheroes2.po" "$(CURDIR)/debian/fheroes2/opt/fheroes2/files/lang/nl/LC_MESSAGES/fheroes2.po"
	mkdir -p "$(CURDIR)/debian/fheroes2/usr/share/applications/hildon/"
	cp -a "instsrc/usr/share/applications/hildon/fheroes2.desktop" "$(CURDIR)/debian/fheroes2/usr/share/applications/hildon/fheroes2.desktop"
	mkdir -p "$(CURDIR)/debian/fheroes2/usr/share/icons/hicolor/scalable/hildon/"
	cp -a "instsrc/usr/share/icons/hicolor/scalable/hildon/hmm2.png" "$(CURDIR)/debian/fheroes2/usr/share/icons/hicolor/scalable/hildon/hmm2.png"
	mkdir -p "$(CURDIR)/debian/fheroes2/usr/bin/"
	cp -a "instsrc/usr/bin/fheroes2.sh" "$(CURDIR)/debian/fheroes2/usr/bin/fheroes2.sh"
		# ======================================================

# 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 debian/changelog
	dh_installdocs
	dh_installexamples
#	dh_install
#	dh_installmenu
#	dh_installdebconf
#	dh_installlogrotate
#	dh_installemacsen
#	dh_installpam
#	dh_installmime
#	dh_python
#	dh_installinit
#	dh_installcron
#	dh_installinfo
	dh_installman
	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
