I have this in my Makefile:
BINS = $(shell echo *.bin)
.PHONY: $(BINS)
run: $(BINS)
*.bin:
./$@
I run it as make -j 8
This way it looks for all files ending with .bin, and runs them in parallel using make’s -j option (Makefile run processes in background)
I need to modify the makefile so that it runs all files of the type mpi*.bin as mpirun -np 2 ./mpi*.bin, and the remaining executable files as ./<filename>.bin
Thanks for your help.
Here is a simple example I used to test my answer:
to create some empty test files, and my Makefile based on yours:
It is key here that the rule for the prefixed files follows the non-prefixed rule. If not, the prefixed rule will be overridden.
This seems to work for distinguishing between the prefixed and non-prefixed files, but gives the following output:
I’m sure that there’s a way to suppress those warnings or do it better, but this approach seems to work.