-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
78 lines (64 loc) · 1.73 KB
/
Makefile
File metadata and controls
78 lines (64 loc) · 1.73 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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
.PHONY: run pre 2022 2023 2024 2025 pre-2022 pre-2023 pre-2024 pre-2025
# read and export .env file(s)
ifneq (,$(wildcard ./.env))
include .env
export
endif
ifneq (,$(wildcard $(YEAR)/.env))
include $(YEAR)/.env
export
endif
SHELL := /bin/bash
CWD := $(PWD)/$(YEAR)
run: pre $(YEAR)
pre:
@if [ -z "$(YEAR)" ]; then \
echo "YEAR is not set"; \
exit 1; \
fi
export CWD=$(CWD)
# Go 1.25+ check
pre-2022:
@if [ -z "$(shell which go)" ]; then \
echo "go not installed"; \
exit 1; \
fi
@MAJOR=$$(go version 2>/dev/null | sed -n 's/.*go\([0-9]*\)\.\([0-9]*\).*/\1/p'); \
MINOR=$$(go version 2>/dev/null | sed -n 's/.*go\([0-9]*\)\.\([0-9]*\).*/\2/p'); \
if [ "$$MAJOR" -lt 1 ] || ([ "$$MAJOR" -eq 1 ] && [ "$$MINOR" -lt 25 ]); then \
echo "go version 1.25+ required (found version $$MAJOR.$$MINOR)"; \
exit 1; \
fi
2022: pre-2022
cd 2022 && go run main.go
# Python 3.10 check
pre-2023:
@if [ -z "$(shell which python3)" ] && [ "$(shell python3 --version | cut -d '.' -f 2)" -eq 10 ]; then \
echo "python3.10 not installed or used"; \
exit 1; \
fi
2023: pre-2023
python3 2023/main.py
# Cmake (3.31.1 and C++23 determined by CMakelist)
pre-2024:
@if [ -z "$(shell which cmake)" ]; then \
echo "cmake not installed"; \
exit 1; \
fi
2024: pre-2024
cmake -S 2024 -B 2024 && $(MAKE) -C 2024 --no-print-directory && ./2024/2024
# dotnet 10 check
pre-2025:
@if [ -z "$(shell which dotnet)" ]; then \
echo "dotnet not installed"; \
exit 1; \
fi
@MAJOR=$$(dotnet --version 2>/dev/null | cut -d '.' -f 1); \
if [ "$$MAJOR" -ne 10 ]; then \
echo "dotnet version 10 required (found version $$MAJOR)"; \
exit 1; \
fi
2025: pre-2025
echo $(YEAR)
echo $(CWD)
cd 2025 && dotnet run --project 2025.csproj