#!/usr/bin/make -f

CFLAGS += -Wall -g

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

%:
	dh $@

override_dh_auto_configure:
	CFLAGS="$(CFLAGS)" ./config.sh --debian
	cp mp-5.1 mped.1

override_dh_auto_clean:
	dh_auto_clean
	cd mpsl ; [ ! -f Makefile ] || $(MAKE) distclean ; cd ..
	cd mpdm ; [ ! -f Makefile ] || $(MAKE) distclean ; cd ..
	$(RM) mped.1
	$(RM) .config.log

override_dh_auto_install:
	dh_auto_install
	$(RM) debian/mped/usr/share/doc/mped/COPYING
