浏览代码

make

master
Roderic Day 2 年前
父节点
当前提交
ea7cdd1995
共有 1 个文件被更改,包括 4 次插入4 次删除
  1. +4
    -4
      makefile

+ 4
- 4
makefile 查看文件

@@ -3,17 +3,17 @@ export

.SILENT:

PYTHONPATH := .
CODE := $(shell find . -path "./y????/p??.py" -type f | xargs ls -rt | tail -n 1)
DATA := $(shell echo ${CODE} | sed s/.py/.dat/)
YEAR := $(shell echo ${CODE} | sed 's/[^0-9]/ /g' | cut -d' ' -f4)
DAY := $(shell echo ${CODE} | sed 's/[^0-9]/ /g' | cut -d' ' -f6)
URL := https://adventofcode.com/${YEAR}/day/`echo ${DAY} | bc`/input

main:
pyrun: ${DATA}
PYTHONPATH=. python3 -u ${CODE} < ${DATA}

${DATA}:
# avoid spam in the lead up to the event
test ${YEAR}${DAY} -le `date +%Y%d`
# only poll if data isn't yet stored locally
test -f ${DATA} || curl -s -b "session=${SESSION}" ${URL} > ${DATA}
# have fun! (access data through `open(0)`)
cat $(DATA) | python3 -u ${CODE}

正在加载...
取消
保存