#!/bin/bash

prefix=$1
index=$2

echo "(* This file is automatically generated. Do not edit. *)"

for i in $index;
do
    # Currently there are some All.v files in the repository, we need to exclude them here.
    if [[ $i = *.v && (! $i = *.All.v) ]]
    then
        # This is essentially the same as echo $i | tr '/' '.'
        filename=${i////.}
        echo "Require Export $prefix.${filename%.v}."
    fi
done | sort -d
