EXAMPLES = $(wildcard *.py) LOGFILES = ${EXAMPLES:.py=.log} .PHONY: all all: $(LOGFILES) %server.log: %server.py python3 $< > $@ & python3 $(subst server,client,$<) 1> /dev/null %client.log: %client.py python3 $(subst client,server,$<) 1> /dev/null& python3 $< > $@ clean: rm -f $(LOGFILES)