#!/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' %: dh $@ override_dh_auto_build: dh_auto_build -D csim -- for_linux cp csim/csim $(SIMULATOR) dh_auto_build -D 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 override_dh_auto_clean: rm -fr $(CURDIR)/template dh_auto_clean -D csim dh_auto_clean tarball: clean test -d ../ogamesim-$(DEBVERSION) cd .. && \ tar --exclude=debian --exclude=.git \ -czvf ogamesim_$(DEBVERSION).orig.tar.gz \ ogamesim-$(DEBVERSION)