2025-11-18 15:56:21 +01:00
|
|
|
# SPDX-License-Identifier: LGPL-2.0-only
|
2025-11-13 16:23:35 +01:00
|
|
|
#
|
2025-11-18 15:56:21 +01:00
|
|
|
# Makefile for managing multiple software repositories in one tree
|
2025-11-13 16:23:35 +01:00
|
|
|
#
|
2025-11-18 15:56:21 +01:00
|
|
|
# (C) Copyright 2001-2025, Jan Lindemann <jan@janware.com>
|
2025-11-13 16:23:35 +01:00
|
|
|
#
|
2025-11-18 15:56:21 +01:00
|
|
|
# This is the top-level Makefile for a software build tree organized by
|
2025-11-26 17:48:01 +01:00
|
|
|
# jw-pkg. It is provided under the terms of the GNU Lesser Public License,
|
2025-11-18 15:56:21 +01:00
|
|
|
# Version 2.
|
2025-11-13 16:23:35 +01:00
|
|
|
#
|
|
|
|
|
# Current documentation on how this Makefile is meant to be used can be found
|
|
|
|
|
# under https://janware.com/wiki/pub/en/sw/build/. Running "make help" might
|
|
|
|
|
# take you there semi-automatically.
|
|
|
|
|
#
|
|
|
|
|
|
|
|
|
|
# ------------ Makefile and environment variable definitions
|
|
|
|
|
|
|
|
|
|
.NOTPARALLEL:
|
|
|
|
|
|
|
|
|
|
PROJECTS_MAKEFILE_NAME ?= $(word $(words $(MAKEFILE_LIST)),$(MAKEFILE_LIST))
|
|
|
|
|
|
|
|
|
|
# -- Find JWBDIR
|
|
|
|
|
DEV_PROJECTS_DIR ?= .
|
2025-11-26 17:48:01 +01:00
|
|
|
JWBDIR_NAME ?= jw-pkg
|
2025-11-13 16:23:35 +01:00
|
|
|
JWBDIR_SEARCH_PATH ?= $(DEV_PROJECTS_DIR) $(BUILD_TOOLS_PREFIX)/opt/$(FLAVOUR_PATH_PREFIX)
|
|
|
|
|
JWBDIR ?= $(firstword $(wildcard $(addsuffix /$(JWBDIR_NAME),$(JWBDIR_SEARCH_PATH))))
|
|
|
|
|
|
common.mk: Add file
This is the first in a series of attempts to clean up jw-pkg's makefile
fragments make/*.mk. It collects redundantly defined workspace and project
variables into one shared common.mk.
Variables needed in both the workspace directory and the project
directories are defined separately in the two contexts: Q in defs.mk and
projects-dir-minimal.mk, INTERACTIVE in topdir.mk and projects-dir.mk,
BROWSER and JWB_SCRIPT_DIR in defs.mk/platform.mk and projects-dir.mk, and
LIST_VCS_FILES and LIST_VCS_FILES_SH wrapping the same scm.sh ls-files call
under different names. PKG_MANAGER is defined in topdir.mk and
projects-dir.mk, and JW_PKG_PY_PROJECTS is a prefix only used to build two
other variables in projects-dir.mk.
This commit adds make/common.mk, included from defs.mk (and hence from
every project directory) and from projects-dir.mk (the workspace), and
collects the shared variables there:
- Q, INTERACTIVE, BROWSER, JWB_SCRIPT_DIR: one ?= definition each
- LIST_VCS_FILES: one definition; LIST_VCS_FILES_SH is dropped and the
list-files target uses the shared name
- PKG_MANAGER moves to projects+project.mk, the fragment shared by the
workspace and the topdir
- projects-dir-minimal.mk keeps its own Q, because the bootstrap recipes
run before common.mk is parsed
- JW_PKG_PY_PROJECTS is inlined into JW_PKG_PY_BUILD and
JW_PKG_PY_REQUIRED_OS_PKG
Signed-off-by: Jan Lindemann <jan@janware.com>
Assisted-by: unsloth/Qwen3.8-27B-GGUF:Q4_K_M with pi.dev v0.87.0
2026-09-21 08:54:07 +02:00
|
|
|
include $(JWBDIR)/make/common.mk
|
|
|
|
|
|
2026-02-21 09:29:11 +01:00
|
|
|
JW_PKG_BINDIR = $(JWBDIR)/bin
|
|
|
|
|
JW_PKG_REMOTE_BINDIR = /opt/jw-pkg/bin
|
2025-11-13 16:23:35 +01:00
|
|
|
|
|
|
|
|
SHELL = /bin/bash -o pipefail +H
|
|
|
|
|
PROJECTS_TXT ?= projects.txt
|
2026-02-21 09:29:11 +01:00
|
|
|
JW_PKG_VERBOSE ?= false
|
2025-11-13 16:23:35 +01:00
|
|
|
PREREQ_RELEASE ?= pull
|
2025-11-19 08:37:07 +01:00
|
|
|
ifneq ($(JANWARE_USER),)
|
2025-11-18 21:14:19 +01:00
|
|
|
export JANWARE_USER
|
|
|
|
|
endif
|
2025-11-13 16:23:35 +01:00
|
|
|
|
2025-11-20 15:28:05 +01:00
|
|
|
ifneq ($(GIT_ASKPASS),)
|
|
|
|
|
GIT_ASKPASS := $(realpath $(GIT_ASKPASS))
|
|
|
|
|
endif
|
|
|
|
|
|
|
|
|
|
ifneq ($(SSH_ASKPASS),)
|
|
|
|
|
SSH_ASKPASS := $(realpath $(SSH_ASKPASS))
|
|
|
|
|
endif
|
|
|
|
|
|
2025-11-13 16:23:35 +01:00
|
|
|
# ------------ evaluate Makefile and environment variables
|
|
|
|
|
|
|
|
|
|
ifneq ($(wildcard $(PROJECTS_TXT)),)
|
|
|
|
|
PROJECTS ?= $(shell cat $(PROJECTS_TXT) | sed '/^ *\#/ d')
|
|
|
|
|
else
|
|
|
|
|
PROJECTS ?= $(shell ls -d */GNUmakefile */Makefile 2>/dev/null | sed 's%/[^/]*%%' | sort -u)
|
|
|
|
|
endif
|
|
|
|
|
|
projects-dir.mk: Add BUILD_DEP_FLAVOURS_*
The top-level all, test, check, check-pre, and check-post targets invoke
the build tool without --dep-flavours, so it falls back to the auto default
and only resolves dependencies of the flavour "build". The build-order-%
target, by contrast, already passes the run,build,test,release set via a
single BUILD_ORDER_DEP_FLAVOURS variable. Planning and building therefore
rely on different dependency flavours, and none of the targets can be tuned
individually.
Introduce one flavour variable per target group, all of them defaulting to
the run,build,test,release set:
- BUILD_DEP_FLAVOURS for all
- BUILD_DEP_FLAVOURS_LINT for check, check-pre, and check-post
- BUILD_DEP_FLAVOURS_TEST for test
- BUILD_DEP_FLAVOURS_ORDER, renamed from BUILD_ORDER_DEP_FLAVOURS, used by
build-order-%
Split the combined all test check check-pre check-post rule into three
rules so that each group passes its own --dep-flavours to the build tool.
all, test, and the check targets now also resolve run, test, and release
dependencies, as build-order already does, and each target's flavour set
can be overridden independently.
Note that they all default the whole shebang: run,build,test,release. And
this opens up the door to dependency cycles that don't exist with the
subset of projects currently used. It's still better to ask for all and
then cut down as needed instead of starting small.
Signed-off-by: Jan Lindemann <jan@janware.com>
Assisted-by: unsloth/Qwen3.8-27B-GGUF:Q4_K_M with pi.dev v0.85.1
2026-09-17 11:26:30 +02:00
|
|
|
BUILD_DEP_FLAVOURS ?= run,build,test,release
|
|
|
|
|
BUILD_DEP_FLAVOURS_LINT ?= run,build,test,release
|
|
|
|
|
BUILD_DEP_FLAVOURS_TEST ?= run,build,test,release
|
|
|
|
|
BUILD_DEP_FLAVOURS_ORDER ?= run,build,test,release
|
2026-08-24 14:13:48 +02:00
|
|
|
|
2025-11-28 13:09:41 +01:00
|
|
|
ifeq ($(JW_PKG_VERBOSE),true)
|
2025-11-13 16:23:35 +01:00
|
|
|
SSH_WRAPPER_TRACE ?= -x
|
|
|
|
|
endif
|
|
|
|
|
|
2025-11-28 13:09:41 +01:00
|
|
|
export JW_PKG_VERBOSE
|
2025-11-13 16:23:35 +01:00
|
|
|
|
|
|
|
|
# ------------ external programs I
|
|
|
|
|
|
|
|
|
|
CWD := $(dir $(abspath $(lastword $(MAKEFILE_LIST))))
|
2026-03-02 10:50:37 +01:00
|
|
|
JW_PKG_PY = python3 $(JWB_SCRIPT_DIR)/jw-pkg.py --prefix $(shell pwd) $(JW_PKG_PY_EXTRA_OPTS)
|
2025-11-13 16:23:35 +01:00
|
|
|
SSH_WRAPPER_SH := $(CWD)/ssh-wrapper.sh
|
|
|
|
|
|
|
|
|
|
EXCLUDES_FILE ?= exclude.txt
|
2026-04-24 12:16:20 +02:00
|
|
|
EXCLUDES_FILES := $(wildcard $(patsubst %,exclude-%.txt,$(shell $(JW_PKG_PY) platform info --format '%{cascade}')) $(EXCLUDES_FILE))
|
2026-03-02 10:53:15 +01:00
|
|
|
|
2025-11-13 16:23:35 +01:00
|
|
|
ifneq ($(EXCLUDES_FILES),)
|
|
|
|
|
EXCLUDE_FROM_BUILD += $(shell sed 's/\#.*//g' $(EXCLUDES_FILES))
|
|
|
|
|
endif
|
2025-11-18 15:44:57 +01:00
|
|
|
OFFLINE ?= false
|
2025-11-13 16:23:35 +01:00
|
|
|
OFFLINE_PROJECTS ?= $(EXCLUDE_FROM_BUILD)
|
|
|
|
|
|
|
|
|
|
TEXT_FILES_CACHE ?= text-files.txt
|
|
|
|
|
|
|
|
|
|
ifeq ($(OFFLINE),true)
|
2026-02-21 09:29:11 +01:00
|
|
|
UNAVAILABLE_TARGETS ?= pull.done update.done get.done
|
2025-11-13 16:23:35 +01:00
|
|
|
else
|
|
|
|
|
UNAVAILABLE_TARGETS ?=
|
|
|
|
|
endif
|
|
|
|
|
|
2025-11-28 13:09:41 +01:00
|
|
|
ifneq ($(origin JW_PKG_SSH),undefined)
|
|
|
|
|
export GIT_SSH := $(JW_PKG_SSH)
|
2025-11-13 16:23:35 +01:00
|
|
|
else
|
2025-11-17 10:22:35 +01:00
|
|
|
export GIT_SSH := $(SSH_WRAPPER_SH)
|
2025-11-13 16:23:35 +01:00
|
|
|
endif
|
|
|
|
|
|
2026-04-04 16:07:23 +02:00
|
|
|
JW_PKG_SSH_EXTRA_OPTS += \
|
|
|
|
|
-o StrictHostKeyChecking=no \
|
|
|
|
|
-o BatchMode=yes \
|
|
|
|
|
-o ServerAliveInterval=15 \
|
|
|
|
|
-o ServerAliveCountMax=3 \
|
|
|
|
|
-o ControlMaster=auto \
|
|
|
|
|
-o ControlPath=/tmp/%r@jw-pkg:%h:%p \
|
|
|
|
|
-o ControlPersist=3m
|
|
|
|
|
ifneq ($(JANWARE_USER),)
|
|
|
|
|
JW_PKG_SSH_EXTRA_OPTS += -l $(JANWARE_USER)
|
2025-11-13 16:23:35 +01:00
|
|
|
endif
|
2026-04-04 16:07:23 +02:00
|
|
|
export JW_PKG_SSH_EXTRA_OPTS
|
2025-11-13 16:23:35 +01:00
|
|
|
|
|
|
|
|
ifneq ($(EXCLUDE_FROM_BUILD),)
|
2026-01-28 07:56:33 +01:00
|
|
|
JW_PKG_PY_EXTRA_BUILD_OPTS += --exclude "$(EXCLUDE_FROM_BUILD)"
|
2025-11-13 16:23:35 +01:00
|
|
|
endif
|
|
|
|
|
|
|
|
|
|
# ------------ external programs II
|
|
|
|
|
|
|
|
|
|
EDITOR ?= xdg-open
|
|
|
|
|
ifeq ($(TIME),)
|
2026-01-07 09:38:47 +01:00
|
|
|
TIME := $(shell which time)
|
|
|
|
|
ifneq ($(TIME),)
|
|
|
|
|
TIME += -p
|
|
|
|
|
endif
|
2025-11-13 16:23:35 +01:00
|
|
|
endif
|
2026-09-21 17:06:58 +02:00
|
|
|
PKG_RELATIONS_BUILD ?= requires,recommends
|
common.mk: Add file
This is the first in a series of attempts to clean up jw-pkg's makefile
fragments make/*.mk. It collects redundantly defined workspace and project
variables into one shared common.mk.
Variables needed in both the workspace directory and the project
directories are defined separately in the two contexts: Q in defs.mk and
projects-dir-minimal.mk, INTERACTIVE in topdir.mk and projects-dir.mk,
BROWSER and JWB_SCRIPT_DIR in defs.mk/platform.mk and projects-dir.mk, and
LIST_VCS_FILES and LIST_VCS_FILES_SH wrapping the same scm.sh ls-files call
under different names. PKG_MANAGER is defined in topdir.mk and
projects-dir.mk, and JW_PKG_PY_PROJECTS is a prefix only used to build two
other variables in projects-dir.mk.
This commit adds make/common.mk, included from defs.mk (and hence from
every project directory) and from projects-dir.mk (the workspace), and
collects the shared variables there:
- Q, INTERACTIVE, BROWSER, JWB_SCRIPT_DIR: one ?= definition each
- LIST_VCS_FILES: one definition; LIST_VCS_FILES_SH is dropped and the
list-files target uses the shared name
- PKG_MANAGER moves to projects+project.mk, the fragment shared by the
workspace and the topdir
- projects-dir-minimal.mk keeps its own Q, because the bootstrap recipes
run before common.mk is parsed
- JW_PKG_PY_PROJECTS is inlined into JW_PKG_PY_BUILD and
JW_PKG_PY_REQUIRED_OS_PKG
Signed-off-by: Jan Lindemann <jan@janware.com>
Assisted-by: unsloth/Qwen3.8-27B-GGUF:Q4_K_M with pi.dev v0.87.0
2026-09-21 08:54:07 +02:00
|
|
|
JW_PKG_PY_REQUIRED_OS_PKG = $(JW_PKG_PY) projects required-os-pkg --quote --skip-excluded --pkg-relations "$(PKG_RELATIONS_BUILD)"
|
|
|
|
|
JW_PKG_PY_BUILD = $(JW_PKG_PY) projects build --pkg-relations "$(PKG_RELATIONS_BUILD)" $(JW_PKG_PY_EXTRA_BUILD_OPTS)
|
2025-11-18 21:14:19 +01:00
|
|
|
|
2026-01-07 09:34:50 +01:00
|
|
|
ifneq ($(origin PROJECTS_DIR_REMOTE_BASE),undefined)
|
|
|
|
|
PGIT_SH += --remote-base $(PROJECTS_DIR_REMOTE_BASE)
|
|
|
|
|
endif
|
2026-02-21 09:29:11 +01:00
|
|
|
PGIT_SH_GET := $(PGIT_SH) get
|
2025-11-24 10:35:07 +01:00
|
|
|
ifneq ($(JANWARE_USER),)
|
|
|
|
|
PGIT_SH_OPTS_NETWORK += --login $(JANWARE_USER)
|
2026-04-24 10:44:22 +02:00
|
|
|
PGIT_SH_GET += $(PGIT_SH_OPTS_NETWORK) --create-remote-user-repos
|
2025-11-24 10:35:07 +01:00
|
|
|
endif
|
2026-04-24 10:44:22 +02:00
|
|
|
PGIT_SH_GET_DEFAULT = $(PGIT_SH_GET)
|
2025-11-24 10:04:47 +01:00
|
|
|
ifneq ($(CLONE_FROM_USER),)
|
2026-02-21 09:29:11 +01:00
|
|
|
PGIT_SH_GET_DEFAULT += --refspec $(CLONE_FROM_USER):current-branch:current-branch
|
2025-11-24 10:04:47 +01:00
|
|
|
endif
|
2025-11-18 21:14:19 +01:00
|
|
|
ifneq ($(OFFLINE_PROJECTS),)
|
|
|
|
|
export PGIT_IGNORE = $(OFFLINE_PROJECTS)
|
|
|
|
|
endif
|
|
|
|
|
|
2025-11-28 13:09:41 +01:00
|
|
|
PURGE_SH = /bin/bash $(firstword $(wildcard $(JWB_SCRIPT_DIR)/purge-stale-projects.sh $(JW_PKG_BINDIR)/purge-stale-projects.sh) purge-not-found)
|
|
|
|
|
CREATE_PROJECT_SH ?= /bin/bash $(firstword $(wildcard $(JWB_SCRIPT_DIR)/jw-pkg-create-project.sh $(JW_PKG_BINDIR)/jw-pkg-create-project.sh) jw-pkg-create-project-not-found)
|
2026-05-12 15:09:37 +02:00
|
|
|
GIT_SRV_ADMIN_SH = $(GIT_SSH) $(JANWARE_USER)@devgit.janware.com $(JW_PKG_REMOTE_BINDIR)/git-srv-admin.sh
|
2026-02-17 15:49:55 +01:00
|
|
|
JANWARE_PACKAGE_FILTER = url =~ janware
|
2025-11-13 16:23:35 +01:00
|
|
|
|
|
|
|
|
# ------------ projects to be built
|
|
|
|
|
|
|
|
|
|
TARGET_PROJECTS = $(filter-out $(EXCLUDE_FROM_BUILD),$(PROJECTS))
|
2026-09-21 05:42:08 +02:00
|
|
|
DEP_PROJECTS = $(shell JW_DEFAULT_LOG_LEVEL=WARNING $(JW_PKG_PY_BUILD) --build-order --dep-flavours="$(BUILD_DEP_FLAVOURS)" all $(TARGET_PROJECTS))
|
2026-04-04 14:59:26 +02:00
|
|
|
GIT_PROJECTS = $(patsubst %/,%,$(dir $(wildcard $(addsuffix /.git,$(DEP_PROJECTS)))))
|
|
|
|
|
PROJECTS_WITH_PROJECT_CONF = $(patsubst %/make/project.conf,%,$(wildcard $(addsuffix /make/project.conf,$(DEP_PROJECTS))))
|
2025-11-13 16:23:35 +01:00
|
|
|
|
|
|
|
|
# ------------ targets
|
|
|
|
|
|
|
|
|
|
# --- mandatory targets
|
|
|
|
|
|
2026-07-11 12:36:01 +02:00
|
|
|
all:
|
projects-dir.mk: Add BUILD_DEP_FLAVOURS_*
The top-level all, test, check, check-pre, and check-post targets invoke
the build tool without --dep-flavours, so it falls back to the auto default
and only resolves dependencies of the flavour "build". The build-order-%
target, by contrast, already passes the run,build,test,release set via a
single BUILD_ORDER_DEP_FLAVOURS variable. Planning and building therefore
rely on different dependency flavours, and none of the targets can be tuned
individually.
Introduce one flavour variable per target group, all of them defaulting to
the run,build,test,release set:
- BUILD_DEP_FLAVOURS for all
- BUILD_DEP_FLAVOURS_LINT for check, check-pre, and check-post
- BUILD_DEP_FLAVOURS_TEST for test
- BUILD_DEP_FLAVOURS_ORDER, renamed from BUILD_ORDER_DEP_FLAVOURS, used by
build-order-%
Split the combined all test check check-pre check-post rule into three
rules so that each group passes its own --dep-flavours to the build tool.
all, test, and the check targets now also resolve run, test, and release
dependencies, as build-order already does, and each target's flavour set
can be overridden independently.
Note that they all default the whole shebang: run,build,test,release. And
this opens up the door to dependency cycles that don't exist with the
subset of projects currently used. It's still better to ask for all and
then cut down as needed instead of starting small.
Signed-off-by: Jan Lindemann <jan@janware.com>
Assisted-by: unsloth/Qwen3.8-27B-GGUF:Q4_K_M with pi.dev v0.85.1
2026-09-17 11:26:30 +02:00
|
|
|
all: $(filter-out $(UNAVAILABLE_TARGETS),pull.done)
|
|
|
|
|
$(JW_PKG_PY_BUILD) --dep-flavours="$(BUILD_DEP_FLAVOURS)" $@ $(TARGET_PROJECTS)
|
|
|
|
|
check check-pre check-post: $(filter-out $(UNAVAILABLE_TARGETS),pull.done)
|
|
|
|
|
$(JW_PKG_PY_BUILD) --dep-flavours="$(BUILD_DEP_FLAVOURS_LINT)" $@ $(TARGET_PROJECTS)
|
|
|
|
|
test: $(filter-out $(UNAVAILABLE_TARGETS),pull.done)
|
|
|
|
|
$(JW_PKG_PY_BUILD) --dep-flavours="$(BUILD_DEP_FLAVOURS_TEST)" $@ $(TARGET_PROJECTS)
|
|
|
|
|
|
|
|
|
|
|
2025-11-13 16:23:35 +01:00
|
|
|
clean: clean-dirs
|
|
|
|
|
distclean: clean-all-dirs done.clean
|
|
|
|
|
install:
|
|
|
|
|
@echo
|
|
|
|
|
@echo " Target install is not supported by this Makefile."
|
|
|
|
|
@echo " Target pkg-rebuild-reinstall might be what you are looking for."
|
|
|
|
|
@echo
|
2026-01-25 17:34:53 +01:00
|
|
|
$(Q)exit 1
|
2025-11-13 16:23:35 +01:00
|
|
|
|
|
|
|
|
# --- build targets
|
|
|
|
|
|
|
|
|
|
rebuild: clean purge pull subdirs-all
|
|
|
|
|
|
|
|
|
|
subdirs-%:
|
|
|
|
|
FORCE_REBUILD_SUBDIRS=true make $*
|
|
|
|
|
|
|
|
|
|
# --- informative-only targets
|
|
|
|
|
|
|
|
|
|
help doc-project doc-module:
|
|
|
|
|
$(BROWSER) $(firstword $(shell sed '/https:/ !d; s%.*https%https%; s/ .*//' $(firstword $(MAKEFILE_LIST))))
|
|
|
|
|
|
|
|
|
|
status: $(SSH_WRAPPER_SH)
|
|
|
|
|
|
|
|
|
|
build-order-%: $(filter-out $(UNAVAILABLE_TARGETS),pull.done)
|
projects-dir.mk: Add BUILD_DEP_FLAVOURS_*
The top-level all, test, check, check-pre, and check-post targets invoke
the build tool without --dep-flavours, so it falls back to the auto default
and only resolves dependencies of the flavour "build". The build-order-%
target, by contrast, already passes the run,build,test,release set via a
single BUILD_ORDER_DEP_FLAVOURS variable. Planning and building therefore
rely on different dependency flavours, and none of the targets can be tuned
individually.
Introduce one flavour variable per target group, all of them defaulting to
the run,build,test,release set:
- BUILD_DEP_FLAVOURS for all
- BUILD_DEP_FLAVOURS_LINT for check, check-pre, and check-post
- BUILD_DEP_FLAVOURS_TEST for test
- BUILD_DEP_FLAVOURS_ORDER, renamed from BUILD_ORDER_DEP_FLAVOURS, used by
build-order-%
Split the combined all test check check-pre check-post rule into three
rules so that each group passes its own --dep-flavours to the build tool.
all, test, and the check targets now also resolve run, test, and release
dependencies, as build-order already does, and each target's flavour set
can be overridden independently.
Note that they all default the whole shebang: run,build,test,release. And
this opens up the door to dependency cycles that don't exist with the
subset of projects currently used. It's still better to ask for all and
then cut down as needed instead of starting small.
Signed-off-by: Jan Lindemann <jan@janware.com>
Assisted-by: unsloth/Qwen3.8-27B-GGUF:Q4_K_M with pi.dev v0.85.1
2026-09-17 11:26:30 +02:00
|
|
|
@JW_DEFAULT_LOG_LEVEL=WARNING $(JW_PKG_PY_BUILD) --build-order --dep-flavours="$(BUILD_DEP_FLAVOURS_ORDER)" $* $(TARGET_PROJECTS) | sed 's/ */\n/g'
|
2025-11-13 16:23:35 +01:00
|
|
|
|
|
|
|
|
build-order: build-order-all
|
|
|
|
|
|
|
|
|
|
echo-build-deps:
|
2026-09-22 09:16:42 +02:00
|
|
|
$(Q)$(JW_PKG_PY_REQUIRED_OS_PKG) "build" $(TARGET_PROJECTS)
|
2025-11-13 16:23:35 +01:00
|
|
|
|
|
|
|
|
echo-install-deps:
|
2026-09-22 09:16:42 +02:00
|
|
|
$(Q)$(JW_PKG_PY_REQUIRED_OS_PKG) "build,run" $(TARGET_PROJECTS)
|
2025-11-13 16:23:35 +01:00
|
|
|
|
|
|
|
|
echo-release-deps:
|
2026-09-22 09:16:42 +02:00
|
|
|
$(Q)$(JW_PKG_PY_REQUIRED_OS_PKG) "build,run,release" $(TARGET_PROJECTS)
|
2025-11-13 16:23:35 +01:00
|
|
|
echo-os:
|
2026-04-24 12:16:20 +02:00
|
|
|
$(Q)$(JW_PKG_PY) platform info
|
2025-11-13 16:23:35 +01:00
|
|
|
|
|
|
|
|
echo-projects:
|
|
|
|
|
@echo $(PROJECTS)
|
|
|
|
|
|
|
|
|
|
echo-target-projects:
|
|
|
|
|
@echo $(TARGET_PROJECTS)
|
|
|
|
|
|
|
|
|
|
echo-excludes:
|
|
|
|
|
@echo $(EXCLUDE_FROM_BUILD)
|
|
|
|
|
|
|
|
|
|
edit-%: | $(TEXT_FILES_CACHE)
|
|
|
|
|
$(EDITOR) $(shell grep "/$*$$" $(TEXT_FILES_CACHE))
|
|
|
|
|
|
|
|
|
|
distclean: clean.text-files-cache
|
|
|
|
|
clean.text-files-cache:
|
|
|
|
|
rm -f $(TEXT_FILES_CACHE)
|
|
|
|
|
list-files:
|
2026-04-04 14:59:26 +02:00
|
|
|
$(Q)for p in $(DEP_PROJECTS); do \
|
common.mk: Add file
This is the first in a series of attempts to clean up jw-pkg's makefile
fragments make/*.mk. It collects redundantly defined workspace and project
variables into one shared common.mk.
Variables needed in both the workspace directory and the project
directories are defined separately in the two contexts: Q in defs.mk and
projects-dir-minimal.mk, INTERACTIVE in topdir.mk and projects-dir.mk,
BROWSER and JWB_SCRIPT_DIR in defs.mk/platform.mk and projects-dir.mk, and
LIST_VCS_FILES and LIST_VCS_FILES_SH wrapping the same scm.sh ls-files call
under different names. PKG_MANAGER is defined in topdir.mk and
projects-dir.mk, and JW_PKG_PY_PROJECTS is a prefix only used to build two
other variables in projects-dir.mk.
This commit adds make/common.mk, included from defs.mk (and hence from
every project directory) and from projects-dir.mk (the workspace), and
collects the shared variables there:
- Q, INTERACTIVE, BROWSER, JWB_SCRIPT_DIR: one ?= definition each
- LIST_VCS_FILES: one definition; LIST_VCS_FILES_SH is dropped and the
list-files target uses the shared name
- PKG_MANAGER moves to projects+project.mk, the fragment shared by the
workspace and the topdir
- projects-dir-minimal.mk keeps its own Q, because the bootstrap recipes
run before common.mk is parsed
- JW_PKG_PY_PROJECTS is inlined into JW_PKG_PY_BUILD and
JW_PKG_PY_REQUIRED_OS_PKG
Signed-off-by: Jan Lindemann <jan@janware.com>
Assisted-by: unsloth/Qwen3.8-27B-GGUF:Q4_K_M with pi.dev v0.87.0
2026-09-21 08:54:07 +02:00
|
|
|
$(LIST_VCS_FILES) -znf $$p | sed -z "s/^/$$p\//" | \
|
2025-11-17 12:34:14 +01:00
|
|
|
xargs -0 realpath -q ;\
|
2025-11-13 16:23:35 +01:00
|
|
|
done
|
|
|
|
|
$(TEXT_FILES_CACHE):
|
2026-01-25 17:34:53 +01:00
|
|
|
$(Q)make -s text-files-update
|
2025-11-13 16:23:35 +01:00
|
|
|
text-files-update:
|
2026-04-10 09:08:33 +02:00
|
|
|
make -s --no-print-directory list-files | tr '\n' '\0' | xargs -0 grep -d skip -Il . > $(TEXT_FILES_CACHE).tmp 2>/dev/null || true
|
2025-11-13 16:23:35 +01:00
|
|
|
mv $(TEXT_FILES_CACHE).tmp $(TEXT_FILES_CACHE)
|
|
|
|
|
text-files-update-all:
|
2026-01-25 17:34:53 +01:00
|
|
|
$(Q)PROJECTS_TXT= make text-files-update
|
2025-11-13 16:23:35 +01:00
|
|
|
text-files-list list-text-files: | $(TEXT_FILES_CACHE)
|
2026-01-25 17:34:53 +01:00
|
|
|
$(Q)cat $(TEXT_FILES_CACHE)
|
2025-11-13 16:23:35 +01:00
|
|
|
text-files-list-0 list-text-files-0: | $(TEXT_FILES_CACHE)
|
2026-01-25 17:34:53 +01:00
|
|
|
$(Q)cat $(TEXT_FILES_CACHE) | tr '\n' '\0'
|
2025-11-13 16:23:35 +01:00
|
|
|
|
|
|
|
|
cloc:
|
|
|
|
|
for p in $(GIT_PROJECTS); do \
|
|
|
|
|
git -C $$p submodule status | sed "s|^ *\([^ ]\+\) \+\([^ ]\+\) *.*|$$p/\2|" ;\
|
|
|
|
|
done > cloc-ignore.txt
|
2026-04-04 14:59:26 +02:00
|
|
|
for p in $(foreach s,dist include bin lib,$(addsuffix /$s,$(DEP_PROJECTS))); do \
|
2025-11-13 16:23:35 +01:00
|
|
|
echo $$p >> cloc-ignore.txt ;\
|
|
|
|
|
done
|
2026-04-04 14:59:26 +02:00
|
|
|
cloc --exclude-list-file=cloc-ignore.txt $(DEP_PROJECTS)
|
2025-11-13 16:23:35 +01:00
|
|
|
|
|
|
|
|
# --- package-related targets
|
|
|
|
|
|
2026-02-17 15:49:55 +01:00
|
|
|
pkg-delete-ours:
|
|
|
|
|
$(PKG_MANAGER) select "$(JANWARE_PACKAGE_FILTER)" | xargs -r $(PKG_MANAGER) delete
|
|
|
|
|
|
2025-11-13 16:23:35 +01:00
|
|
|
pkg-manager-refresh:
|
2026-01-28 08:10:09 +01:00
|
|
|
$(PKG_MANAGER) refresh
|
2025-11-13 16:23:35 +01:00
|
|
|
|
2026-01-29 12:53:03 +01:00
|
|
|
pkg-manager-dup:
|
|
|
|
|
$(PKG_MANAGER) dup
|
|
|
|
|
|
2025-11-13 16:23:35 +01:00
|
|
|
pkg-install-build-deps:
|
2026-09-22 09:16:42 +02:00
|
|
|
$(PKG_MANAGER) install $(shell $(JW_PKG_PY_REQUIRED_OS_PKG) "build" $(TARGET_PROJECTS))
|
2025-11-13 16:23:35 +01:00
|
|
|
|
|
|
|
|
pkg-install-release-deps:
|
2026-09-22 09:16:42 +02:00
|
|
|
$(PKG_MANAGER) install $(shell $(JW_PKG_PY_REQUIRED_OS_PKG) "build,run,release" $(TARGET_PROJECTS))
|
2025-11-13 16:23:35 +01:00
|
|
|
|
|
|
|
|
pkg-release-reinstall: $(PREREQ_RELEASE)
|
|
|
|
|
|
|
|
|
|
pkg-release-all:
|
|
|
|
|
/bin/bash ./packager-client/scripts/packager-client-2.sh
|
|
|
|
|
|
|
|
|
|
pkg-init-%:
|
|
|
|
|
$(CREATE_PROJECT_SH) $*
|
|
|
|
|
|
2026-02-18 14:30:50 +01:00
|
|
|
pkg-%install: $(filter-out $(UNAVAILABLE_TARGETS),pull.done)
|
2026-02-19 08:46:41 +01:00
|
|
|
$(JW_PKG_PY_BUILD) --env-reinit --env-keep=HOME,SSH_AUTH_SOCK $@ $(TARGET_PROJECTS)
|
2026-02-18 14:30:50 +01:00
|
|
|
|
2025-11-13 16:23:35 +01:00
|
|
|
pkg-%: $(filter-out $(UNAVAILABLE_TARGETS),pull.done)
|
2026-01-28 07:56:33 +01:00
|
|
|
$(JW_PKG_PY_BUILD) $@ $(TARGET_PROJECTS)
|
2025-11-13 16:23:35 +01:00
|
|
|
|
|
|
|
|
# --- generic cleanup targets
|
|
|
|
|
|
|
|
|
|
clean-all-dirs:
|
2026-06-18 11:49:10 +02:00
|
|
|
$(JW_PKG_PY_BUILD) clean $(sort $(subst /,,$(dir $(wildcard */*.done))) $(PROJECTS))
|
|
|
|
|
|
|
|
|
|
clean-dirs:
|
2026-01-28 07:56:33 +01:00
|
|
|
$(JW_PKG_PY_BUILD) clean $(PROJECTS)
|
2025-11-13 16:23:35 +01:00
|
|
|
|
|
|
|
|
purge: $(SSH_WRAPPER_SH)
|
|
|
|
|
ifneq ($(PURGE_SH),/bin/bash purge-not-found)
|
2025-11-29 13:27:28 +01:00
|
|
|
$(PURGE_SH) --vcs git
|
2025-11-13 16:23:35 +01:00
|
|
|
endif
|
|
|
|
|
|
|
|
|
|
$(PROJECTS_TXT):
|
|
|
|
|
echo $(PROJECTS) | sed 's/ /\n/g; s%/%%g' > $@
|
|
|
|
|
|
|
|
|
|
done.clean:
|
|
|
|
|
rm -f *.done
|
|
|
|
|
|
|
|
|
|
# --- collab targets
|
|
|
|
|
|
|
|
|
|
list-maintainers: $(SSH_WRAPPER_SH)
|
|
|
|
|
$(GIT_SRV_ADMIN_SH) $@
|
|
|
|
|
|
2026-02-21 09:29:11 +01:00
|
|
|
update pull: purge git-get
|
2025-11-13 16:23:35 +01:00
|
|
|
touch pull.done
|
|
|
|
|
|
|
|
|
|
sync: pull push
|
|
|
|
|
|
|
|
|
|
sync-all: pull-all push-all
|
|
|
|
|
|
|
|
|
|
sync-%:
|
|
|
|
|
ssh $* make -C $(shell pwd) sync
|
|
|
|
|
|
2026-02-21 09:29:11 +01:00
|
|
|
pull-all: purge git-get git-pull-all
|
|
|
|
|
touch get.done
|
2025-11-13 16:23:35 +01:00
|
|
|
touch pull.done
|
|
|
|
|
|
|
|
|
|
diff-all diff: $(SSH_WRAPPER_SH)
|
2026-03-25 12:19:18 +01:00
|
|
|
$(PGIT_SH) --porcelain diff
|
2026-08-07 19:08:09 +02:00
|
|
|
diff-projects:
|
|
|
|
|
PGIT_SH_PROJECTS="$(patsubst %/.git,%,$(wildcard $(addsuffix /.git,$(shell make -s build-order))))" $(PGIT_SH) --porcelain diff
|
2025-11-13 16:23:35 +01:00
|
|
|
|
2026-02-26 15:20:22 +01:00
|
|
|
get-official: git-get-official
|
2026-02-21 11:27:56 +01:00
|
|
|
get-maintainer: git-get-maintainer
|
2026-05-14 12:37:34 +02:00
|
|
|
get-pub: git-get-pub
|
2026-02-26 14:00:22 +01:00
|
|
|
get-%: git-get-%
|
|
|
|
|
@:
|
|
|
|
|
|
2026-02-21 09:29:11 +01:00
|
|
|
# --- git targets
|
|
|
|
|
|
2025-11-13 16:23:35 +01:00
|
|
|
git-push push: $(SSH_WRAPPER_SH)
|
2026-05-05 17:37:50 +02:00
|
|
|
$(PGIT_SH) push $(PGIT_SH_OPTS_NETWORK) --force-with-lease
|
2025-11-13 16:23:35 +01:00
|
|
|
|
|
|
|
|
git-push-all: $(SSH_WRAPPER_SH)
|
2026-05-05 17:37:50 +02:00
|
|
|
$(PGIT_SH) push $(PGIT_SH_OPTS_NETWORK) --force-with-lease --all --recurse-submodules=on-demand
|
2025-11-13 16:23:35 +01:00
|
|
|
|
|
|
|
|
git-diff: $(SSH_WRAPPER_SH)
|
2026-03-25 12:19:18 +01:00
|
|
|
$(PGIT_SH) --porcelain diff
|
2025-11-13 16:23:35 +01:00
|
|
|
|
|
|
|
|
git-short-diff: $(SSH_WRAPPER_SH)
|
2026-03-25 12:19:18 +01:00
|
|
|
$(PGIT_SH) --porcelain diff --shortstat
|
2025-11-13 16:23:35 +01:00
|
|
|
|
|
|
|
|
git-status:
|
|
|
|
|
$(PGIT_SH) status -uno
|
|
|
|
|
|
2026-09-16 17:31:50 +02:00
|
|
|
git-log-%:
|
|
|
|
|
$(PGIT_SH) log -$* 2>&1
|
|
|
|
|
|
2026-02-21 09:29:11 +01:00
|
|
|
git-get: $(SSH_WRAPPER_SH)
|
|
|
|
|
$(PGIT_SH_GET_DEFAULT)
|
|
|
|
|
touch get.done
|
2025-11-13 16:23:35 +01:00
|
|
|
|
2026-02-21 09:29:11 +01:00
|
|
|
git-get-mini: $(SSH_WRAPPER_SH)
|
|
|
|
|
PGIT_SH_PROJECTS="$(patsubst %/.git,%,$(wildcard $(addsuffix /.git,$(shell make -s build-order))))" $(PGIT_SH_GET_DEFAULT)
|
2025-11-13 16:23:35 +01:00
|
|
|
|
|
|
|
|
git-pull-all: $(SSH_WRAPPER_SH)
|
2025-11-24 10:35:07 +01:00
|
|
|
$(PGIT_SH) pull $(PGIT_SH_OPTS_NETWORK) --all
|
2025-11-13 16:23:35 +01:00
|
|
|
|
2026-02-21 11:27:56 +01:00
|
|
|
git-get-maintainer: $(SSH_WRAPPER_SH)
|
2026-02-26 15:20:22 +01:00
|
|
|
PGIT_SH_PROJECTS="$(PROJECTS_WITH_PROJECT_CONF)" $(PGIT_SH) exec make $@
|
2026-05-14 12:37:34 +02:00
|
|
|
|
|
|
|
|
git-get-pub:
|
|
|
|
|
PGIT_SH_PROJECTS="$(PROJECTS_WITH_PROJECT_CONF)" $(PGIT_SH) exec make $@
|
2026-02-26 15:20:22 +01:00
|
|
|
|
|
|
|
|
git-get-official: $(SSH_WRAPPER_SH)
|
|
|
|
|
PGIT_SH_PROJECTS="$(PROJECTS_WITH_PROJECT_CONF)" $(PGIT_SH) exec make $@
|
2026-02-21 11:27:56 +01:00
|
|
|
|
2026-02-21 09:29:11 +01:00
|
|
|
git-get-%: $(SSH_WRAPPER_SH)
|
2026-04-24 10:44:22 +02:00
|
|
|
$(PGIT_SH_GET) --refspec "$*:master:current-branch"
|
2025-11-13 16:23:35 +01:00
|
|
|
|
|
|
|
|
git-show-non-master-branches:
|
2026-03-25 12:19:18 +01:00
|
|
|
$(Q)$(PGIT_SH) --porcelain branch 2>&1 | \
|
2025-11-13 16:23:35 +01:00
|
|
|
sed '/^#\|^*/!d; s/.*git -C //; s/ *branch *//; s/ *\* *//' | \
|
|
|
|
|
while read p; do \
|
|
|
|
|
read b ;\
|
|
|
|
|
if [ "$$b" != "master" ]; then \
|
|
|
|
|
echo " * $$p: $$b" ;\
|
|
|
|
|
fi ;\
|
|
|
|
|
done
|
|
|
|
|
|
2026-04-04 16:22:57 +02:00
|
|
|
git-show-pushable:
|
2026-05-05 17:10:33 +02:00
|
|
|
$(Q)for p in $(DEP_PROJECTS); do \
|
|
|
|
|
if ! git -C $$p rev-parse --abbrev-ref --symbolic-full-name @{upstream} >/dev/null 2>&1; then \
|
|
|
|
|
echo ======================= $$p ;\
|
|
|
|
|
git -C $$p log --oneline master.. ;\
|
|
|
|
|
elif git -C $$p log --oneline @{upstream}..HEAD | grep . >/dev/null 2>&1; then \
|
|
|
|
|
echo ======================= $$p ;\
|
|
|
|
|
git -C $$p log --oneline @{u}..HEAD ;\
|
|
|
|
|
fi ;\
|
|
|
|
|
done
|
|
|
|
|
|
|
|
|
|
git-show-ahead-of-master:
|
2026-04-03 18:41:57 +02:00
|
|
|
$(Q)for p in $(DEP_PROJECTS); do \
|
2026-01-06 10:38:30 +01:00
|
|
|
if git -C $$p log --oneline origin/master.. | grep . >/dev/null; then \
|
2025-12-23 13:17:35 +01:00
|
|
|
echo ======================= $$p ;\
|
|
|
|
|
git -C $$p log --oneline origin/master.. ;\
|
|
|
|
|
fi ;\
|
|
|
|
|
done
|
|
|
|
|
|
2025-11-13 16:23:35 +01:00
|
|
|
# git-echo-link-<filename> returns a string functioning as hyperlink to
|
|
|
|
|
# matching files in git when embedded into a janware wiki or ticket.
|
|
|
|
|
git-echo-links-%: | $(TEXT_FILES_CACHE)
|
|
|
|
|
sed "/$*$$/!d; s%$(CWD)%%; s|^|\n \[\[jgit>/proj/$(JANWARE_USER)/|; s/$$/|$*\]\]\n/" $(TEXT_FILES_CACHE)
|
|
|
|
|
|
|
|
|
|
git-update-project-descriptions: $(SSH_WRAPPER_SH)
|
|
|
|
|
$(GIT_SRV_ADMIN_SH) -j update-descriptions all
|
|
|
|
|
|
|
|
|
|
git-commit:
|
|
|
|
|
$(PGIT_SH) commit
|
|
|
|
|
|
|
|
|
|
# --- rules
|
|
|
|
|
|
2026-06-07 11:36:02 +02:00
|
|
|
$(SSH_WRAPPER_SH): $(JWB_SCRIPT_DIR)/ssh-wrapper.sh
|
|
|
|
|
cp $< $@.tmp
|
2025-11-13 16:23:35 +01:00
|
|
|
chmod 700 $@.tmp
|
|
|
|
|
mv $@.tmp $@
|
|
|
|
|
ssh-wrapper: $(SSH_WRAPPER_SH)
|
|
|
|
|
clean.ssh-wrapper:
|
|
|
|
|
rm -f $(SSH_WRAPPER_SH)
|
|
|
|
|
distclean: clean.ssh-wrapper
|
|
|
|
|
|
2026-02-21 09:29:11 +01:00
|
|
|
pull.done: $(filter-out $(UNAVAILABLE_TARGETS),get.done)
|
2025-11-13 16:23:35 +01:00
|
|
|
touch $@
|
|
|
|
|
|
2026-02-21 09:29:11 +01:00
|
|
|
get.done: $(filter-out $(UNAVAILABLE_TARGETS),$(SSH_WRAPPER_SH))
|
|
|
|
|
$(PGIT_SH_GET_DEFAULT)
|
2025-11-13 16:23:35 +01:00
|
|
|
touch $@
|