#!/usr/bin/make -f

FLAGS=-g -O2 -pipe -mtune=generic -msse -msse2 -fPIC -DPIC -fstack-protector --param=ssp-buffer-size=4 -D_FORTIFY_SOURCE=2

export CFLAGS=$(FLAGS)
export CXXFLAGS=$(FLAGS)
export LDFLAGS=-Wl,-O1 -Wl,-Bsymbolic-functions -Wl,--strip-all -Wl,-z,relro,-z,now

override_dh_auto_configure:
	./configure --enable-static --disable-shared --enable-float-approx --enable-custom-modes --prefix=/opt/kxstudio/

override_dh_auto_install:
	$(MAKE) install DESTDIR=$(CURDIR)/debian/tmp/
	find $(CURDIR)/debian/tmp/ -name \*.la -delete

override_dh_auto_clean:
	if [ -f Makefile ]; then make clean; fi

	rm -f Makefile
	rm -f config.h
	rm -f config.log
	rm -f config.status
	rm -f doc/Doxyfile
	rm -f doc/Makefile
	rm -f libtool
	rm -f m4/Makefile
	rm -f stamp-h1
	rm -f opus-uninstalled.pc
	rm -f opus.pc

%:
	dh $@
