Complete the macro approach to defining variables

This commit is contained in:
Andrew Stryker 2023-09-21 10:08:47 -07:00
parent 1dfeffeb0f
commit 768280a135
2 changed files with 19 additions and 10 deletions

View File

@ -34,8 +34,10 @@ ifndef ENV_LOADED
endif
#$(info $(value MAKE_SECTION_VARS))
# Compute definitions for the section, working, and staging directories
$(eval $(call SECTION_DIRS))
$(eval ${MAKE_SECTION_VARS})
# Gather file lists
templates ::= $(wildcard *.gmi.m4)
@ -68,7 +70,6 @@ create: #> Create a new post (default)
fi
build: ${gemtext_copied} ${templates_expanded}
@echo "Makeflags .................... '$${MAKEFLAGS}'"
@echo "✓ Completed processing ${section}"
@echo

View File

@ -72,15 +72,23 @@ export STAGING
# assume the values appropriate for the current section. This approach defines
# a macro that we can call when we recurse into each section
#
# TODO: not call to the shell repeatedly
define SECTION_DIRS
section = $$(shell basename $${CURDIR})
#working_section ::= ${WORKING}/$${section}
#staging_section = ${STAGING}/$$(value section)
working_section = ${WORKING}/$$(shell basename $${CURDIR})
staging_section ::= ${STAGING}/$$(shell basename $${CURDIR})
# TODO: Is it possible to simplify this?
define MAKE_SECTION_WORKING
working_section ::= ${WORKING}/$$(value $${1})
endef
export SECTION_DIRS
export MAKE_SECTION_WORKING
define MAKE_SECTION_STAGING
staging_section ::= ${STAGING}/$${1}
endef
export MAKE_SECTION_STAGING
define MAKE_SECTION_VARS
section ::= $$(shell basename $${CURDIR})
$$(eval $$(call MAKE_SECTION_WORKING,$${section}))
$$(eval $$(call MAKE_SECTION_STAGING,$${section}))
endef
export MAKE_SECTION_VARS
# Makefiles
CURATE_MAKE ::= ${MAKO_DIR}/curate.mk