4 ms·
Make does a lot more than just reading makefiles - sometimes it re-reads them as a result of something that happened in the makefile itself. It's also doing a
by t43562 3y ago
Make does a lot more than just reading makefiles - sometimes it re-reads them as a result of something that happened in the makefile itself.
It's also doing a lot of variable expansion and if the makefile uses macros like define....endef to generate rules it has to expand those.
Make is also often trying all sorts of pattern rules to see if they will allow it to fulfill dependencies. This takes time.
If makefiles are small and you run make on each one separately then you miss dependencies across modules and you get the syndrome where program A doesn't get rebuild when library B changes.
So there's a price to pay for everything. Ninja is a lot faster because it just doesn't have some of these features and you can make a big makefile where dependencies work properly with it and not pay the price of slow parsing.
I worked on builds that took 12 hours on a large cluster of build machines where parsing was 45 minutes - so it matters. The more general solution would be to use a packaging system like the Linux distributions but even that doesn't save you from every problem as I also found out when working with OBS on a linux phone distribution.