#!/usr/bin/make -f

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


# These are used for cross-compiling and for saving the configure script
# from having to guess our platform (since we know it already)
export DEB_HOST_GNU_TYPE   ?= $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE)
export DEB_BUILD_GNU_TYPE  ?= $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE)

ONFFLAGS =
ifeq ($(DEB_BUILD_GNU_TYPE), $(DEB_HOST_GNU_TYPE))
  CONFFLAGS += --build $(DEB_HOST_GNU_TYPE)
else
  CONFFLAGS += --build $(DEB_BUILD_GNU_TYPE) --host $(DEB_HOST_GNU_TYPE)
endif

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

CFLAGS:=-Wall -pipe $(DEBUGFLAGS)
CXXFLAGS:=$(CFLAGS)

#configure: patch 
#config.status: configure
#	dh_testdir
#	# Add here commands to configure the package.
#	./configure CFLAGS="$(CFLAGS)" CXXFLAGS="$(CXXFLAGS)" $(CONFFLAGS) \
#		--prefix=/usr --mandir=\$${prefix}/share/man --infodir=\$${prefix}/share/info \
#		--enable-qt4-immodule --disable-documents --disable-tests \
#		--disable-rpath


build: build-stamp

build-stamp: 
	dh_testdir

	# Add here commands to compile the package.
#	$(MAKE)
	gcc -o hellolp Helloworld.c
	#docbook-to-man debian/scim-bridge-agent.sgml > scim-bridge-agent.1

	touch build-stamp

clean: clean-patched 
clean-patched:
	dh_testdir
	dh_testroot
	rm -f build-stamp 
#	[ ! -f Makefile ] || $(MAKE) distclean
	[ ! -f hellolp ] || rm hellolp
#	find po -empty -exec rm {} \;

	dh_clean 

install: build
	dh_testdir
	dh_testroot
	dh_clean -k 
	dh_installdirs

	# Add here commands to install the package into debian/scim-bridge.
#$(MAKE) install DESTDIR=$(CURDIR)/debian/tmp
	install -d  $(CURDIR)/debian/hellolp/usr/bin/
	install -m 755 $(CURDIR)/hellolp debian/hellolp/usr/bin/

binary-indep: build install
binary-arch: build install
	dh_testdir
	dh_testroot
	dh_installdocs
	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 
