#!/usr/bin/make -f

export DH_VERBOSE=1

# -std=gnu17: gcc 15 默认 -std=gnu23，此时函数声明中的空参数列表 () 等价于 (void)，
# 上游 2005 年老代码大量使用 char *f(); int g(); 这类旧式声明（并与 edit.h 中的原型并存），
# 会产生 conflicting types / too many arguments / incompatible pointer type 等编译错误。
# 固定为 gnu17 恢复旧式空参数列表语义，仅为编译参数，不改动上游代码。
export DEB_CFLAGS_MAINT_APPEND=-DNCURSES -std=gnu17

# This is introduced to support cross-building
include /usr/share/dpkg/architecture.mk

%:
	dh $@ --without autoreconf

override_dh_auto_configure:
	dh_update_autotools_config
	CFLAGS="$$(dpkg-buildflags --get CFLAGS)" PRNTCMD=lpr $(CURDIR)/configure --prefix=/usr --libdir='$${prefix}/share' --mandir='$${prefix}/share/man' \
			--build=$(DEB_BUILD_GNU_TYPE) --host=$(DEB_HOST_GNU_TYPE)

override_dh_auto_install:
	dh_auto_install -- DESTDIR=$(CURDIR)/debian/xwpe/usr/bin prefix=$(CURDIR)/debian/xwpe/usr 
