make: Miscellaneous versatility improvements #83
6 changed files with 29 additions and 6 deletions
|
|
@ -5,6 +5,6 @@ SUBDIRS_TO_ITERATE = $(filter-out $(IGNORE_SUBDIRS),$(SUBDIRS))
|
|||
EXTRA_SUBDIR_TARGETS ?=
|
||||
ALLOWED_SUBDIR_TARGETS ?= all install clean distclean test link-in $(EXTRA_SUBDIR_TARGETS)
|
||||
|
||||
SUBDIRS ?= $(ORDERED_SUBDIRS) $(filter-out $(ORDERED_SUBDIRS),$(FIND_SUBDIRS))
|
||||
SUBDIRS ?= $(dir $(wildcard $(addsuffix /Makefile,$(ORDERED_SUBDIRS)))) $(filter-out $(ORDERED_SUBDIRS),$(FIND_SUBDIRS))
|
||||
#SUBDIRS ?= $(filter-out $(ORDERED_SUBDIRS),$(FIND_SUBDIRS))
|
||||
#SUBDIRS ?= $(FIND_SUBDIRS)
|
||||
|
|
|
|||
|
|
@ -53,6 +53,8 @@ else
|
|||
PROJECTS ?= $(shell ls -d */GNUmakefile */Makefile 2>/dev/null | sed 's%/[^/]*%%' | sort -u)
|
||||
endif
|
||||
|
||||
BUILD_ORDER_DEP_FLAVOURS ?= run,build,test,release
|
||||
|
||||
ifeq ($(JW_PKG_VERBOSE),true)
|
||||
SSH_WRAPPER_TRACE ?= -x
|
||||
endif
|
||||
|
|
@ -182,7 +184,7 @@ help doc-project doc-module:
|
|||
status: $(SSH_WRAPPER_SH)
|
||||
|
||||
build-order-%: $(filter-out $(UNAVAILABLE_TARGETS),pull.done)
|
||||
$(JW_PKG_PY_BUILD) --build-order $* $(TARGET_PROJECTS) | sed 's/ */\n/g'
|
||||
@JW_DEFAULT_LOG_LEVEL=WARNING $(JW_PKG_PY_BUILD) --build-order --dep-flavours="$(BUILD_ORDER_DEP_FLAVOURS)" $* $(TARGET_PROJECTS) | sed 's/ */\n/g'
|
||||
|
||||
build-order: build-order-all
|
||||
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ include $(JWBDIR)/make/dev-utils.mk
|
|||
include $(JWBDIR)/make/test-guard.mk
|
||||
|
||||
PY_INIT_TMPL = $(wildcard __init__.py.tmpl)
|
||||
PY_SED_EXTRACT_EXPORT_DEF := /\(\(class\|def\)\s\+[a-zA-Z_].*\|^ *\S\+\s*=.*\|^\s\+\"\S\+\",\)\s*\#\s*export/!d;
|
||||
PY_SED_EXTRACT_EXPORT_DEF := /\(\(class\|def\)\s\+[a-zA-Z_].*\|^ *\S\+\(:\s*TypeAlias\)*\s*=.*\|^\s\+\"\S\+\",\)\s*\#\s*export/!d;
|
||||
PY_SED_EXTRACT_EXPORT_DEF := $(PY_SED_EXTRACT_EXPORT_DEF) /^\s*\#/ d; s/\(async\)*\s*\(class\|def\)\s*//;
|
||||
PY_SED_EXTRACT_EXPORT_DEF := $(PY_SED_EXTRACT_EXPORT_DEF) s/[(:=].*//; s/^\s\+\"\(\S\+\)\",.*/\1/
|
||||
PY_SED_EXTRACT_EXPORT ?= $(PY_SED_EXTRACT_EXPORT_DEF)
|
||||
|
|
|
|||
|
|
@ -1,7 +1,26 @@
|
|||
define INIT_PY
|
||||
from pkgutil import extend_path
|
||||
|
||||
__path__ = extend_path(__path__, __name__)
|
||||
endef
|
||||
|
||||
# The __init__.py machinery duplicates (but is independent from) py-mod.mk
|
||||
PY_UPDATE_INIT_PY ?= true
|
||||
PY_INSTALL_INIT_PY ?= false
|
||||
|
||||
ifneq ($(PY_UPDATE_INIT_PY),false)
|
||||
PY_GENERATED_PY += __init__.py
|
||||
endif
|
||||
|
||||
include $(JWBDIR)/make/dirs.mk
|
||||
|
||||
all:
|
||||
all: $(PY_GENERATED_PY)
|
||||
|
||||
clean: py.clean
|
||||
py.clean:
|
||||
rm -rf __pycache__
|
||||
rm -rf __pycache__ $(PY_GENERATED_PY)
|
||||
|
||||
__init__.py:
|
||||
@echo "Creating default namespace stub $@.tmp"
|
||||
$(file >$@.tmp,$(INIT_PY))
|
||||
mv $@.tmp $@
|
||||
|
|
|
|||
|
|
@ -78,7 +78,7 @@ set_global_variables()
|
|||
# If we're in a toplevel directory, suppose projects_dir == project_dirs,
|
||||
# i.e. we only want to target this Git repo
|
||||
if [ ! -d .git ]; then
|
||||
while [ ! -r Makefile ] || ! grep -q some-random-string-to-id-this-makefile Makefile; do
|
||||
while [ ! -r Makefile ] || ! grep -q 'include $(JWBDIR)/make/projects-dir\.mk\|some-random-string-to-id-this-makefile' Makefile; do
|
||||
[ "$projects_dir" = / ] && fatal "Failed to find projects directory"
|
||||
projects_dir=`dirname $projects_dir`
|
||||
done
|
||||
|
|
|
|||
|
|
@ -1,4 +1,6 @@
|
|||
TOPDIR = ../../..
|
||||
|
||||
PY_UPDATE_INIT_PY = false
|
||||
|
||||
include $(TOPDIR)/make/proj.mk
|
||||
include $(JWBDIR)/make/py-ns-dir.mk
|
||||
|
|
|
|||
Loading…
Reference in a new issue