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

export DH_VERBOSE=1

PKG  = $(shell dpkg-parsechangelog -l$(PKD)/changelog --show-field=Source)
export GOVER = $(shell echo $(PKG) | sed -n -e 's/golang-\([0-9]\+\.[0-9]\+\).*/\1/p')

override_dh_auto_clean:
	cd lib/tsan/go && rm -f test gotsan.cc race_linux_amd64.syso

override_dh_auto_test:
	# buildgo.sh includes tests for the the part of the library
	# that we are actually using.
	:

override_dh_auto_install:
	:

override_dh_strip:
	:

override_dh_auto_build:
	cd lib/tsan/go && ./buildgo.sh

PKD  = $(abspath $(dir $(MAKEFILE_LIST)))
PKG  = $(shell dpkg-parsechangelog -l$(PKD)/changelog --show-field=Source)
REVNO = $(shell dpkg-parsechangelog  -SVersion | sed -e 's/.*svn\([0-9]\+\)-.*/\1/')

get-orig-source:
	svn co http://llvm.org/svn/llvm-project/compiler-rt/trunk compiler-rt
	cd compiler-rt && svn export -r $(REVNO) . "../$(PKG)_0.0+svn$(REVNO)"
	tar czf $(PKG)_0.0+svn$(REVNO).orig.tar.gz $(PKG)_0.0+svn$(REVNO)
	rm -rf compiler-rt $(PKG)_0.0+svn$(REVNO)

%:
	dh $@

.PHONY: get-orig-source
