#!/usr/bin/make -f

# See debhelper(7) (uncomment to enable).
# Output every command that modifies files on the build system.

BUILDDIR=build_dir

# Ignore false warnings with GCC:
#
# stringop-overflow false positive in GCC < 11.3
# https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99578
#
# maybe-uninitialized false positive in GCC < 12.3 (note 12.3 is currently unreleased)
# https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105937
#
# Reference OpenRCT2 bug reports: 
# https://github.com/OpenRCT2/OpenRCT2/issues/16691 (-Wno-stringop-overflow)
# https://github.com/OpenRCT2/OpenRCT2/issues/17371 (-Wno-maybe-uninitialized -Wno-error=null-dereference)
export DEB_CFLAGS_MAINT_APPEND   = -Wno-stringop-overflow -Wno-maybe-uninitialized -Wno-error=null-dereference
export DEB_CXXFLAGS_MAINT_APPEND = -Wno-stringop-overflow -Wno-maybe-uninitialized -Wno-error=null-dereference

# https://manpages.debian.org/testing/dpkg-dev/dpkg-architecture.1.en.html#Usage_in_debian/rules
DEB_BUILD_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE)
DEB_HOST_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE)

# Set the number of jobs for armhf to avoid OOMing on older GCC versions (affects Launchpad PPA builds for Ubuntu)
ifneq (,$(filter armhf,$(DEB_BUILD_GNU_TYPE)))
    export DEB_BUILD_OPTIONS = parallel=2
endif

#export DH_VERBOSE = 1


# See FEATURE AREAS in dpkg-buildflags(1).
#export DEB_BUILD_MAINT_OPTIONS = hardening=+all

# See ENVIRONMENT in dpkg-buildflags(1).
# Package maintainers to append CFLAGS.
#export DEB_CFLAGS_MAINT_APPEND  = -Wall -pedantic
# Package maintainers to append LDFLAGS.
#export DEB_LDFLAGS_MAINT_APPEND = -Wl,--as-needed


%:
	dh $@


# dh_make generated override targets.
# This is an example for Cmake (see <https://bugs.debian.org/641051>).
#override_dh_auto_configure:
#	dh_auto_configure -- \
#	-DCMAKE_LIBRARY_PATH=$(DEB_HOST_MULTIARCH)
