Browse Source

Add makefile

master
mid-kid 12 months ago
parent
commit
ed1618c234
  1. 32
      Makefile
  2. 2
      d01_ok.txt
  3. 2
      d02_ok.txt
  4. 2
      d04_ok.txt
  5. 2
      d05_ok.txt

32
Makefile

@ -0,0 +1,32 @@
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 $@ $<

2
d01_ok.txt

@ -0,0 +1,2 @@
56397
55701

2
d02_ok.txt

@ -0,0 +1,2 @@
2169
60948

2
d04_ok.txt

@ -0,0 +1,2 @@
26346
8467762

2
d05_ok.txt

@ -0,0 +1,2 @@
579439039
7873084
Loading…
Cancel
Save