#!/usr/bin/make -f # -*- makefile -*- # Uncomment this to turn on verbose mode. # export DH_VERBOSE=1 SIMULATOR := ogamesim WEBGUI := ogamesim-www SIMPATH := /usr/games/$(SIMULATOR) REVISION := $(shell dpkg-parsechangelog| \ grep '^Version' | sed 's/.*-//') DEBVERSION := $(shell dpkg-parsechangelog| \ grep '^Version' | awk '{ print $$2 }'| sed 's/-.*//') SIMVERSION := $(shell grep 'define[[:space:]]\+VERSION' \ csim/version.h | \ awk -- '{ print $$3 }' | \ sed 's/[^0-9\.]//g')-$(REVISION) GUIVERSION := $(shell grep 'our[[:space:]]\+$$VERSION' \ www/index.cgi| \ sed 's/.*=//'| \ sed 's/[^0-9\.]//g')-$(REVISION) DOWNLOAD_URL := 'http://www.o-o-d.com/tool/sim/sim.tar.bz2' tarball: clean test -d ../ogamesim-$(DEBVERSION) cd .. && \ tar --exclude=debian --exclude=.git \ -czvf ogamesim_$(DEBVERSION).orig.tar.gz \ ogamesim-$(DEBVERSION) build: build-stamp build-stamp: dh_testdir make -C csim for_linux cp csim/csim $(SIMULATOR) make -C www install -m 0755 www/index.cgi . perl -pi -e \ 's#^my\s+\$$units_conf.*#my \$$units_conf = "units.conf";#; \ s#^my\s+\$$lang.*#my \$$lang = "en";#; \ s#my\s+\$$counter_file.*#my \$$counter_file = "";#; \ s#^my\s+\$$simulator.*#my \$$simulator = "$(SIMPATH)";#' \ index.cgi mkdir -p template for tmpl in `ls www/template/|grep 'sim\...\.html$$'`; do \ cat www/template/$$tmpl \ |sed 's~href="sim\.tar\.bz2"~href="$(DOWNLOAD_URL)"~' \ > template/$$tmpl; \ done install -m 0644 csim/csim.6 $(SIMULATOR).6 perl -pi -e 's/csim/$(SIMULATOR)/g' $(SIMULATOR).6 touch $@ clean: dh_testdir dh_testroot rm -f build-stamp $(SIMULATOR) install-stamp \ csim/csim index.cgi $(SIMULATOR).6 rm -fr template make -C csim clean dh_clean install: build install-stamp install-stamp: dh_testdir dh_testroot dh_clean -k dh_installdirs dh_install dh_installdocs -A dh_installchangelogs dh_installexamples dh_installman touch $@ # Build architecture-independent files here. binary-indep: build install dh_testdir dh_testroot dh_gencontrol -p$(WEBGUI) -- -v$(GUIVERSION) dh_link dh_strip dh_compress -A dh_fixperms dh_installdeb dh_md5sums dh_builddeb -p$(WEBGUI) # Build architecture-dependent files here. binary-arch: build install dh_testdir dh_testroot dh_shlibdeps -p$(SIMULATOR) dh_gencontrol -p$(SIMULATOR) -- -v$(SIMVERSION) dh_link dh_strip dh_compress -A dh_fixperms dh_installdeb dh_md5sums dh_builddeb -p$(SIMULATOR) binary: binary-indep binary-arch build-arch: build build-indep: build .PHONY: build clean binary-indep binary-arch binary install configure build-arch build-indep