commit cb7d4694d756a65f95d2815fdd2c6942176d06bc
parent c6b05e8e91289da3095ae4d375b56a176d55f747
Author: Vincent Forest <vincent.forest@meso-star.com>
Date: Fri, 18 Feb 2022 15:52:04 +0100
Add the configure_targets.sh script and use it in solstice
This script is used to generate man/signature/check targets for a
Makefile.
Diffstat:
2 files changed, 72 insertions(+), 26 deletions(-)
diff --git a/configure_targets.sh b/configure_targets.sh
@@ -0,0 +1,62 @@
+#!/bin/sh -e
+
+# Copyright (C) 2017-2022 |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/>.
+
+sig()
+{
+ for i in "$@"; do
+ printf "%s.sig: %s\n" "${i}" "${i}"
+ printf "\t@echo Signing %s\n" "${i}"
+ printf "\t@gpg --yes -a -o %s.sig --detach-sign %s\n" "${i}" "${i}"
+ done
+}
+
+chk()
+{
+ dir=$(dirname "$0")
+ for i in "$@"; do
+ printf "%s.chk: %s %s/check_html.sh\n" "${i}" "${i}" "${dir}"
+ printf "\t@echo Checking %s\n" "${i}"
+ printf "\t@PATH+=:%s sh check_html.sh %s\n" "${dir}" "${i}"
+ done
+}
+
+man()
+{
+ if [ $# -lt 2 ]; then
+ printf "Usage: %s <section> <version> [man...]" "$0" >&2
+ exit 1
+ fi
+
+ section=$1
+ version=$2
+ dir=$(dirname "$0")
+
+ shift 2
+ for i in "$@"; do \
+ man=${i#*share/}.html
+ printf "man: %s\n" "${man}"
+ printf "%s: %s %s/meso-menu.sh %s/convert_man.sh\n" \
+ "${man}" "${i}" "${dir}" "${dir}"
+ printf "\t@echo \"Building %s\"\n" "${man}"
+ printf "\t@mkdir -p %s\n" "${man%/*}"
+ printf "\t@PATH+=:%s sh convert_man.sh %s %s %s %s\n" \
+ "${dir}" "${section}" "${i}" "${man}" "${version}"
+ done
+}
+
+"$@"
+
diff --git a/solstice/Makefile b/solstice/Makefile
@@ -162,30 +162,14 @@ check_shells:
################################################################################
# Miscellaneous targets
################################################################################
-.sigs: Makefile
- @echo "Setup .sigs"
- @{ for i in $(SOLSTICE_PKG) $(SOLPP_PKG); do \
- printf "%s.sig: %s\n" $${i} $${i}; \
- printf "\t@echo \"Signing $${i}\"\n"; \
- printf "\t@gpg --yes -a -o %s.sig --detach-sign %s\n" $${i} $${i}; \
- done } > .sigs
-
-.chks: Makefile
- @echo "Setup .chks"
- @{ for i in $(HTML) $(MAN); do \
- printf "%s.chk: %s\n" $${i} $${ceipage}; \
- printf "\t@echo Checking %s\n" $${i}; \
- printf "\t@PATH+=:../ sh check_html.sh %s\n" $${i}; \
- done } > .chks
-
-.mans: Makefile
- @echo "Setup .mans"
- @{ for i in $(MAN); do \
- man=$${i##*share/}.html; \
- printf "man: %s\n" $${man}; \
- printf "%s: %s\n" $${man} $${i}; \
- printf "\t@echo \"Building $${man}\"\n"; \
- printf "\t@mkdir -p $${man%/*}\n"; \
- printf "\t@PATH+=:../ sh convert_man.sh Solstice $${i} $${man} $(SOLSTICE_VERSION)\n"; \
- done } > .mans
+.sig: Makefile ../configure_targets.sh
+ @echo "Setup .sig"
+ @sh ../configure_targets.sh sig $(SOLSTICE_PKG) $(SOLPP_PKG) > .sig
+.chk: Makefile ../configure_targets.sh
+ @echo "Setup .chk"
+ @sh ../configure_targets.sh chk $(HTML) > .chk
+
+.man: Makefile ../configure_targets.sh
+ @echo "Setup .man"
+ @sh ../configure_targets.sh man Solstice $(SOLSTICE_VERSION) $(MAN) > .man