make: Re-add files necessary for building jw-python

Re-add everything necessary for building and packaging jw-python.

ldlibpath.mk is not strictly necessary, but might be with other
Python packages backed by compiled C-code, so leave it in.

Signed-off-by: Jan Lindemann <jan@janware.com>
This commit is contained in:
Jan Lindemann 2025-11-13 17:27:14 +01:00
commit 0a9340af49
7 changed files with 261 additions and 0 deletions

24
make/py-mod.mk Normal file
View file

@ -0,0 +1,24 @@
include $(JWBDIR)/make/defs.mk
include $(JWBDIR)/make/py-defs.mk
include $(JWBDIR)/make/dirs.mk
include $(JWBDIR)/make/dev-utils.mk
PY_INIT_TMPL = $(wildcard __init__.py.tmpl)
PY_SED_EXTRACT_EXPORT ?= /\(\(class\|def\)\s\+[a-zA-Z_].*\|^ *\S\+\s*=.*\)\# *export/ !d; /^\s*\#/ d; s/\(async\)* *\(class\|def\) *//; s/[(:=].*//
PY_INIT_FILTER ?= cat
#leftparen := (
#PY_EXPORT ?= $(shell sed '/\(class\|def\) ..*\# *export/ !d; s/\(class\|def\) *//; s/[$(leftparen):].*//' $(PY_SRC_PY))
all: $(PY_PYC)
install: install-dirs.done install-reg.done
clean: py.clean
distclean:
include $(JWBDIR)/make/py-rules.mk
__init__.py: $(PY_INIT_TMPL) $(filter-out __init__.py,$(PY_SRC_PY))
if [ "$(PY_INIT_TMPL)" ]; then cat "$(PY_INIT_TMPL)" > $@.tmp; else > $@.tmp; fi
/bin/bash +H $(JWB_SCRIPT_DIR)/python-tools.sh create-init -m $(PY_MOD) -e "$(PY_SED_EXTRACT_EXPORT)" \
$(filter-out __init__.py,$(PY_ALL_PY)) $(SUBDIRS_TO_ITERATE) | $(PY_INIT_FILTER) | tee -a $@.tmp
mv $@.tmp $@