#!/usr/bin/make -f

CFLAGS = -Wall -g

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

configure: configure-stamp
configure-stamp:
	dh_testdir
	touch configure-stamp

build: build-stamp

build-stamp: configure-stamp 
	dh_testdir
	make NOWERROR=1 NOASM=1 NO_OPENGL=1 OPTIMIZE=3

	touch build-stamp

clean:
	dh_testdir
	dh_testroot
	make clean
	rm -rf obj mame
	dh_clean build-stamp configure-stamp

install: build
	dh_testdir
	dh_testroot
	dh_clean -k 
	dh_installdirs usr/share/icons/hicolor/64x64/apps
	uudecode ./debian/mame-64.png.uu
	mv mame-64.png ./debian/mame/usr/share/icons/hicolor/64x64/apps/


# 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_install
#	dh_installchangelogs ChangeLog
	dh_installdocs
#	dh_installdebconf	
#	dh_installlogrotate
#	dh_installinfo
	dh_link
	dh_strip
#	dh_compress
	dh_fixperms
#	dh_makeshlibs
	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
