-release:=$(shell dpkg-parsechangelog | sed -n 's/^Source: wxwindows//p')
-python_dir:=python$(shell python -c "import sys;print sys.version[:3]")
-
-cross_host=i586-mingw32msvc
-cross_build=$(shell ./config.guess)
-
-# Packages to build:
-package_wxbase_lib=libwxbase$(release)
-package_wxbase_dev=libwxbase$(release)-dev
-package_wxbase_dbg=libwxbase$(release)-dbg
-package_gtk_lib=libwxgtk$(release)
-package_gtk_dev=libwxgtk$(release)-dev
-package_gtk_dbg=libwxgtk$(release)-dbg
-package_gtk_py=libwxgtk$(release)-python
-package_gtk_contrib=libwxgtk$(release)-contrib
-package_gtk_contrib_dev=libwxgtk$(release)-contrib-dev
-package_headers=wxwin$(release)-headers
-package_i18n=wxwin$(release)-i18n
-package_doc=wxwin$(release)-doc
-package_examples=wxwin$(release)-examples
-
-package_gtk_univ=libwxgtk$(release)-univ
-
-package_wxbase_msw_dev=libwxbase-msw$(release)-dev
-package_msw_dev=libwxmsw$(release)-dev
-package_headers_msw=wxwin$(release)-headers-msw
-
-# Build directories:
-objdir_wxbase_shared=objs_wxbase_sh
-objdir_wxbase_static=objs_wxbase_st
-objdir_wxbase_debug=objs_wxbase_d
-objdir_gtk_shared=objs_gtk_sh
-objdir_gtk_static=objs_gtk_st
-objdir_gtk_debug=objs_gtk_d
-objdir_doc_cruft=objs_doc_con
-objdir_doc=docs/wxWindows-manual.html
-objdir_examples=docs/examples
-objdir_i18n=locale
-
-objdir_gtk_univ=objs_gtk_univ
-
-objdir_wxbase_msw_static=objs_wxbase_msw_st
-objdir_msw_static=objs_msw_st
-
-objdirs=$(objdir_wxbase_shared) $(objdir_wxbase_static) $(objdir_wxbase_debug) \
- $(objdir_gtk_shared) $(objdir_gtk_static) $(objdir_gtk_debug) $(objdir_gtk_univ) \
- $(objdir_doc_cruft) $(objdir_doc) $(objdir_examples) \
- $(objdir_wxbase_msw_static) $(objdir_msw_static)
+ifdef CONCURRENCY_LEVEL
+ # A user who knows what they want, that's like gold...
+ # respect their precious opinion of how much blue smoke to use.
+ JOB_COUNT := $(CONCURRENCY_LEVEL)
+else ifdef DISTCC_HOSTS
+ # Otherwise, if they have a cluster, try to put it to good use.
+ JOB_COUNT := $(shell set $${DISTCC_HOSTS} > /dev/null 2>&1 ; echo $$\#)
+endif
+
+ifdef JOB_COUNT
+ FAST_MAKE = $(MAKE) -j $(JOB_COUNT)
+else
+ FAST_MAKE = $(MAKE)
+endif
+
+
+# Find the python version(s) to build for
+PYVERS := $(shell pyversions -vr || pyversions -vs)
+ifeq ($(strip $(PYVERS)),)
+ PYVERS := $(shell python -c 'import sys; print sys.version[:3]')
+ NO_PYCENTRAL = 1
+ PY_BUILD_DEPS = python$(PYVERS), python$(PYVERS)-dbg, python$(PYVERS)-dev
+else
+ DEB_PYTHON_SYSTEM=pycentral
+ PY_BUILD_DEPS = python-all, python-all-dbg, python-all-dev, python-central
+endif
+
+# If another source package is to supply the common binary packages
+# for a particular Debian release, then define this variable to indicate
+# the $(release) that is expected to provide it. Do not define it at
+# all if this is to be the default (or only) wx source package for the
+# target release.
+#
+#DEBIAN_WX_DEFAULT_VERSION = 2.8
+
+
+# This will extract a flavour out of the name of the source directory
+# and flavour the packages and binaries with it. 'Official' builds
+# should use a source dir of the form wxwidgets$RELEASE-$VERSION.
+# Flavoured builds may use wxwidgets$RELEASE-$FLAVOUR-$VERSION, where
+# any descriptive alphanumeric name will do for FLAVOUR. This will
+# allow a custom build to be installed alongside the mainline ones
+# without conflict. You will also need to make a corresponding
+# changelog entry for your flavour source package using:
+# wxwidget$RELEASE-$FLAVOUR ($VERSION) to satify dpkg-source and
+# to correctly set the release below.
+DEBIAN_WXFLAVOUR := $(shell pwd | sed -e 's@.*/wxwidgets[0-9.]\+-\?\(.*\)-[0-9.]\+-\?.*@\1@')
+
+
+wx_major_version_number := $(shell sed -n 's/^wx_major_version_number=//p' configure.in)
+wx_minor_version_number := $(shell sed -n 's/^wx_minor_version_number=//p' configure.in)
+wx_release_number := $(shell sed -n 's/^wx_release_number=//p' configure.in)
+wx_subrelease_number := $(shell sed -n 's/^wx_subrelease_number=//p' configure.in)
+
+##release := $(shell dpkg-parsechangelog | sed -n 's/^Source: wxwidgets//p' | sed 's/-ansi//')
+release := $(wx_major_version_number).$(wx_minor_version_number)
+
+# This is broken completely now by bakefiles changes. Until we add
+# some hocus pocus to the main tree, to export these values from it
+# again, we approximate its behaviour (fairly precisely fwiw) to
+# specify $soversion below. Re-automate if incompatible changes
+# result in it actually changing.
+#soversion := $(shell grep '^WX_CURRENT=' configure.in | sed 's/WX_CURRENT=\([0-9]\+\).*/\1/')
+soversion := 0
+sorelease := $(release:%-$(DEBIAN_WXFLAVOUR)=%)-$(soversion)$(addprefix -,$(DEBIAN_WXFLAVOUR))
+
+# In some places we use the full version number, including the micro version,
+# for the development releases (which can be incompatible for the same major
+# and minor version) but just the major.minor for the stable releases (which
+# are supposed to be compatible), this variable contains the appropriate value
+ifeq ($(shell echo `echo $(release) | sed 's/.\+\.\(.\+\)/\1/'`%2 | bc),1)
+ # development release
+ compatible_release := $(release).$(wx_release_number)
+else
+ compatible_release := $(release)
+endif
+
+# Base value for alternative priorities.
+alt_prio := $(subst .,,$(release))
+
+cross_host := i586-mingw32msvc
+cross_build := $(shell ./config.guess)
+
+config_cache = ../config_deb.cache
+config_cache_cross = ../config_deb_cross.cache
+
+
+# build options
+COMMON_CONFIGURE_OPTIONS = \
+ --prefix=/usr \
+ --cache-file=$(config_cache) \
+ --with-flavour=$(DEBIAN_WXFLAVOUR) \
+ --with-zlib=sys \
+ --disable-reserved_virtual \
+
+BASE_CONFIGURE_OPTIONS = $(COMMON_CONFIGURE_OPTIONS) \
+ --disable-gui \
+
+GTK_CONFIGURE_OPTIONS = $(COMMON_CONFIGURE_OPTIONS) \
+ --with-gtk \
+ --enable-mediactrl \
+ --enable-sound \
+ --with-sdl \
+ --enable-display \
+ --enable-geometry \
+ --enable-graphics_ctx \
+ --with-libjpeg=sys \
+ --with-libpng=sys \
+ --with-libtiff=sys \
+
+
+pytoolkit := gtk2
+PY_WX_CONFIG_OPTIONS = --version=$(release) --toolkit=$(pytoolkit) --static=no
+
+WX_UNICODE := 1
+WX_OPENGL := 1
+
+ifeq ($(WX_UNICODE),1)
+ COMMON_CONFIGURE_OPTIONS += --enable-unicode
+ PY_WX_CONFIG_OPTIONS += --unicode
+ PY_UNICODE = UNICODE=1
+ wxpydir := wx-$(compatible_release)-$(pytoolkit)-unicode
+
+ # for compatibility with the existing 2.6 packages, we don't use "u" in
+ # the Unicode (default) package names
+ unicode_suffix :=
+else
+ # but we do need to use something for non-Unicode packages to distinguish
+ # them
+ unicode_suffix := -ansi
+ PY_UNICODE = UNICODE=0
+ wxpydir := wx-$(compatible_release)-$(pytoolkit)
+endif
+
+ifeq ($(WX_OPENGL),1)
+ GTK_CONFIGURE_OPTIONS += --with-opengl
+else
+ GTK_CONFIGURE_OPTIONS += --without-opengl
+endif
+
+#---------------------------------------------------------------------------
+# Packages to build
+
+package_wxbase_lib := libwxbase$(sorelease)$(unicode_suffix)
+package_wxbase_dev := libwxbase$(release)$(unicode_suffix)-dev
+package_wxbase_dbg := libwxbase$(release)$(unicode_suffix)-dbg
+
+package_gtk_lib := libwxgtk$(sorelease)$(unicode_suffix)
+package_gtk_dev := libwxgtk$(release)$(unicode_suffix)-dev
+package_gtk_dbg := libwxgtk$(release)$(unicode_suffix)-dbg
+
+package_headers := wx$(release)-headers
+package_i18n := wx$(release)-i18n
+package_doc := wx$(release)-doc
+package_examples := wx$(release)-examples
+package_common = wx-common
+
+package_gtk_py_lib := python-wxgtk$(release)$(unicode_suffix)
+package_gtk_py_ver = python-wxversion
+package_gtk_py_tools = python-wxtools
+package_gtk_py_addons = python-wxaddons
+package_gtk_dbg_py := python-wxgtk$(release)$(unicode_suffix)-dbg
+
+
+# The packages listed here are common to all wx versions, and may be provided
+# by another source package if more than one is in the release simultaneously.
+common_packages := $(package_common) $(package_gtk_py_ver) $(package_gtk_py_tools) $(package_gtk_py_addons)
+
+
+package_msw_dev := libwxmsw$(release)$(unicode_suffix)-dev
+package_msw_dbg := libwxmsw$(release)$(unicode_suffix)-dbg
+package_headers_msw := wx$(release)-headers-msw
+
+# The packages listed here will not be built by default.
+extra_packages := $(package_msw_dev) $(package_msw_dbg) $(package_headers_msw)
+
+ifdef DEBIAN_WX_DEFAULT_VERSION
+ extra_packages += $(common_packages)
+endif
+
+
+#---------------------------------------------------------------------------
+# Build directories
+
+objdir_wxbase_shared = objs_wxbase_sh
+objdir_wxbase_debug = objs_wxbase_d
+objdir_gtk_shared = objs_gtk_sh
+objdir_gtk_debug = objs_gtk_d
+objdir_gtk_install = objs_gtk_install
+objdir_doc_cruft = objs_doc_con
+objdir_doc = docs/wx-manual.html
+objdir_examples = docs/examples
+objdir_i18n = locale
+
+objdir_msw_shared = objs_msw_sh
+objdir_msw_static = objs_msw_st
+objdir_msw_dbg = objs_msw_d
+objdir_msw_install = objs_msw_install
+
+objdirs := $(objdir_wxbase_shared) $(objdir_wxbase_debug) \
+ $(objdir_gtk_shared) $(objdir_gtk_debug) $(objdir_gtk_install) \
+ $(objdir_doc_cruft) $(objdir_doc) $(objdir_examples) \
+ $(objdir_msw_shared) $(objdir_msw_static) $(objdir_msw_dbg) \
+ $(objdir_msw_install)
+
+#---------------------------------------------------------------------------
+# Build stamps: