commit 95b47532bc1698cdd0da2b1440bc683d5510dedf
parent aaba8a4f078691aac0efa69d17a13364e99248cd
Author: Vincent Forest <vincent.forest@meso-star.com>
Date: Tue, 22 Feb 2022 11:27:12 +0100
misc: full rewrite of the build process
Use POSIX shell/make
Diffstat:
7 files changed, 116 insertions(+), 21 deletions(-)
diff --git a/.gitignore b/.gitignore
@@ -6,11 +6,6 @@ kdistribution.html
ppart_lw.html
ppart_sw.html
kspectrum.html
-about-en.html
-about-fr.html
-legal-en.html
-legal-fr.html
-pgp_signatures.html
starter-pack.html
star-engine.html
star-engine-downloads.html
diff --git a/meso-menu.sh b/meso-menu.sh
@@ -53,7 +53,7 @@ print_home_sub_menu() {
if [ "${name}" = "Legal" ]; then
echo " <li id=\"cur\">Legal notices</li>"
else
- echo " <li><a href=\"${root}\"misc/legal-fr.html>Legal notices</a></li>"
+ echo " <li><a href=\"${root}misc/legal-fr.html\">Legal notices</a></li>"
fi
echo " </ul>"
echo " </div>"
diff --git a/misc/.gitignore b/misc/.gitignore
@@ -0,0 +1,5 @@
+about-en.html
+about-fr.html
+legal-en.html
+legal-fr.html
+pgp_signatures.html
diff --git a/misc/Makefile b/misc/Makefile
@@ -12,18 +12,68 @@
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
+.POSIX:
-SRC = pgp_signatures.html.in about-en.html.in about-fr.html.in legal-en.html.in legal-fr.html.in
+HTML=\
+ about-en.html\
+ about-fr.html\
+ legal-en.html\
+ legal-fr.html\
+ pgp_signatures.html
-.PHONY: all clean default publish
-default: all
+build: $(HTML)
-all: ${SRC}
- @bash misc.sh
+clean:
+ rm -f\
+ about-en.html\
+ about-fr.html\
+ legal-en.html\
+ legal-fr.html\
+ pgp_signatures.html\
+ $(HTML:=.err)
-publish:
- rsync -avz about.html about-fr.html about-en.html legal-fr.html legal-en.html pgp_signatures.html ${REMOTE}/misc/
+distclean: clean
-clean:
- rm -rf about-en.html about-fr.html legal-en.html legal-fr.html pgp_signatures.html
+publish: build
+ rsync -avzrR --delete-after $(HTML) $(REMOTE)/misc/
+
+misc_build.sh: ../meso-menu.sh
+ @touch misc_build
+
+################################################################################
+# html
+################################################################################
+about-en.html: about-en.html.in misc_build.sh
+ @echo "Building $@"
+ @sh misc_build.sh about en > $@
+
+about-fr.html: about-fr.html.in misc_build.sh
+ @echo "Building $@"
+ @sh misc_build.sh about fr > $@
+
+legal-en.html: legal-en.html.in misc_build.sh
+ @echo "Building $@"
+ @sh misc_build.sh legal en > $@
+
+legal-fr.html: legal-fr.html.in misc_build.sh
+ @echo "Building $@"
+ @sh misc_build.sh legal fr > $@
+
+pgp_signatures.html: misc_build.sh
+ @echo "Building $@"
+ @sh misc_build.sh pgp > $@
+
+################################################################################
+# Check files
+################################################################################
+check: build .chk
+ @$(MAKE) -fMakefile -f .chk check_all
+
+check_all: check_shells $(HTML:=.chk)
+
+check_shells:
+ @echo "Checking misc_build.sh" && shellcheck -o all -x misc_build.sh
+.chk: Makefile ../configure_targets.sh
+ @echo "Setup .chk"
+ @sh ../configure_targets.sh chk $(HTML) > .chk
diff --git a/misc/about-en.html.in b/misc/about-en.html.in
@@ -3,9 +3,6 @@
/ <a href=about-fr.html>Français</a>
</div>
-<header>
-</header>
-
<div id=title>
<h1>|Méso|Star></h1>
<div style="font-size: 10pt">Understanding complex systems</div>
diff --git a/misc/about-fr.html.in b/misc/about-fr.html.in
@@ -3,9 +3,6 @@
/ <span style="color: #f44d27;">Français</span>
</div>
-<header>
-</header>
-
<div id=title>
<h1>|Méso|Star></h1>
<div style="font-size: 10pt">Understanding complex systems</div>
diff --git a/misc/misc_build.sh b/misc/misc_build.sh
@@ -0,0 +1,51 @@
+#!/bin/sh -e
+
+# Copyright (C) 2019-2021 |Meso|Star> (contact@meso-star.com)
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+. ../meso-menu.sh
+
+about()
+{
+ if [ $# -lt 1 ]; then
+ printf "Usage: %s about <fr|en>\n" "$0" >&2
+ exit 1
+ fi
+
+ print_header Home About "$1"
+ cat "about-$1.html.in"
+ print_footer
+}
+
+legal()
+{
+ if [ $# -lt 1 ]; then
+ printf "Usage: %s lang <fr|en>\n" "$0" >&2
+ exit 1
+ fi
+
+ print_header Home Legal "$1"
+ cat "legal-$1.html.in"
+ print_footer
+}
+
+pgp()
+{
+ print_header Home PGP
+ cat pgp_signatures.html.in
+ print_footer
+}
+
+"$@"