Keeping the make process running (not --keep-going, not 'watch make')

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view

Keeping the make process running (not --keep-going, not 'watch make')

David Deutsch-2
Hey everybody,

I use make to build a document tree, again and again, when prerequisites

I observe outside change events and use inotify on some files and when a
change has occurred, I re-run make. So my problem is not detecting the
change - I already know when a change has occurred and where it happened.

My problem is that the more complex a document gets, the more makefiles
I put on the build graph (literally hundreds and hundreds of .mk and .d
files) and the more prerequisite files make has to parse on each startup.

It handles that remarkably well, but I wonder: Would it be possible to
keep the make process itself running with the state that it has
generated? It just seems like a waste to continually re-establish the
same state, over and over again.

Put differently: There are some applications of make where booting up
make and building the dependency graph is the most expensive part, by
far. Would it be possible to keep the make process running and that
graph in memory?

I assume the actually tricky part would then be telling make about those
changes, but let's say I'd be able to do something like:

~/my-project$ make my-target --keep-process-running

[... doing a bunch of stuff, then freeing the terminal for further input]

make[1]: Leaving directory '~/my-project'
make[1]: Keeping the process running in the background under ID XX

so it would tell me some kind of process ID, then I would later do
something like:

~/my-project$ make my-target --existing-process=ID

Does anybody know if that is a use case that somebody has already

Does anybody have an idea about the feasibility of extending make like
that (even when maintaining a custom fork) would be?

best regards,