瀏覽代碼

Makefile changes

master
Roderic Day 2 年之前
父節點
當前提交
634a2d2823
共有 1 個檔案被更改,包括 6 行新增6 行删除
  1. +6
    -6
      makefile

+ 6
- 6
makefile 查看文件

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

.SILENT:

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

pyrun: ${DATA}
cat ${DATA} | docker run -v `pwd`:/app/ -w /app/ -i --rm python:latest python -u ${CODE}
cat ${DATA} | docker run -v `pwd`:/app/ -w /app/ -i --rm python:latest python -u ./y${YEAR}/p${DAY0}.py

${DATA}:
# avoid spam in the lead up to the event
test ${YEAR}${DAY} -le `date +%Y%d`
test ${YEAR}${DAY0} -le `date +%Y%d`
# only poll if data isn't yet stored locally
test -f ${DATA} || curl -s -b "session=${SESSION}" ${URL} > ${DATA}

Loading…
取消
儲存