%.html:
echo -n > $@
INDEXES = index.html $(patsubst %,%/index.html,$(SUBDIRECTORIES))
indexes: $(INDEXES)
@:
.PHONY: clean_indexes
clean_indexes:
$(RM) $(RMFLAGS) $(INDEXES)
clean: clean_indexes
LISTING_FILE:= listing.html
.PHONY: listing_message
listing_message:
@echo Creating $(LISTING_FILE) from $(DIRECTORY)
.PHONY: listing
listing: BASH := /usr/bin/env bash
listing: ROOT := "../`[ -d "../${NAME}" ] && echo ${NAME} || echo $(DIRECTORY)`"
listing: CREATE := sed 's/ \\//g' | $(BASH) -s - "$(NAME)" "$(ROOT)" "$(HREFPREFIX)" "$(DETAILSATTRIBUTES)"
listing: listing_message
@echo ' \
listing() \
{ \
local title="$${1}" \
local directory="$${2}" \
local hrefprefix="$${3:+$${3}/}" \
local detailsattributes="$${4}" \
\
cat << _END_ \
\
$${title}
\
$$(list " " "$${directory}" "$${hrefprefix}" "") \
\
_END_ \
} \
list() \
{ \
local indent="$${1}" \
local directory="$${2}/" \
local hrefprefix="$${3:-}" \
local detailsattributes="$${4:-}" \
local file="" \
local name="" \
echo "$${indent}" \
for file in $$(find $${directory} -mindepth 1 -maxdepth 1 | LC_ALL=C sort) \
do \
name="$$(basename "$${file}" | sed -e "s/^\..*//")" \
if [ "$${name}" == "$(LISTING_FILE)" ] || [ "$${name}" == "" ] \
then \
continue \
elif [ -d "$${file}" ] \
then \
if [ ! -f "$${file}/Private" ] \
then \
echo "$${indent}" \
echo "$${indent} $${name}
" \
list "$${indent} " "$${file}" "$${hrefprefix}" "$${detailsattributes}" \
echo "$${indent} " \
fi \
elif [ -f "$${file}" ] \
then \
file="$$(echo "$${file}" | sed -e "s/^\.\.\///")" \
echo "$${indent}- $${name}
" \
fi \
done \
echo "$${indent}
" \
} \
set -euo pipefail \
listing "$${1}" "$${2:-.}" "$${3:-}" "$${4:-}"' | $(CREATE) > $(LISTING_FILE)
.PHONY: clean_listing
clean_listing:
$(RM) $(RMFLAGS) $(LISTING_FILE)
clean: clean_listing
.PHONY: text_manual
text_manual: manual
$(RM) $(RMFLAGS) $(MANPAGE) $(MANUAL_MDOC:.mdoc=.d)
.PHONY: website
website: clean stripformfeeds .WAIT text_manual .WAIT listing .WAIT indexes