#!/bin/bash

cat <<EOF
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<CodeBlocks_project_file>
	<FileVersion major="1" minor="6" />
	<Project>
		<Option title="qe" />
		<Option pch_mode="2" />
		<Option compiler="gfortran" />
		<Build>
			<Target title="Release">
				<Option output="bin/Release/qe" prefix_auto="1" extension_auto="1" />
				<Option object_output="obj/Release/" />
				<Option type="1" />
				<Option compiler="gfortran" />
				<Compiler>
					<Add option="-O2" />
				</Compiler>
				<Linker>
					<Add option="-s" />
				</Linker>
			</Target>
		</Build>
		<Compiler>
			<Add option="-Wall" />
		</Compiler>
EOF
find ./ -name "*.[fF]" -or -name "*.[fF]90" | \
    awk '{print "                <Unit filename=\""$1"\" />"}'
cat <<EOF
		<Extensions>
			<code_completion />
			<envvars />
			<debugger />
			<fortran_project />
			<lib_finder disable_auto="1" />
		</Extensions>
	</Project>
</CodeBlocks_project_file>
EOF
