#!/usr/bin/make -f

# Build with both
export FC_DEFAULT=gfortran
export FC_OPTIONAL=flang lfortran
export DH_NO_ORIG_LIBS=1

export DEB_BUILD_PROFILES=stage1

export DH_VERBOSE=1

ifneq ($(filter stage1,$(DEB_BUILD_PROFILES)),)
execute_before_dh_auto_clean:
	- mv fpm.toml.orig fpm.toml

execute_before_dh_auto_configure:
	cp fpm.toml fpm.toml.orig
	cp debian/fpm.toml.bootstrap fpm.toml
endif

# Necessary to build shared libraries
export DEB_LDFLAGS_MAINT_APPEND=-fPIC

# The magic debhelper  rule
%:
	dh $@ --with fortran --buildsystem fortran

