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

APPNAME := qdialgps
builddir:
	mkdir -p builddir

build: build-stamp

build-stamp: # Add here commands to compile the package.
	ls /usr/include/QString || ln -s /usr/include/QtCore/QString /usr/include/QString || ls /usr/include/QtCore/QString || true
	ls /usr/include/qstring.h || ln -s /usr/include/QtCore/qstring.h /usr/include/qstring.h || ls /usr/include/QtCore/qstring.h || true
	ls /usr/include/QDateTime || ln -s /usr/include/QtCore/QDateTime /usr/include/QDateTime || ls /usr/include/QtCore/QDateTime || true
	ls /usr/include/qdatetime.h || ln -s /usr/include/QtCore/qdatetime.h /usr/include/qdatetime.h || ls /usr/include/QtCore/qdatetime.h || true
	ls /usr/include/QObject || ln -s /usr/include/QtCore/QObject /usr/include/QObject || ls /usr/include/QtCore/QObject || true
	ls /usr/include/qobject.h || ln -s /usr/include/QtCore/qobject.h /usr/include/qobject.h || ls /usr/include/QtCore/qobject.h || true
	ls /usr/include/QList || ln -s /usr/include/QtCore/QList /usr/include/QList || ls /usr/include/QtCore/QList || true
	ls /usr/include/qlist.h || ln -s /usr/include/QtCore/qlist.h /usr/include/qlist.h || ls /usr/include/QtCore/qlist.h || true
	g++ -c -pipe -O6 -Wall -W src/main.cpp -o src/main.o
	# g++ -c -pipe -O6 -Wall -W src/examplewidget.cpp -o src/examplewidget.o
	moc src/examplewidget.h -o src/moc_examplewidget.cpp
	g++ -c -pipe -O6 -Wall -W src/moc_examplewidget.cpp -o src/moc_examplewidget.o
	g++ -Wl,-O6 -lQtCore -lQtGui -lQtDeclarative -lQtLocation -lQtBearer -lQtNetwork src/main.o src/moc_examplewidget.o -o qdialgps
	#docbook-to-man debian/$(APPNAME).sgml > $(APPNAME).1

	touch $@

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

	# Add here commands to clean up after the build process.
	rm -rf builddir
	rm src/main.o || exit 0
	rm src/moc_examplewidget.o || exit 0
	rm src/moc_examplewidget.cpp || exit 0
	rm debian/qdialgps.substvars || exit 0
	rm debian/qdialgps.debhelper.log || exit 0
	rm debian/files || exit 0
	rm debian/qdialgps.tarlist || exit 0
	# dh_clean

install: build
	# dh_testdir
	# dh_testroot
	# dh_clean -k
	dh_installdirs
	mv qdialgps $(CURDIR)/debian/$(APPNAME)/opt/usr/bin/$(APPNAME)

# 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_installdocs
	dh_installexamples
	dh_installman
	dh_link
	dh_strip
	dh_compress
	dh_fixperms
	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
