diff --git a/2023/Makefile b/2023/Makefile new file mode 100644 index 0000000..d93ad8e --- /dev/null +++ b/2023/Makefile @@ -0,0 +1,15 @@ +MKDIR = mkdir + +LATEST_DAY := $(patsubst day%,%,$(lastword $(sort $(wildcard day[0-9]*)))) + +ifeq ($(LATEST_DAY),) + NEW_DAY := 1 +else + NEW_DAY := $(shell echo $$(( $(LATEST_DAY) + 1 )) ) +endif + + +all: create_day + +create_day: + $(MKDIR) "day$(NEW_DAY)" diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..f796384 --- /dev/null +++ b/Makefile @@ -0,0 +1,17 @@ +MKDIR = mkdir +CP = cp + +LATEST_YEAR := $(lastword $(sort $(wildcard [0-9]*))) + +ifeq ($(LATEST_YEAR),) + NEW_YEAR := $(shell date -u +%Y) +else + NEW_YEAR := $(shell echo $$(( $(LATEST_YEAR) + 1 )) ) +endif + + +all: create_year + +create_year: + $(MKDIR) "$(NEW_YEAR)" + $(CP) "$(LATEST_YEAR)/Makefile" "$(NEW_YEAR)"