#!/usr/bin/make -f

export DEB_BUILD_MAINT_OPTIONS = hardening=+all

NUMJOBS = $(patsubst parallel=%,%,$(filter parallel=%,$(DEB_BUILD_OPTIONS)))

%:
	dh $@

override_dh_clean:
	scons --clean
	dh_clean .sconsign.dblite build/

override_dh_auto_build:
	CFLAGS="$(CFLAGS) $(CPPFLAGS)" CXXFLAGS="$(CXXFLAGS)" LDFLAGS="$(LDFLAGS)" \
        scons prefix=/usr verbosebuild=1 ipv6=1 sdl2=1 --debug=presub -j $(NUMJOBS)

override_dh_auto_install:
	dh_auto_install --destdir=tmp

execute_before_dh_install:
	install -m644 contrib/packaging/linux/descent.svg  build/d1x-rebirth.svg
	install -m644 d1x-rebirth/d1x-rebirth.desktop build/io.github.dxx_rebirth.dxx_rebirth.d1x-rebirth.desktop

override_dh_installchangelogs:
	dh_installchangelogs -pd1x-rebirth d1x-rebirth/RELEASE-NOTES.txt
