make jobserver integration ========================== It seems to be possible with both GNU Make and pmake/BSD Make. GNU Make -------- Modify command to start with +: myapp: main.slul +cslul $(srcdir)/main.slul NOTE!!! GNU Make 4.4 will change how the jobserver works from a pipe to mkfifo. pmake/BSD Make -------------- BSD Make seems to create the file descriptors if the recipe contains $(MAKE) somewhere (even in arguments to commands). The file descriptors have high numbers such as 15,16. myapp: main.slul cslul --ignore $(MAKE) $(srcdir)/main.slul Combined solution ----------------- myapp: main.slul +cslul $(srcdir) --outdir . --jobserver $(MAKE) Checking MAKEFLAGS ------------------ Jobserver FD detection: GNU Make: --jobserver-auth=3,4 BSD Make: -J 15,16 Detecting -n option (don't run commands): GNU Make: n (first word is n) BSD Make: -n (contains option -n) Fortunately, BSD make does not add the targets in MAKEFLAGS, so if there is a target called "n", it will not show up. Additionally, -t might need to be detected (touch targets): GNU and BSD Make: -t (contains option -t) Supporting pthreads ------------------- Threading (or forking) is necessary to support parallel compilation of a single module. Perhaps something like this in the cslul Makefile: THREADFLAGS = $(THREADS:pthread=-pthread -DENABLE_PTHREAD) THREADFLAGS = $(THREADS:winapi=-DENABLE_WINAPI_THREADS) .c.o: $(CC) ... $(THREADFLAGS) $(CFLAGS) cslul: $(CC) ... $(THREADFLAGS) $(CFLAGS) Then, in the source: #if defined(ENABLE_PTHREAD) ... #elif defined(ENABLE_WINAPI_THREADS) ... #else ... #endif Makefile invocation: make THREADS=pthread cslul