Update of Makefiles and submodules

This commit is contained in:
Dirk Alders 2025-08-06 20:02:29 +02:00
parent a17187b68d
commit 05ed33f75e
7 changed files with 138 additions and 34 deletions

100
Makefile
View File

@ -1,13 +1,95 @@
MODULE_NAME := $(shell basename `pwd`)
# git helper Makefile: Version 1.7 (2025-08-05)
default: help
view_unittest:
xdg-open pylibs/$(MODULE_NAME)/_testresults_/unittest.pdf
.ONESHELL:
SHELL = /usr/bin/bash
.SILENT:
view_requirements:
xdg-open pylibs/$(MODULE_NAME)/_requirements_/specification.pdf
-include __make.d__/*.mk
view_docs:
xdg-open pylibs/$(MODULE_NAME)/_docs_/index.html
GIT_FLAG = ./.git
VENV_FLAG = ./.venv_required
VENV_FOLDER = ./venv
localhelp:
help:
echo "Possible common options are:"
echo " - init - Initialise the repository and all folders below with a Makefile"
echo " - giti - Get the git status of all submodules including their submodules"
echo " - update_submodules - Set all submodules to remote master"
echo " - venv_flag - Set the venev flag for the base folder. A venv will be generated"
echo " - clean - clean up"
echo " - deepclean - clean up this and all Makefiles below"
$(MAKE) localhelp
echo "You are able to create files make.d/*.mk and add local rules there. "
echo " - localinit: print_head - Will be executed as last step in the init process."
echo " - localhelp: print_head - Will be executed in th middle of the help text generation"
echo " - localclean:print_head - Will be executed before the clean rule"
localinit:
init: print_head
# Init git repo
if [[ -e $(GIT_FLAG) ]]; then
git submodule init
git submodule update
fi
# Init submodules
for subdir in $$(find . -maxdepth 2 -mindepth 2 -name Makefile | sort); do
$(MAKE) --no-print-directory -C $$(dirname $$subdir) init
done
# Create venv if needed
if [[ -e $(VENV_FLAG) ]]; then
if [[ ! -e $(VENV_FOLDER) ]]; then
mkvenv
fi
fi
# Start local init
$(MAKE) localinit
update_submodules:
git submodule foreach "git fetch && git checkout master && git pull && git submodule init && git submodule update"
giti_this: print_head
giti
echo " Submodules:"
git submodule --quiet foreach "echo -n ' ' && giti"
giti:
git submodule --quiet foreach [ -e Makefile ] || make --no-print-directory giti_this
localclean:
clean: localclean
if [[ ! -e $(VENV_FLAG) ]]; then
if [[ -d $(VENV_FOLDER) ]]; then
rm -rf $(VENV_FOLDER)
fi
fi
cleanall: clean
for subdir in $$(find . -maxdepth 2 -mindepth 2 -name Makefile | sort); do
$(MAKE) --no-print-directory -C $$(dirname $$subdir) cleanall
done
venv_flag:
if [[ ! -e $(VENV_FLAG) ]]; then
touch $(VENV_FLAG)
if [[ -e $(GIT_FLAG) ]]; then
git add $(VENV_FLAG)
fi
fi
print_head:
DIRNAME=$$(basename $$(pwd))
DIRLENGTH=$${#DIRNAME}
echo -ne "\n\n\033[1;34m╔═"
for i in $$(seq 1 $$DIRLENGTH); do echo -n "═"; done
echo -e "═╗"
echo -e "$$DIRNAME ║"
echo -ne "╚═"
for i in $$(seq 1 $$DIRLENGTH); do echo -n "═"; done
echo -e "═╝\033[00m"
clean:
make -kC docs clean; make -kC requirements cleanall; make -kC unittest clean

20
__make.d__/localclean.mk Normal file
View File

@ -0,0 +1,20 @@
.ONESHELL:
SHELL = /usr/bin/bash
.SILENT:
localclean:
echo -e "\033[1;33mCleaning docs, requirements, unittest...\033[00m"
if [[ -e docs/Makefile ]]; then
make -kC docs clean 2> /dev/null
fi
if [[ -e requirements/Makefile ]]; then
make -kC requirements cleanall 2> /dev/null
fi
if [[ -e unittest/Makefile ]]; then
make -kC unittest clean 2> /dev/null
fi
echo -e "\033[1;33mRemoving backup files...\033[00m"
find . -name "*~" -type f |xargs rm -vf
echo -e "\033[1;33mRemoving __pycache__...\033[00m"
find . -name "__pycache__" -type d |xargs rm -rf

View File

@ -1,38 +1,40 @@
# Minimal makefile for Sphinx documentation
#
# You can set these variables from the command line.
MAKEFLAGS += --no-print-directory
.ONESHELL:
SHELL = /usr/bin/bash
.SILENT:
SPHINXOPTS =
SPHINXBUILD = sphinx-build
SPHINXBUILD = venv/bin/sphinx-build
SPHINXPRJ = $(shell basename `dirname \`pwd\``)
SOURCEDIR = .
BUILDDIR = _build
# Put it first so that "make" without argument is like "make help".
help:
@$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
.PHONY: help Makefile
html: venv $(SPHINXPRJ)
$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
# Catch-all target: route all unknown targets to Sphinx using the new
# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
%: $(SPHINXPRJ)
@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
$(SPHINXPRJ):
make --no-print-directory -C $@/_examples_ all
$(SPHINXPRJ): Makefile
make -C $@/_examples_ all
init: venv
venv:
echo -e "\033[1;33mCreating venv...\033[00m"
if [[ ! -e venv ]]; then
virtualenv -p /usr/bin/python3 venv
fi
venv/bin/pip install --upgrade pip
venv/bin/pip install -r requirements.txt
clean:
@echo "\033[1;33mCleanung up docs...\033[00m"
@echo "\e[1m * Sphix build directory...\e[0m"
@rm -rf $(BUILDDIR)/*
@make -kC $(SPHINXPRJ)/_examples_ clean
echo -e "\033[1;33mCleanung up docs...\033[00m"
echo -e "\e[1m * Sphix build directory...\e[0m"
rm -rf $(BUILDDIR)/*
make --no-print-directory -kC $(SPHINXPRJ)/_examples_ clean
release: html
rm -rf $(SPHINXPRJ)/_docs_
mv $(BUILDDIR)/html $(SPHINXPRJ)/_docs_
view_html: html
xdg-open $(BUILDDIR)/html/index.html
view: html
xdg-open $(BUILDDIR)/html/index.html

@ -1 +1 @@
Subproject commit cf7250c05c99ba0698b3a960e7b8a445b9dad649
Subproject commit 14e56ccdbf6594f699b4afcfb4acafe9b899e914

@ -1 +1 @@
Subproject commit 74e6f20d09cf76b3fbbdfa04c192b01708e50d5d
Subproject commit 5995368f07f7f680136860af55510dbb61e7503b

@ -1 +1 @@
Subproject commit 1a941be7e01af8ba468c829933eb4f3db7b04330
Subproject commit e3a40be1d000cdce2f8c0578ac65423b650b1c75

@ -1 +1 @@
Subproject commit bc0672bec78e821a59ce63ccd4dfa69f95196a48
Subproject commit 631e7c60bfb822a7a50f63855633aa24436353ce