merge the makefiles
This commit is contained in:
parent
0d253c7da6
commit
67fdb2cd19
3 changed files with 18 additions and 18 deletions
2
.gitignore
vendored
2
.gitignore
vendored
|
@ -1 +1,3 @@
|
||||||
.vscode/
|
.vscode/
|
||||||
|
|
||||||
|
*/Makefile
|
||||||
|
|
|
@ -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)"
|
|
19
Makefile
19
Makefile
|
@ -1,7 +1,8 @@
|
||||||
MKDIR = mkdir
|
MKDIR = mkdir
|
||||||
CP = cp
|
LN = ln -s
|
||||||
|
|
||||||
LATEST_YEAR := $(lastword $(sort $(wildcard [0-9]*)))
|
LATEST_YEAR := $(lastword $(sort $(wildcard [0-9]*)))
|
||||||
|
LATEST_DAY := $(patsubst day%,%,$(lastword $(sort $(wildcard day[0-9]*))))
|
||||||
|
|
||||||
ifeq ($(LATEST_YEAR),)
|
ifeq ($(LATEST_YEAR),)
|
||||||
NEW_YEAR := $(shell date -u +%Y)
|
NEW_YEAR := $(shell date -u +%Y)
|
||||||
|
@ -9,9 +10,21 @@ else
|
||||||
NEW_YEAR := $(shell echo $$(( $(LATEST_YEAR) + 1 )) )
|
NEW_YEAR := $(shell echo $$(( $(LATEST_YEAR) + 1 )) )
|
||||||
endif
|
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:
|
create_year:
|
||||||
$(MKDIR) "$(NEW_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" .
|
||||||
|
|
Loading…
Reference in a new issue