From: "Yann E. MORIN" <yann.morin.1998@free.fr>
To: Ismael Luceno <ismael@iodev.co.uk>
Cc: buildroot@buildroot.org
Subject: Re: [Buildroot] [RFC PATCH] docs/website: Add Makefile to pre-generate the website
Date: Tue, 6 Feb 2024 16:08:39 +0100 [thread overview]
Message-ID: <ZcJLd7drFQn9tz6I@landeda> (raw)
In-Reply-To: <20240206144030.18329-1-ismael@iodev.co.uk>
Ismael, All,
On 2024-02-06 15:40 +0100, Ismael Luceno spake thusly:
> Supports the current includes plus smu [0] lightweight markup.
>
> [0] https://github.com/Gottox/smu
> Signed-off-by: Ismael Luceno <ismael@iodev.co.uk>
> ---
[--SNIP--]
> diff --git a/docs/website/Makefile b/docs/website/Makefile
> new file mode 100644
> index 000000000000..b0a56919c0e7
> --- /dev/null
> +++ b/docs/website/Makefile
> @@ -0,0 +1,33 @@
> +.PHONY: all
> +all:
> +
> +# Avoid implicit rules
> +MAKEFLAGS += -r
> +
> +AWK ?= mawk
Make that gawk, so that we can do [0] (see below)
> +SRCDIR := ${CURDIR}
Use parentheses not curly braces, to expand variables in Makefiles,
like we do everyelse in Buildroot: $(..)
(yes, both are valid, but lets be consistent throughout our code base)
> +DEPLOYDIR := ${CURDIR}/out
> +
> +src-pages != find ${SRCDIR} -maxdepth 1 -name \*.html -o -name \*.smu
> +dst-pages := ${src-pages:${SRCDIR}/%=${DEPLOYDIR}/%}
> +dst-pages := ${dst-pages:.smu=.html}
> +
> +all: ${dst-pages}
> +
> +conf-files := ${MAKEFILE_LIST}
> +conf-files += $(wildcard ${HOME}/.tidyrc)
> +conf-files += ${SRCDIR}/incfile.awk
> +
> +${DEPLOYDIR}/%.html: ${SRCDIR}/%.html ${conf-files}
> + mkdir -p "${@D}"
> + tmpfile=$$(mktemp) && \
> + ${AWK} -f incfile.awk $< > "$$tmpfile" && \
> + { tidy -q -m -i "$$tmpfile"; :; } && \
> + mv "$$tmpfile" $@
> +
> +${DEPLOYDIR}/%.html: ${SRCDIR}/%.smu ${conf-files}
> + mkdir -p "${@D}"
> + tmpfile=$$(mktemp) && \
> + smu < $< | ${AWK} -f incfile.awk | tidy -q -m > "$$tmpfile" && \
What is the rationale for using smu and tidy to do the deployement?
We don't need/want to minimify the content...
> + mv "$$tmpfile" $@
> diff --git a/docs/website/incfile.awk b/docs/website/incfile.awk
> new file mode 100644
> index 000000000000..350a88e7b956
> --- /dev/null
> +++ b/docs/website/incfile.awk
> @@ -0,0 +1,23 @@
> +BEGIN {
> + FS="\""
> +}
> +
> +{
> + do {
> + if (match($0, /^<!--#include file="([^"]*)" *-->$/)) {
> + file_stack[++file_cur] = $2
> + } else {
> + print
> + }
> + if (file_cur) {
> + e = getline < file_stack[file_cur]
> + if (!e) {
> + --file_cur
> + } else if (e == -1) {
> + printf "%s: read error\n", \
> + file_stack[file_cur] \
> + > "/dev/stderr"
[0] In case of error, we do want to exit in error and be sure this is
caught at the Makefile level; by using gawk, you can call:
exit 42
Regards,
Yann E. MORIN.
> + }
> + }
> + } while (file_cur)
> +}
> --
> 2.43.0
>
> _______________________________________________
> buildroot mailing list
> buildroot@buildroot.org
> https://lists.buildroot.org/mailman/listinfo/buildroot
--
.-----------------.--------------------.------------------.--------------------.
| Yann E. MORIN | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software Designer | \ / CAMPAIGN | ___ |
| +33 561 099 427 `------------.-------: X AGAINST | \e/ There is no |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL | v conspiracy. |
'------------------------------^-------^------------------^--------------------'
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot
next prev parent reply other threads:[~2024-02-06 15:08 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-02-06 14:40 [Buildroot] [RFC PATCH] docs/website: Add Makefile to pre-generate the website Ismael Luceno
2024-02-06 15:08 ` Yann E. MORIN [this message]
2024-02-06 15:21 ` Ismael Luceno
2024-02-06 16:30 ` Yann E. MORIN
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=ZcJLd7drFQn9tz6I@landeda \
--to=yann.morin.1998@free.fr \
--cc=buildroot@buildroot.org \
--cc=ismael@iodev.co.uk \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.