#!/usr/bin/make -f

builddir/Makefile:
	mkdir -p builddir
	cd builddir && \
	cmake .. \
		-DCMAKE_INSTALL_PREFIX=/usr \
		-DCMAKE_C_FLAGS="$(CFLAGS)" \
		-DCMAKE_LD_FLAGS="-Wl,-z,defs" \
		-DCMAKE_CXX_FLAGS="$(CXXFLAGS)" \
		-DCMAKE_SKIP_RPATH=ON \
		-DCMAKE_VERBOSE_MAKEFILE=ON

build: build-stamp
build-stamp: builddir/Makefile 
	dh_testdir
	$(MAKE) -C builddir
	touch $@

override_dh_auto_configure:
	# the package also has autotools buildsys and
	# debhelper try to use it but that's not needed
	echo

override_dh_install:
	$(MAKE) -C builddir DESTDIR=$(CURDIR)/debian/tmp install
	dh_install

override_dh_strip:
	dh_strip --dbg-package=weechat-dbg

clean:
	rm -rf builddir
	dh $@

%:
	dh $@
