How to merge all files that end with .mk in a directory and subdirectories into one file?

Posted on

Problem :

I have many makefiles in a top level directory and its subdirectories. I want to combine them all into one big .mk file, what’s the most efficient way to do that?

Solution :

Something like this?

cat $(find . -type f -name *.mk) > output.mk

Example:

a.mk       # a
d1/b.mk    # b
d1/c.mk    # c
d1/d2/d.mk # d

Would produce in output.mk

a
b
c
d

Leave a Reply

Your email address will not be published.