I already did a bash version that is posted here. Although I was not very happy of the performance. The script was slow, very slow. 14 seconds were needed to generate a makefile for my project Kill da Duck. With this python version only 0.5 seconds are needed.

The behaviour is quite the same, I just added memoization to make it faster
src-dirsrc-dirPython actually made the coding very easy, I don’t know it very well yet but still, it really makes a difference. Even more if we compare it to bash.
The use of dictionaries, lists and sets that are built-in types made the dev easy and fast.
At the beginning I was very impressed by the performance as I was used to my old, slow version in bash. I didn’t tested too much because I don’t really need it as I must be the only one using this script but if someone report an issue I’ll fix it asap.
Get the source code here