Code of the Advent kind, maybe in Go this year
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

32 lines
645 B

progs_sh := d01
progs_py := d02 d04
progs_go := d05
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 $@ $<