#!/usr/bin/make -f
## debian/rules for neko.

%:
	dh $@ --with apache2,bash-completion

## Both AMD64 and all kFreeBSDs seem to have problems with the type
## punning used in the Neko source.
ifeq (amd64,$(DEB_HOST_ARCH))
export DEB_CFLAGS_MAINT_APPEND = -fno-strict-aliasing
endif
ifeq (kfreebsd,$(DEB_HOST_ARCH_OS))
export DEB_CFLAGS_MAINT_APPEND = -fno-strict-aliasing
endif

override_dh_auto_build:
	dh_auto_build -- \
		CFLAGS="$(CFLAGS) -Wall -fPIC -I vm -DCOMPACT_TABLE -D_GNU_SOURCE -I libs/common" \
		EXTFLAGS="$(LDFLAGS) -pthread" \
		STD_NDLL_FLAGS="$(LDFLAGS) -Lbin -lneko -lm -lrt"

override_dh_auto_install:

override_dh_strip:
	dh_strip -Xnekoc -Xnekotools

override_dh_fixperms:
	dh_fixperms
	find $(CURDIR)/debian -name '*.ndll' -exec chmod -x '{}' ';'

get-orig-source:
	uscan --verbose --rename --force-download
