#!/bin/bash

dir=`basename $PWD`

echo "srcs_$dir = ["
ls *.c | sed -e "s/^/    '/" -e "s/$/',/"
echo "]"

if [ -f `echo *.h | tr ' ' '\n' | head -1` ]; then
	echo "hdrs_$dir = ["
	ls *.h | sed -e "s/^/    '/" -e "s/$/',/"
	echo "]"
fi

echo "foreach target : targets"
echo "	value = get_variable('target_' + target)"
echo "	set_variable('lib_$dir' + target,"
echo "		static_library('$dir' + target,"
echo "			srcs_$dir",
echo "			pic: false",
echo "			include_directories: inc",
echo "			c_args: value[1]))"
echo "endforeach"
