## #

# At the moment processing of the content largely involves transforming # source files so that they are presented as primitive HTML... # a particularly basic form of # Literate Programming # "tangling" # . #

# Source files themselves are currently written such that there is # embedded documentation islands with HTML tags such that if the # comment markers themselves are removed then the contents are valid, # readable HTML. Such markers themselves will also be confined to # the start of lines in the interest of simplicity and marginal efficiency. #

# The straightforward logic to provide such removal is provided by # remove_comment_prefix, # which is defined and compiled here (relying on standard make rules). #

##

PROCESS := remove_comment_prefix
$(PROCESS): remove_comment_prefix.c

## 
#

This magical transformation can then be applied to the source Makefiles # in this project. The top level Makefile will be handled explicitly.

##

Makefile.html: Makefile $(PROCESS)
	< $(<) ./$(PROCESS) > $(@)

## 
#

# The other Makefiles (like this one), can be handled by a pattern rule. #

# The produced HTML files will append .html suffix while preserving the # original which simplifies both the rules and the Web server config. #

##

%.mk.html: %.mk $(PROCESS)
	< $(<) ./$(PROCESS) > $(@)

## 
#

# All the processed files should be defined so that they can be produced prior to # deployment. #

##

OUTS := Makefile.html
OUTS += $(call addsuffix,.html,$(wildcard *.mk))

site: $(OUTS)
.PHONY: site