From 3833fb09882fff16adcc09b8917f37ecd3399d77 Mon Sep 17 00:00:00 2001 From: Jan Lindemann Date: Wed, 17 Jun 2026 11:35:10 +0200 Subject: [PATCH 1/6] cache-projects.mk: Remove unused ifndef / endif make/Makefile is responsible to generate $(TOPDIR)/cache-projects.mk. The variables are taken from .cache-project.mk, with some variables intentionally omitted, but their ifndef / endif blocks remain in place. Not harmful but ugly. Make sed range-delete the left-over blocks entirely. Signed-off-by: Jan Lindemann --- make/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/make/Makefile b/make/Makefile index b0e0de9b..913d9978 100644 --- a/make/Makefile +++ b/make/Makefile @@ -27,5 +27,5 @@ cache-projects: $(CACHE_PROJECTS_MK) clean-cache-projects: rm -f $(CACHE_PROJECTS_MK) $(CACHE_PROJECTS_MK): $(CACHE_PROJECT_MK) - sed '/\($(subst $(space),\|,$(CACHED_VARS_ONLY_PROJECT))\)\s*[:?]\?=/ d' $< > $@.tmp + sed -E '/^[[:blank:]]*ifndef[[:blank:]]+($(subst $(space),|,$(CACHED_VARS_ONLY_PROJECT)))[[:blank:]]*$$/,/^[[:blank:]]*endif[[:blank:]]*$$/d' $< > $@.tmp mv $@.tmp $@ -- 2.54.0 From 8712cbc7b5254dcd2323bb3fc39bab2df4b9b41b Mon Sep 17 00:00:00 2001 From: Jan Lindemann Date: Wed, 17 Jun 2026 14:10:12 +0200 Subject: [PATCH 2/6] cache.mk: Support JW_PKG_NO_CACHE cache.mk generates .project-cache.mk, and this commit supports disabling the definitions in the generated cache by setting JW_PKG_NO_CACHE=true. Signed-off-by: Jan Lindemann --- make/cache.mk | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/make/cache.mk b/make/cache.mk index 0c049057..53a28246 100644 --- a/make/cache.mk +++ b/make/cache.mk @@ -20,11 +20,13 @@ clean-cache: cache: $(CACHE_PROJECT_MK) $(CACHE_PROJECT_MK): $(CACHED_FILES) $(JWBDIR)/make/cache.mk + @echo 'ifneq ($$(JW_PKG_NO_CACHE),true)' | tee $@.tmp @echo $(foreach v,$(CACHED_VARS),$v = $(value $(v)) EOL) | \ $(SED) 's/\s\+EOL/\n/g;' | \ $(SED) 's/\s*\(\S\+\)\s*=\s*\(.*\)\s*/ifndef \1\n \1 = \2\nendif\n/g;' | \ $(SED) 's|$(realpath $(TOPDIR))|$$(TOPDIR)|g' | \ $(SED) 's|$(realpath $(PROJECTS_DIR))|$$(PROJECTS_DIR)|g' | \ $(GREP) . | \ - tee $@.tmp + tee -a $@.tmp + @echo 'endif # ifneq ($$(JW_PKG_NO_CACHE),true)' | tee -a $@.tmp mv $@.tmp $@ -- 2.54.0 From 10bde0c05da7e2d742055b84b84aafd7cbd506ab Mon Sep 17 00:00:00 2001 From: Jan Lindemann Date: Wed, 17 Jun 2026 14:08:58 +0200 Subject: [PATCH 3/6] topdir.mk: Move PREREQ definition into defs.mk At present, the PREREQ-variable is effectively only used to detect if prerequiste packages haven't run "make all" before make is run in a given package. Also, it's only useful in $(TOPDIR). This commit splits the variable up into PREREQ_BUILD and PREREQ_RUN, and makes the variables available in every Makefile of a package by placing them in defs.mk instead of topdir.mk. This also fixes a problem that PREREQ was cached before being filled, hence empty. Which effectively wasn't much of a problem, because it was basically unused, but still. Signed-off-by: Jan Lindemann --- make/cache.mk | 2 ++ make/defs.mk | 12 ++++++++++++ make/make.mk | 4 ++-- make/topdir.mk | 11 +++-------- 4 files changed, 19 insertions(+), 10 deletions(-) diff --git a/make/cache.mk b/make/cache.mk index 53a28246..4c945942 100644 --- a/make/cache.mk +++ b/make/cache.mk @@ -6,6 +6,8 @@ CACHE_PROJECT_MK ?= .cache-project.mk CACHED_VARS_ONLY_PROJECT ?= \ PROJECT \ + PREREQ_BUILD \ + PREREQ_RUN \ PREREQ \ VERSION \ HEX_VERSION \ diff --git a/make/defs.mk b/make/defs.mk index f8beacec..0533ae55 100644 --- a/make/defs.mk +++ b/make/defs.mk @@ -503,6 +503,18 @@ endif INSTALL_FILE ?= $(INSTALL) INSTALL_DIR ?= $(INSTALL) +ifeq ($(origin PREREQ_BUILD),undefined) + PREREQ_BUILD := $(call proj_query, pkg-requires --no-subpackages --subsections=jw --syntax names-only --delimiter ' ' 'build devel' $(PROJECT)) +endif + +ifeq ($(origin PREREQ_RUN),undefined) + PREREQ_RUN := $(call proj_query, pkg-requires --no-subpackages --subsections=jw --syntax names-only --delimiter ' ' 'run' $(PROJECT)) +endif + +ifeq ($(origin PREREQ),undefined) + PREREQ := $(sort $(PREREQ_BUILD) $(PREREQ_RUN)) +endif + # ----- local.mk $(eval $(call try_include,$(JWBDIR)/make/local.mk)) diff --git a/make/make.mk b/make/make.mk index 373858b7..d71e0a23 100644 --- a/make/make.mk +++ b/make/make.mk @@ -9,8 +9,8 @@ include $(JWBDIR)/make/defs-dirs.mk include $(JWBDIR)/make/dev-utils.mk CACHED_FILES ?= $(VERSION_FILE) $(wildcard $(TOPDIR)/make/project.conf) -CACHED_VARS ?= PROJECT PREREQ VERSION HEX_VERSION FULL_NAME \ - WHICH PYTHON ECHO TEST BROWSER SED RM PWD ID CUT TR \ +CACHED_VARS ?= PROJECT PREREQ_BUILD PREREQ_RUN PREREQ VERSION HEX_VERSION \ + FULL_NAME WHICH PYTHON ECHO TEST BROWSER SED RM PWD ID CUT TR \ AWK GETENT XARGS FIND PRINTF PLATFORM_INFO OS_NAME_VERSION \ CAT BIN_INSTALL SUDO \ JW_PKG_LD_LIBRARY_PATH JW_PKG_EXE_PATH JW_PKG_PYTHON_PATH diff --git a/make/topdir.mk b/make/topdir.mk index b8957248..a4a4dd7f 100644 --- a/make/topdir.mk +++ b/make/topdir.mk @@ -80,23 +80,18 @@ REMOTE_GIT_DIR = /$(JANWARE_USER)/$(REMOTE_GIT_FLAVOUR)/$(PROJECT) REMOTE_GIT_URL = ssh://$(JANWARE_USER_PREFIX)devgit.janware.com$(REMOTE_GIT_DIR) ifneq ($(DONT_CHECK_PREREQ_DONE),true) - ifndef PREREQ - PREREQ := $(call proj_query,pkg-requires --no-subpackages --subsections=jw --syntax names-only --delimiter=' ' build $(PROJECT)) + ifndef PREREQ_DIRS_BUILD + PREREQ_DIRS_BUILD := $(call proj_query,proj-dir $(PREREQ_BUILD)) endif - ifndef PREREQ_DIRS - PREREQ_DIRS := $(call proj_query,proj-dir $(PREREQ)) - endif - PREREQ_DIRS_DONE := $(addsuffix /dirs-all.done,$(filter-out $(TOPDIR) /opt/%,$(PREREQ_DIRS))) + PREREQ_DIRS_BUILD_DONE := $(addsuffix /dirs-all.done,$(filter-out $(TOPDIR) /opt/%,$(PREREQ_DIRS_BUILD))) endif ifneq ($(SUBDIRS_TO_ITERATE),) - ifeq ($(MAKECMDGOALS),) SUBDIR_TARGETS = all else SUBDIR_TARGETS = $(filter $(ALLOWED_SUBDIR_TARGETS),$(MAKECMDGOALS)) endif - endif all: topdir config -- 2.54.0 From 37d5bcddd4e086f8fc7841ed6d89b8342a3eb6ce Mon Sep 17 00:00:00 2001 From: Jan Lindemann Date: Wed, 17 Jun 2026 13:34:53 +0200 Subject: [PATCH 4/6] cmds.projects.BaseCmdPkgRelations: Support spaces as delimiter Some options to the pkg-xxx commands, like flavour, --subsections and --ignore understand a comma as delimiter if multiple option values are specified. The comma character is not very friendly to use in $(call ...) macros, though, so support spaces and pipe characters as well. Signed-off-by: Jan Lindemann --- .../pkg/cmds/projects/BaseCmdPkgRelations.py | 20 +++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/src/python/jw/pkg/cmds/projects/BaseCmdPkgRelations.py b/src/python/jw/pkg/cmds/projects/BaseCmdPkgRelations.py index 433f76d1..42dc977e 100644 --- a/src/python/jw/pkg/cmds/projects/BaseCmdPkgRelations.py +++ b/src/python/jw/pkg/cmds/projects/BaseCmdPkgRelations.py @@ -1,5 +1,7 @@ from __future__ import annotations +import re + from typing import TYPE_CHECKING from .Cmd import Cmd, Parent @@ -11,23 +13,27 @@ if TYPE_CHECKING: class BaseCmdPkgRelations(Cmd): + arg_sep = r'[,\s|]' + def pkg_relations(self, rel_type: str, args: Namespace) -> str: return args.delimiter.join( pkg_relations_list( self.app, rel_type = rel_type, - flavours = args.flavours.split(','), + flavours = re.split(self.arg_sep, args.flavours), seed_pkgs = args.modules, - subsections = None - if args.subsections is None else args.subsections.split(','), + subsections = ( + None if args.subsections is None else + re.split(self.arg_sep, args.subsections) + ), no_subpackages = args.no_subpackages, dont_strip_revision = args.dont_strip_revision, expand_semver_revision_range = args.expand_semver_revision_range, syntax = VersionSyntax[args.syntax.replace('-', '_')], recursive = args.recursive, dont_expand_version_macros = args.dont_expand_version_macros, - ignore = set(args.ignore.split(',')), + ignore = set(re.split(self.arg_sep, args.ignore)), quote = args.quote, skip_excluded = args.skip_excluded, hide_self = args.hide_self, @@ -49,7 +55,7 @@ class BaseCmdPkgRelations(Cmd): '--subsections', nargs = '?', default = None, - help = 'Subsections to consider, comma-separated', + help = 'Subsections to consider, separated by comma or whitespace', ) parser.add_argument( '-d', @@ -59,7 +65,9 @@ class BaseCmdPkgRelations(Cmd): help = 'Output words delimiter' ) parser.add_argument( - 'flavours', help = 'Dependency flavours (run, build, devel, release)' + 'flavours', + help = 'Dependency flavours (run, build, devel, release), ' + 'separated by comma or whitespace' ) parser.add_argument('modules', nargs = '*', help = 'Modules') parser.add_argument( -- 2.54.0 From 0af41ac832c2bd11cec5a5551e3cd589dae34464 Mon Sep 17 00:00:00 2001 From: Jan Lindemann Date: Wed, 17 Jun 2026 14:28:18 +0200 Subject: [PATCH 5/6] cmds.projects.Cmd[Ldlibpath|Exepath]: Support --delimiter Support a --delimiter option to the ldlibpath and exepath commands. Notable use case are the JW_PKG_XXX_PATH variables, which should use spaces instead of colons. TODO: Merging those two command modules with BaseCmdPkgRelations would have made introducing this redundancy unnecessary, check if that's a possibility. Signed-off-by: Jan Lindemann --- src/python/jw/pkg/cmds/projects/CmdExepath.py | 9 ++++++++- src/python/jw/pkg/cmds/projects/CmdLdlibpath.py | 9 ++++++++- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/src/python/jw/pkg/cmds/projects/CmdExepath.py b/src/python/jw/pkg/cmds/projects/CmdExepath.py index 399f3340..fe03106f 100644 --- a/src/python/jw/pkg/cmds/projects/CmdExepath.py +++ b/src/python/jw/pkg/cmds/projects/CmdExepath.py @@ -14,6 +14,13 @@ class CmdExepath(Cmd): # export def add_arguments(self, parser: ArgumentParser) -> None: super().add_arguments(parser) + parser.add_argument( + '-d', + '--delimiter', + nargs = '?', + default = ':', + help = 'Output words delimiter' + ) parser.add_argument('module', nargs = '*', help = 'Modules') async def _run(self, args: Namespace) -> None: @@ -30,4 +37,4 @@ class CmdExepath(Cmd): # export path = self.app.find_dir(m, ['/bin']) if path is not None: out.append(path) - print(':'.join(out)) + print(args.delimiter.join(out)) diff --git a/src/python/jw/pkg/cmds/projects/CmdLdlibpath.py b/src/python/jw/pkg/cmds/projects/CmdLdlibpath.py index 3c2bf3fb..a72925df 100644 --- a/src/python/jw/pkg/cmds/projects/CmdLdlibpath.py +++ b/src/python/jw/pkg/cmds/projects/CmdLdlibpath.py @@ -14,6 +14,13 @@ class CmdLdlibpath(Cmd): # export def add_arguments(self, parser: ArgumentParser) -> None: super().add_arguments(parser) + parser.add_argument( + '-d', + '--delimiter', + nargs = '?', + default = ':', + help = 'Output words delimiter' + ) parser.add_argument('module', nargs = '*', help = 'Modules') async def _run(self, args: Namespace) -> None: @@ -30,4 +37,4 @@ class CmdLdlibpath(Cmd): # export path = self.app.find_dir(m, ['/lib']) if path is not None: out.append(path) - print(':'.join(out)) + print(args.delimiter.join(out)) -- 2.54.0 From 156d0738859af05a76fe87d293c2c7177dad7c2c Mon Sep 17 00:00:00 2001 From: Jan Lindemann Date: Wed, 17 Jun 2026 14:10:44 +0200 Subject: [PATCH 6/6] py-path|ldlibpath.mk: Space-separate JW_PKG_XXX_PATH The following variables contain colons as path-separators: - JW_PKG_PYTHON_PATH - JW_PKG_EXE_PATH - JW_PKG_LD_LIBRARY_PATH This commit makes them use spaces instead, so they can be more easily amended by Makefiles using them. Also define them in a more uniform way, and use the newly introduced PREREQ_RUN variable to fill them, which in turn can also be appended to before that. Signed-off-by: Jan Lindemann --- make/ldlibpath.mk | 10 +++++----- make/py-path.mk | 5 +++-- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/make/ldlibpath.mk b/make/ldlibpath.mk index f2590509..b0373d74 100644 --- a/make/ldlibpath.mk +++ b/make/ldlibpath.mk @@ -3,18 +3,18 @@ # -- LD_LIBRARY_PATH LD_LIBRARY_PATH_ENV = $(shell echo $(FINAL_LDFLAGS) | $(SED) 's/^-[^L] *[^ ]*/ /g; s/[ ]-[^L] *[^ ]*/ /g; s/-L[ ]*\([^ ]*\)[ ]*/\1:/g') ifeq ($(origin JW_PKG_LD_LIBRARY_PATH),undefined) - JW_PKG_LD_LIBRARY_PATH := $(call proj_query, ldlibpath $(PROJECT) $(PREREQ_BUILD)) + JW_PKG_LD_LIBRARY_PATH := $(call proj_query, ldlibpath --delimiter ' ' $(PROJECT) $(PREREQ_RUN)) endif -export LD_LIBRARY_PATH := $(JW_PKG_LD_LIBRARY_PATH) +export LD_LIBRARY_PATH := $(subst $(space),:,$(JW_PKG_LD_LIBRARY_PATH)):$(LD_LIBRARY_PATH_ENV) ifeq ($(TARGET),mingw) - DLL_PATH = $(shell echo $(LD_LIBRARY_PATH) | $(SED) 's/:/;/g');$(CROSS_TOOL_DIR)/bin + DLL_PATH = $(subst :,;,$(LD_LIBRARY_PATH));$(CROSS_TOOL_DIR)/bin endif # -- PATH EXE_SEARCH_PATH_ENV := $(PATH) ifeq ($(origin JW_PKG_EXE_PATH),undefined) - JW_PKG_EXE_PATH := $(call proj_query, exepath $(PROJECT) $(PREREQ_BUILD)):$(EXE_SEARCH_PATH_ENV) + JW_PKG_EXE_PATH := $(call proj_query, exepath --delimiter ' ' $(PROJECT) $(PREREQ_RUN)) endif -export PATH := $(JW_PKG_EXE_PATH) +export PATH := $(subst $(space),:,$(JW_PKG_EXE_PATH)):$(EXE_SEARCH_PATH_ENV) include $(JWBDIR)/make/py-path.mk diff --git a/make/py-path.mk b/make/py-path.mk index 0b5b2115..39c72737 100644 --- a/make/py-path.mk +++ b/make/py-path.mk @@ -1,6 +1,7 @@ # -- PYTHONPATH PYTHONPATH_ENV := $(PYTHONPATH) +JW_PKG_PYTHON_PATH_PREREQ += $(PROJECT) ifeq ($(origin JW_PKG_PYTHON_PATH),undefined) - JW_PKG_PYTHON_PATH := $(call proj_query, pythonpath $(PROJECT)) + JW_PKG_PYTHON_PATH := $(shell $(JW_PKG_PY) --topdir-format absolute projects pythonpath --delimiter ' ' $(PROJECT) $(PREREQ_RUN)) endif -export PYTHONPATH := $(JW_PKG_PYTHON_PATH) +export PYTHONPATH := $(subst $(space),:,$(JW_PKG_PYTHON_PATH)) -- 2.54.0