#!/usr/bin/make -f

NUMJOBS = $(shell getconf _NPROCESSORS_ONLN 2>/dev/null || echo 1)
ifneq (,$(filter parallel=%,$(DEB_BUILD_OPTIONS)))
	NUMJOBS = $(patsubst parallel=%,%,$(filter parallel=%,$(DEB_BUILD_OPTIONS)))
	MAKEFLAGS += -j$(NUMJOBS)
else
	DEB_BUILD_OPTIONS += parallel=$(NUMJOBS)
	export DEB_BUILD_OPTIONS
endif

export DEB_LDFLAGS_MAINT_APPEND=-Wl,--as-needed
DPKG_EXPORT_BUILDFLAGS = 1
include /usr/share/dpkg/buildflags.mk

%:
	dh $@ \
		--with autoreconf \
		--parallel

override_dh_auto_configure:
	dh_auto_configure -- --with-contrib-plugins=all

override_dh_install:
	find $(CURDIR)/debian/tmp -name "*.la" -delete
	dh_install --fail-missing

override_dh_strip:
	dh_strip --dbg-package=codeblocks-dbg

overide_dh_makeshlibs:
	dh_makeshlibs -Xusr/lib/codeblocks/plugins -Xusr/lib/codeblocks/wxContribItems

override_dh_shlibdeps:
	dh_shlibdeps -Xusr/lib/codeblocks/plugins
