projects.mk + defs.mk: Make some variables more universally usable

- Remove temporary variable PRJS_DIR
- Add defaults for BUILD_LIBS_PREFIX and BUILD_TOOLS_PREFIX
- Move definitions of varables needed early on from defs.mk
  into projects.mk, such as PYTHON and PYTHON_VERSION

Signed-off-by: Jan Lindemann <jan@janware.com>
This commit is contained in:
Jan Lindemann 2019-06-24 12:44:14 +00:00
commit 15579e94d3
2 changed files with 32 additions and 11 deletions

View file

@ -11,6 +11,8 @@ empty :=
space := $(empty) $(empty)
comma := ,
# ----- executables
include $(MODDIR)/make/projects.mk
ifeq ($(MAKE_BENCHMARK),true)
@ -19,10 +21,6 @@ else
export SHELL := /bin/bash
endif
# ----- executables
ifndef WHICH
WHICH := $(firstword $(wildcard /usr/bin/which) $(shell which which))
endif
ifndef GREP
GREP := $(shell $(WHICH) grep)
endif
@ -157,6 +155,17 @@ else ifneq ($(wildcard $(TOPDIR)/CVS),)
VCS ?= cvs
endif
ifndef BUILD_TOOLS_PREFIX
ifdef BUILD_LIBS_PREFIX
BUILD_TOOLS_PREFIX = $(BUILD_LIBS_PREFIX)
endif
endif
ifdef BUILD_LIBS_PREFIX
ifndef BUILD_TOOLS_PREFIX
BUILD_LIBS_PREFIX = $(BUILD_TOOLS_PREFIX)
endif
endif
# ----- user and organization
ifndef BUILD_USER

View file

@ -13,17 +13,29 @@ ifndef DEVELOPMENT
endif
# -- Conclude the build system's location:
PROJECTS_DIR ?= $(TOPDIR)/..
ifeq ($(DEVELOPMENT),true)
PRJS_DIR ?= $(PROJECTS_DIR)
else
PRJS_DIR ?= /opt
ifeq ($(PROJECTS_DIR),)
ifeq ($(DEVELOPMENT),true)
PROJECTS_DIR ?= $(TOPDIR)/..
else
PROJECTS_DIR ?= /opt
endif
endif
# -- Query the build system about other projects:
PYTHON ?= /usr/bin/python3
ifndef WHICH
WHICH := $(firstword $(wildcard /usr/bin/which) $(shell which which))
endif
ifeq ($(PYTHON),)
PYTHON_VERSION := 3
PYTHON := $(shell $(WHICH) python$(PYTHON_VERSION))
else
PYTHON_VERSION := $(word 2,$(subst ., ,$(shell $(PYTHON) --version)))
endif
ifneq ($(TOPDIR),)
proj_query_cmd = $(PYTHON) $(MOD_SCRIPT_DIR)/projects.py -p $(PRJS_DIR) -t $(TOPDIR) $(PROJECTS_PY_EXTRA_ARGS)
proj_query_cmd = $(PYTHON) $(MOD_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))