From patchwork Tue Feb 6 16:25:53 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ismael Luceno X-Patchwork-Id: 1895831 Return-Path: X-Original-To: incoming-buildroot@patchwork.ozlabs.org Delivered-To: patchwork-incoming-buildroot@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=buildroot.org (client-ip=2605:bc80:3010::136; helo=smtp3.osuosl.org; envelope-from=buildroot-bounces@buildroot.org; receiver=patchwork.ozlabs.org) Received: from smtp3.osuosl.org (smtp3.osuosl.org [IPv6:2605:bc80:3010::136]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4TTpXN75C5z23g2 for ; Wed, 7 Feb 2024 03:26:12 +1100 (AEDT) Received: from localhost (localhost [127.0.0.1]) by smtp3.osuosl.org (Postfix) with ESMTP id 0067461292; Tue, 6 Feb 2024 16:26:11 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp3.osuosl.org 0067461292 X-Virus-Scanned: amavisd-new at osuosl.org Received: from smtp3.osuosl.org ([127.0.0.1]) by localhost (smtp3.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id R8F464Q_hfMj; Tue, 6 Feb 2024 16:26:10 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by smtp3.osuosl.org (Postfix) with ESMTP id 4256661299; Tue, 6 Feb 2024 16:26:09 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp3.osuosl.org 4256661299 X-Original-To: buildroot@lists.busybox.net Delivered-To: buildroot@osuosl.org Received: from smtp3.osuosl.org (smtp3.osuosl.org [140.211.166.136]) by ash.osuosl.org (Postfix) with ESMTP id 36FB71BF311 for ; Tue, 6 Feb 2024 16:26:07 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp3.osuosl.org (Postfix) with ESMTP id 1CAEE6113F for ; Tue, 6 Feb 2024 16:26:07 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp3.osuosl.org 1CAEE6113F X-Virus-Scanned: amavisd-new at osuosl.org Received: from smtp3.osuosl.org ([127.0.0.1]) by localhost (smtp3.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id MysdaIj4E71E for ; Tue, 6 Feb 2024 16:26:05 +0000 (UTC) Received: from iodev.co.uk (iodev.co.uk [46.30.189.100]) by smtp3.osuosl.org (Postfix) with ESMTP id EC384612B4 for ; Tue, 6 Feb 2024 16:26:04 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp3.osuosl.org EC384612B4 Received: from localhost (unknown [85.119.216.19]) by iodev.co.uk (Postfix) with ESMTPSA id 34847290A81; Tue, 6 Feb 2024 17:25:57 +0100 (CET) From: Ismael Luceno To: buildroot@buildroot.org Date: Tue, 6 Feb 2024 17:25:53 +0100 Message-ID: <20240206162555.31657-1-ismael@iodev.co.uk> X-Mailer: git-send-email 2.43.0 MIME-Version: 1.0 X-Spam: Yes Subject: [Buildroot] [RFC PATCH v3] docs/website: Add Makefile to pre-generate the website X-BeenThere: buildroot@buildroot.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Discussion and development of buildroot List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Ismael Luceno Errors-To: buildroot-bounces@buildroot.org Sender: "buildroot" Supports the current includes plus smu [0] lightweight markup. [0] https://github.com/Gottox/smu Signed-off-by: Ismael Luceno --- 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 diff --git a/Makefile b/Makefile index ac625152c678..cd56bc268917 100644 --- a/Makefile +++ b/Makefile @@ -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))) diff --git a/docs/website/incfile.awk b/docs/website/incfile.awk new file mode 100644 index 000000000000..e8ae571de271 --- /dev/null +++ b/docs/website/incfile.awk @@ -0,0 +1,30 @@ +BEGIN { + FS="\"" +} + +FNR == 1 { + curdir = FILENAME + sub(/[^/]*$/, "", curdir) + if (curdir !~ /[/]$/) + curdir = curdir "/" +} + +{ + do { + if (match($0, /^$/)) { + 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) +} diff --git a/docs/website/website.mk b/docs/website/website.mk new file mode 100644 index 000000000000..d3f7b28aaa07 --- /dev/null +++ b/docs/website/website.mk @@ -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" $@