-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
48 lines (38 loc) · 1.04 KB
/
Makefile
File metadata and controls
48 lines (38 loc) · 1.04 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
PROJECT = $(shell basename $(CURDIR))
DC = docker compose
YEAR ?= $(shell date +%Y)
DAY ?= $(shell date +%e | xargs)
DCR = ${DC} run --rm --no-deps ${PROJECT}
workdir = aoc/${YEAR}/$(shell printf '%02d' $(DAY))
.PHONY: init
init: destroy build shell ## Setup project with python resources
.PHONY: destroy
destroy: ## Delete the previous setup
${DC} down --remove-orphans --rmi local
.PHONY: build
build: ## Build the project
${DC} build ${PROJECT}
.PHONY: up
up: ## Start the service
${DC} up -d
.PHONY: shell
shell: ##- Run a bash shell
${DCR} bash
.PHONY: run
run: ## Run the project
${DCR} python ${workdir}/code.py
.PHONY: in
in: ## Fetches a day's inputs
curl 'https://adventofcode.com/${YEAR}/day/${DAY}/input' -H "cookie: session=${AOCTOKEN}" > ${workdir}/input.txt
cat ${workdir}/input.txt
.PHONY: day
day: ## Create a new day
mkdir -p ${workdir}
cp -n template/* ${workdir}/
git add ${workdir}
.PHONY: start
start: day in ## Create a new day and fetch inputs
code ${workdir}/code.py
.PHONY: what
what: ## What day is it?
@echo ${workdir}