#!/usr/bin/make -f

DEB_BUILD_ARCH_CPU ?=$(shell dpkg-architecture -qDEB_BUILD_ARCH_CPU)

#deb_build_arch_cpu gives correct path on most architectures but powerpc needs special casing
JAVAARCH :=$(DEB_BUILD_ARCH_CPU)

ifeq ($(DEB_BUILD_ARCH_CPU),powerpc)
  JAVAARCH :=ppc
endif

ifeq ($(DEB_BUILD_ARCH_CPU),i686)
  JAVAARCH :=i386
endif

export JCC_ARGSEP=;
export JCC_LFLAGS := -L/usr/lib/jvm/java-6-openjdk/jre/lib/$(JAVAARCH);-L/usr/lib/jvm/java-6-openjdk/jre/lib/$(JAVAARCH)/server;-Wl,-rpath=/usr/lib/jvm/java-6-openjdk/jre/lib/$(JAVAARCH):/usr/lib/jvm/java-6-openjdk/jre/lib/$(JAVAARCH)/server;-ljava
export JCC_CFLAGS := -fdollars-in-identifiers

# For shared mode we need patch http://bugs.python.org/setuptools/issue43 for setuptools to be applied
export NO_SHARED=1

include /usr/share/cdbs/1/rules/debhelper.mk
DEB_PYTHON_SYSTEM = pysupport
include /usr/share/cdbs/1/class/python-distutils.mk

binary-post-install/jcc::
	rm -rf debian/jcc/usr/share/pyshared/jcc/patches

clean::
	rm -rf build/*
	rm -f jcc/config.py

