jw-pkg/make/projects.mk
Jan Lindemann caf33841b4 py-defs.mk, projects.mk: Use latest install Python
Use $(lastword $(shell ls -v /usr/bin/python[0-9]*)) for the Python version to use.

Signed-off-by: Jan Lindemann <jan@janware.com>
2020-05-16 13:22:51 +00:00

45 lines
1.4 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
ifneq ($(PYTHON_VERSION),)
PYTHON := /usr/bin/python$(PYTHON_VERSION)
else
ifeq ($(PYTHON),)
PYTHON := $(lastword $(shell ls -v /usr/bin/python[0-9]*))
endif
PYTHON_VERSION ?= $(patsubst python%,%,$(notdir $(PYTHON)))
endif
PYTHON_MAJOR = $(basename $(PYTHON_VERSION))
ifneq ($(TOPDIR),)
proj_query_cmd = $(PYTHON) $(JWB_SCRIPT_DIR)/projects.py -p $(PROJECTS_DIR) -t $(TOPDIR) $(PROJECTS_PY_EXTRA_ARGS)
proj_query = $(shell $(proj_query_cmd) $(1))
proj_dir = $(call proj_query,proj-dir $(1))
htdocs_dir = $(call proj_query,htdocs-dir $(1))
endif