#!/usr/bin/make -f

# Enable modern Debian packaging
export DH_VERBOSE = 1

# Hardening flags for security
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)

override_dh_shlibdeps:

override_dh_strip:

override_dh_dwz:

# Skip the nondeterminism stripping step
override_dh_strip_nondeterminism:
	true

# Ensure we are copying the right prebuilt binaries for each architecture
override_dh_auto_install:
ifeq ($(DEB_BUILD_ARCH), amd64)
	# For amd64, copy the files from the penguins-eggs-amd64 directory to debian/tmp, flattening the structure
	mkdir -p debian/tmp/usr
	cp -r penguins-eggs-amd64/usr/* debian/tmp/usr/
endif

ifeq ($(DEB_BUILD_ARCH), i386)
	# For i386, copy the files from the penguins-eggs-i386 directory to debian/tmp, flattening the structure
	mkdir -p debian/tmp/usr
	cp -r penguins-eggs-i386/usr/* debian/tmp/usr/
endif

	# Run dh_auto_install to handle other installation tasks (install docs, etc.)
	dh_auto_install

	# Call dh_install to install files from debian/tmp to package directories
	dh_install
