#!/usr/bin/make -f
# -*- makefile -*-

#export DH_VERBOSE=1

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

build: build-stamp

build-stamp: configure-stamp  
	dh_testdir
	$(MAKE) SDL_CONFIG=sdl-config PREFIX=/usr/share/games/syobonaction/
	touch $@

clean: 
	dh_testdir
	dh_testroot
	rm -f build-stamp configure-stamp

	$(MAKE) clean

	dh_clean 

install: build
	dh_testdir
	dh_testroot
	dh_prep  

	install -D -m755 $(CURDIR)/SyobonAction \
		$(CURDIR)/debian/syobonaction/usr/games/SyobonAction

	install -d $(CURDIR)/debian/syobonaction/usr/share/games/syobonaction/bgm
	install -d $(CURDIR)/debian/syobonaction/usr/share/games/syobonaction/se
	install -d $(CURDIR)/debian/syobonaction/usr/share/games/syobonaction/res

	install -m644 $(CURDIR)/data/bgm/*.ogg $(CURDIR)/debian/syobonaction/usr/share/games/syobonaction/bgm/
	install -m644 $(CURDIR)/data/se/*.ogg $(CURDIR)/debian/syobonaction/usr/share/games/syobonaction/se/ 
	install -m644 $(CURDIR)/data/res/*.bmp $(CURDIR)/debian/syobonaction/usr/share/games/syobonaction/res/

	install -D -m644 $(CURDIR)/debian/syobonaction.desktop \
		$(CURDIR)/debian/syobonaction/usr/share/applications/syobonaction.desktop

binary-indep: install

binary-arch: install
	dh_testdir
	dh_testroot
	dh_installchangelogs 
	dh_installdocs
	dh_installmenu
	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 configure
