Add support for --topdir-format. The option supports several different values, affecting the console output of App wherever it knows that the output contains a reference to the projects' toplevel directory.
- "unaltered" will have it print the toplevel directory in the same format as passed to the commandline- "absolute" will try to resolve it to an absolute path before printing- make:XXX will return the make-varible $(XXX) instead
To implement this, the proj_dir() member function is turned into the private member function __proj_dir(), and a new member function find_dir() is supplied, with two additional parameters: search_subdirs and search_absdirs, which will try to find an existing directory relative to the toplevel directory of the given module, or in the search_absdirs list, respectively.
Command modules in cmds.projects have been updated to use the new function.
Signed-off-by: Jan Lindemann <jan@janware.com>
38 lines
1.2 KiB
Makefile
38 lines
1.2 KiB
Makefile
# == Variables for inter-project-communication
|
|
|
|
include $(JWBDIR)/make/platform.mk
|
|
|
|
# -- What do I know about myself?
|
|
VERSION_FILE := $(firstword $(wildcard VERSION) $(TOPDIR)/VERSION)
|
|
ifndef DEVELOPMENT
|
|
ifeq ($(wildcard $(VERSION_FILE)),)
|
|
DEVELOPMENT := true
|
|
else
|
|
DEVELOPMENT := $(shell grep -q 'dev' $(VERSION_FILE) && echo true)
|
|
endif
|
|
endif
|
|
|
|
# -- Conclude the build system's location:
|
|
ifeq ($(PROJECTS_DIR),)
|
|
ifeq ($(DEVELOPMENT),true)
|
|
PROJECTS_DIR ?= $(TOPDIR)/..
|
|
else
|
|
PROJECTS_DIR ?= /opt
|
|
endif
|
|
endif
|
|
|
|
# -- Query the build system about other projects:
|
|
|
|
ifndef WHICH
|
|
WHICH := $(firstword $(wildcard /usr/bin/which) $(shell which which))
|
|
endif
|
|
|
|
include $(JWBDIR)/make/py-version.mk
|
|
|
|
ifneq ($(TOPDIR),)
|
|
proj_query_cmd = PYTHONPATH=$(JWBDIR)/src/python $(PYTHON) $(JWB_SCRIPT_DIR)/jw-projects.py -p $(PROJECTS_DIR) -t $(TOPDIR) --topdir-format absolute $(PROJECTS_PY_EXTRA_OPTS) projects
|
|
proj_query = $(shell $(proj_query_cmd) $(1))
|
|
proj_dir = $(call proj_query,proj-dir $(1))
|
|
htdocs_dir = $(call proj_query,htdocs-dir $(1))
|
|
tmpl_dir = $(call proj_query,tmpl-dir $(1))
|
|
endif
|