merge the makefiles

This commit is contained in:
Mylloon 2024-12-03 20:36:04 +01:00
parent 0d253c7da6
commit 67fdb2cd19
Signed by: Anri
GPG key ID: A82D63DFF8D1317F
3 changed files with 18 additions and 18 deletions

2
.gitignore vendored
View file

@ -1 +1,3 @@
.vscode/
*/Makefile

View file

@ -1,15 +0,0 @@
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)"

View file

@ -1,7 +1,8 @@
MKDIR = mkdir
CP = cp
LN = ln -s
LATEST_YEAR := $(lastword $(sort $(wildcard [0-9]*)))
LATEST_DAY := $(patsubst day%,%,$(lastword $(sort $(wildcard day[0-9]*))))
ifeq ($(LATEST_YEAR),)
NEW_YEAR := $(shell date -u +%Y)
@ -9,9 +10,21 @@ else
NEW_YEAR := $(shell echo $$(( $(LATEST_YEAR) + 1 )) )
endif
ifeq ($(LATEST_DAY),)
NEW_DAY := 1
else
NEW_DAY := $(shell echo $$(( $(LATEST_DAY) + 1 )) )
endif
all: create_year
all: $(if $(wildcard $(LATEST_YEAR)),create_year,create_day)
create_year:
$(MKDIR) "$(NEW_YEAR)"
$(CP) "$(LATEST_YEAR)/Makefile" "$(NEW_YEAR)"
cd "$(NEW_YEAR)" && $(LN) "../Makefile" .
create_day:
$(MKDIR) "day$(NEW_DAY)"
recreate_makefile:
$(LN) "../Makefile" .