make: Miscellaneous versatility improvements #83

Merged
Jan Lindemann merged 5 commits from jan/feature/20260905-make-miscellaneous-versatility-improvements into master 2026-09-05 13:49:10 +02:00 AGit

2026-09-05

py-mod.mk: Add TypeAlias to PY_SED_EXTRACT_EXPORT_DEF
All checks were successful
CI / Packaging - Kali Linux (pull_request) Successful in 4m34s
CI / Packaging - OpenSUSE Tumbleweed (pull_request) Successful in 4m41s
CI / Packaging test (pull_request) Successful in 0s
CI / Packaging - Kali Linux (push) Successful in 4m0s
CI / Packaging - OpenSUSE Tumbleweed (push) Successful in 4m23s
CI / Packaging test (push) Successful in 0s
Automatically include symbols of the form

  MySymbol: TypeAlias = Something  # export

in generated __init__.py.

Signed-off-by: Jan Lindemann <jan@janware.com>
2026-09-05 13:39:51 +02:00
py-ns-dir.mk: Support __init__.py generation
For in-tree tests, the jw package is split across several projects, and
each directory containing a py-ns-dir.mk contributes its subtree. So far,
it's up to that directory how the contribution is handled. Usually an
__init__.py with pkgutil.extend_path() is present in version control to
glue these parts together. This commit makes py-ns-dir.mk handle the
contribution method centrally by default unless PY_UPDATE_INIT_PY is set to
false.

As of this commit, this is the case by default, i.e. PY_UPDATE_INIT_PY is
set to false in py-ns-dir.mk, maintaining the current behaviour.

Downstream projects or modules can decide to have __init__.py centrally
maintained. For this, they need to remove __init__.py from version control
and set PY_UPDATE_INIT_PY to true in the respective Makefile.

PY_UPDATE_INIT_PY = false is also set explicitly in src/python/jw/Makefile,
because that file should never be generated. Bootstrapping the entire
workspace hinges on it.

Pending better testing, most notably of consistent in-tree testing
functionality, PY_UPDATE_INIT_PY = true might become a global default in
the future.

Signed-off-by: Jan Lindemann <jan@janware.com>
2026-09-05 13:39:51 +02:00
pgit.sh: Allow running under any projects-dir.mk
There's a random string "some-random-string-to-id-this-makefile" in
projects-dir-minimial.mk intended to check if the Makefile in the
projects-directory is actually the final link target. It's re-used in
pgit.sh to find the projects toplevel directory, but since it doesn't need
to be an actual projects-dir-minimal.mk copy, another case should also be
taken into consideration: Check if projects-dir.mk is included.

Signed-off-by: Jan Lindemann <jan@janware.com>
2026-09-05 13:39:51 +02:00
projects-dir.mk: Renovate build-order targets
Renovate the build-order and build-order-% targets as follows:

- Add BUILD_ORDER_DEP_FLAVOURS and default to all currently supported
  build flavours: run,build,test,release. This adds convenience for
  packages declaring differentiated types of dependencies, not only the
  default build dependency, but still want any project it uses somehow
  be be built before them.

- Don't print the recipe's command when running "make build-order", it
  gets in the way if the caller wants to parse the result, so spare him
  filtering it.

- Only log messages with priority warning or higher. Messages go to stderr
  anyway to keep them from throwing wrenches into consuming parsers, but
  they are likely confusingly visible without context if they leak to the
  calling program's console.

Signed-off-by: Jan Lindemann <jan@janware.com>
2026-09-05 13:39:51 +02:00
defs-dirs.mk: Filter out non-existing ordered subdirs
SUBDIRS combines $(ORDERED_SUBDIRS) with the subdirectories found on disk.
An $(ORDERED_SUBDIRS) entry that does not exist in the tree is still passed
to the recursive make loop, which then errors out over the missing
directory.

Filter the ordered subdirectories through the wildcard of their Makefile
paths, keeping only the ones that are actually there.

Signed-off-by: Jan Lindemann <jan@janware.com>
2026-09-05 13:39:51 +02:00