progs_sh := d01 progs_py := d02 d04 progs_go := d05 d15 progs := $(progs_sh) $(progs_py) $(progs_go) .PHONY: all all: $(addsuffix _ok.txt,$(progs)) .PHONY: clean clean: rm -f $(addsuffix _out.txt,$(progs)) $(progs_go) .PHONY: ok-% ok-%: %_out.txt @cp -v $< $*_ok.txt %_ok.txt: %_out.txt @test -f $@ || (echo $*:; cat $<) @test -f $@ && (diff -u $@ $< && touch $@) || exit 0 $(addsuffix _out.txt,$(progs_sh)): %_out.txt: %.sh ./$< $*_input.txt > $@ $(addsuffix _out.txt,$(progs_py)): %_out.txt: %.py ./$< $*_input.txt > $@ $(addsuffix _out.txt,$(progs_go)): %_out.txt: % ./$< $*_input.txt > $@ $(progs_go): %: %.go go build -o $@ $<