Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

I've had luck using https://github.com/dmoulding/boilermake

It's a GNU Make framework which allows you to create non-recursive Makefiles. I've re-worked it a bit, and used it in my pet project: https://github.com/freeradius/freeradius-server/

100K+ LoC, ~400 source files, multiple subdirectories, building libraries, executables, etc.

Most of the slowness of Make is due to people creating recursive Makefiles. Running endless shell programs is very slow. Make by itself is surprisingly fast.

The other benefit of non-recursive Make is that the builds can now go in parallel. What used to be a ~90s build is now ~7s on a multi-core machine.

I also replace libtool (shudder) with jlibtool. That was taken from Apache, and modified to fix bugs work better, etc. That sped up the build a lot, too.

Maybe I'm crazy, but these tools have worked across all Unix-y platforms I've tried. And I needed a migration path from recursive Make / libtool to something better. Dropping the build system on the floor and hoping for something better wasn't an option. This tool suite works much like the old one, but it's simpler, faster, and doesn't require additional packages (python, etc.) to do the build. Everything outside of Make is self-contained, and is included in the FreeRADIUS distribution.

My projects:

https://github.com/alandekok/boilermake

https://github.com/alandekok/jlibtool

https://github.com/alandekok/boilermake



If anyone wants to do non-recursive make for big projects, I would take a look at what the Android platform does. They have this elaborate Android.mk makefile fragment system.

At the beginning of the build you go and find all the fragments, then process/concatenate them into one huge makefile, and do a single make invocation. It results in a very parallelizable build.

It seems kinda crazy and hacky but it definitely works better than recursive make.

For some reason the best docs seem to be on this Korean site:

http://www.kandroid.org/ndk/docs/ANDROID-MK.html


Except parsing all the Android.mk and computing the dependencies is slow as hell.

Try running make at the top of an AOSP tree, it takes about 60 seconds, and that part cannot be parallelized.

If you are looking for alternatives, have a look at http://martine.github.io/ninja/


Yeah definitely if you were starting from scratch, I would consider other build systems.

But if you already have a huge mess of recursive make, it might be easier to port it to a non-recursive Android-like system then completely rewrite it with gyp/gn/cmake + ninja.

It would speed up your full build times; not sure what it would do to incremental build times. It is true that the Android.mk thing has a large startup cost. Then again, you're building a whole OS with one make invocation, which is kinda cool.


They said the build is now so parallel - distributed to 30 machines - that make is having trouble generating jobs fast enough.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: