#!/usr/bin/make -f

export FC_DEFAULT=gfortran-15
export FC_OPTIONAL=flang-21 lfortran

export DH_NO_ORIG_LIBS=1

# Necessary to build shared libraries
export DEB_LDFLAGS_MAINT_APPEND=-fPIC

export DH_VERBOSE=1

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

execute_after_dh_auto_clean:
	rm -rf obj-* docs/man3 docs/cat3 docs/*gz

execute_after_dh_auto_build:
	(cd docs; unzip manpages.zip)

execute_after_dh_fixperms:
	chmod 644 debian/libfortran-cli2-dev/usr/share/doc/libfortran-cli2-dev/examples/demos/*.f90
	chmod 644 debian/libfortran-cli2-dev/usr/share/doc/libfortran-cli2-dev/examples/*.f90
	chmod 644 debian/libfortran-cli2-dev/usr/share/doc/libfortran-cli2-dev/examples/one.rsp
