docs/website: Add Makefile to pre-generate the website
RFC PATCH v3 1/1 docs/website: Add Makefile to pre-generate the website
Supports the current includes plus smu [0] lightweight markup.
[0] https://github.com/Gottox/smu
Signed-off-by Ismael Luceno <[email protected]>
---
Notes:
Changes since v2:
- Integrate with toplevel makefile
- Use parethesis instead of curly braces for variables
- Removed smu rule
- Copy resources to output directory too
- Filter-out footer.html & header.html
Makefile | 8 ++++++-- docs/website/incfile.awk | 30 ++++++++++++++++++++++++++++++ docs/website/website.mk | 31 +++++++++++++++++++++++++++++++ 3 files changed, 67 insertions(+), 2 deletions(-) create mode 100644 docs/website/incfile.awk create mode 100644 docs/website/website.mk
Makefile +6 -2
@@ -123,7 +123,8 @@ endif noconfig_targets := menuconfig nconfig gconfig xconfig config oldconfig randconfig \ defconfig %_defconfig allyesconfig allnoconfig alldefconfig syncconfig release \ randpackageconfig allyespackageconfig allnopackageconfig \ - print-version olddefconfig distclean manual manual-% check-package + print-version olddefconfig distclean manual manual-% check-package \ + website # Some global targets do not trigger a build, but are used to collect # metadata, or do various checks. When such targets are triggered,
@@ -1180,6 +1181,7 @@ help: @echo ' graph-depends - generate graph of the dependency tree' @echo ' graph-size - generate stats of the filesystem size' @echo ' list-defconfigs - list all defconfigs (pre-configured minimal systems)' + @echo ' website - build website' @echo @echo 'Miscellaneous:' @echo ' source - download all sources needed for offline-build'
@@ -1234,7 +1236,7 @@ release: OUT = buildroot-$(BR2_VERSION) # documentation to the git output release: git archive --format=tar --prefix=$(OUT)/ HEAD > $(OUT).tar - $(MAKE) O=$(OUT) manual-html manual-text manual-pdf + $(MAKE) O=$(OUT) manual-html manual-text manual-pdf website $(MAKE) O=$(OUT) distclean tar rf $(OUT).tar $(OUT) gzip -9 -c < $(OUT).tar > $(OUT).tar.gz
@@ -1253,6 +1255,8 @@ check-package: $(Q)./utils/check-package --failed-only `git ls-tree -r --name-only HEAD` \ > .checkpackageignore +include docs/website/website.mk + include docs/manual/manual.mk -include $(foreach dir,$(BR2_EXTERNAL_DIRS),$(sort $(wildcard $(dir)/docs/*/*.mk)))
docs/website/incfile.awk new file +30 -0
@@ -0,0 +1,30 @@ +BEGIN { + FS="\"" +} + +FNR == 1 { + curdir = FILENAME + sub(/[^/]*$/, "", curdir) + if (curdir !~ /[/]$/) + curdir = curdir "/" +} + +{ + do { + if (match($0, /^<!--#include file="([^"]*)" *-->$/)) { + file_stack[++file_cur] = curdir $2 + } else { + print + } + if (file_cur > 0) { + 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" + } + } + } while (file_cur > 0) +}
docs/website/website.mk new file +31 -0
@@ -0,0 +1,31 @@ +################################################################################ +# +# The Buildroot website +# +################################################################################ + +AWK ?= mawk + +website-dir = $(TOPDIR)/docs/website +website-src = $(wildcard $(website-dir)/*.html) +website-gen = $(filter-out %/header.html %/footer.html,\ + $(website-src:$(website-dir)/%=$(O)/website/%)) +website-res = $(patsubst $(website-dir)/%,$(O)/website/%,$(wildcard \ + $(website-dir)/js/*.js \ + $(website-dir)/css/*.css \ + $(website-dir)/fonts/* \ + $(website-dir)/images/* \ +)) + +website: $(website-gen) $(website-res) + +$(website-res): $(O)/website/%: $(website-dir)/% + install -m644 -D $< $@ + +website-dep = $(website-dir)/website.mk $(website-dir)/incfile.awk + +$(O)/website/%.html: $(website-dir)/%.html $(website-dep) + mkdir -p "$(@D)" + tmpfile=$$(mktemp) && \ + $(AWK) -f $(website-dir)/incfile.awk $< > "$$tmpfile" && \ + mv "$$tmpfile" $@
Signature · 6 lines
2.43.0 _______________________________________________ buildroot mailing list [email protected] https://lists.buildroot.org/mailman/listinfo/buildroot
Ignore the commit message, it only supports the server-side includes now.
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot