We have a proprietary compiler that can take a number of input files and process them at once:
compiler a.in
# produces a.out
compiler a.in b.in c.in
# produces a.out b.out c.out
The reason to do that is that is saves a lot of time for initialization. For thousands of files the batch version is orders of magnitude faster than compiling files individually. We also run a post-processor on the files.
Now, I have this in the (GNU) makefile, which is not taking advantage of the batch processing capabilities and updates files one by one. I want to update it to use batch compilation:
.INTERMEDIATE: $(TMP)
$(TMP): $(TMPDIR)/%.tmp: $(SRCDIR)/%.in |$(TMPDIR)
compiler $< -o $@
$(RESULT): $(RESDIR)/%.out: $(TMPDIR)/%.tmp $(SRCDIR)/%.in
post-process $< -o $@
How would I rewrite the first rule to recompile all files that have been modified with a single command, perhaps, using $?
? The second rule needs to stay there and work the same.