cache.mk: Include from topdir.mk, not make.mk
During a topdir "make all", caching variables is currently not the first thing that happens. Instead, variables are cached as soon as a project recurses into the make subdirectory. That was necessary, because some makefiles were regenerated in the make subdirectory by autoconf, potentially contributing variables that needed to be cached. As of now, autoconf is long gone and this is no longer true. And for some variables, the two step process becomes involved, notably for PYTHONPATH, which coding agents would like to look at from the topdir very early on. This commit moves the .project-cache.mk creation to topdir.mk, and .projects-cache.mk creation to jw-pkg/Makefile to address that. Signed-off-by: Jan Lindemann <jan@janware.com>
This commit is contained in:
parent
193c2ee0bd
commit
d90c0ebf18
9 changed files with 46 additions and 34 deletions
2
.gitignore
vendored
2
.gitignore
vendored
|
|
@ -12,3 +12,5 @@ pkg-build.dist
|
|||
pkgconfig/
|
||||
rebase.sh
|
||||
__pycache__
|
||||
.cache-project.mk
|
||||
.cache-projects.mk
|
||||
|
|
|
|||
14
Makefile
14
Makefile
|
|
@ -1,14 +1,24 @@
|
|||
TOPDIR = .
|
||||
PKG_UPLOAD_URLPREFIX ?= rsync_ssh://$(JANWARE_USER)@pkg.janware.com:/srv/dav/pub/packages/jw-foss/$(PKG_UPLOAD_OS_NAME)/$(PKG_UPLOAD_OS_VERSION)
|
||||
|
||||
all:
|
||||
all: cache-projects
|
||||
|
||||
include $(TOPDIR)/make/proj.mk
|
||||
include $(JWBDIR)/make/topdir.mk
|
||||
include $(JWBDIR)/make/srcdist.mk
|
||||
include $(JWBDIR)/make/git-cvs-bridge.mk
|
||||
include $(JWBDIR)/make/py-topdir.mk
|
||||
|
||||
all:
|
||||
clean: clean.pkgconfig
|
||||
|
||||
clean.pkgconfig:
|
||||
rm -rf pkgconfig
|
||||
|
||||
# -- Cache for all projects
|
||||
cache-projects: $(CACHE_PROJECTS_MK)
|
||||
clean.cache-projects:
|
||||
rm -f $(CACHE_PROJECTS_MK)
|
||||
topdir.clean: clean.cache-projects
|
||||
$(CACHE_PROJECTS_MK): $(CACHE_PROJECT_MK)
|
||||
sed -E '/^[[:blank:]]*ifndef[[:blank:]]+($(subst $(space),|,$(CACHED_VARS_ONLY_PROJECT)))[[:blank:]]*$$/,/^[[:blank:]]*endif[[:blank:]]*$$/d' $< > $@.tmp
|
||||
mv $@.tmp $@
|
||||
|
|
|
|||
|
|
@ -13,19 +13,9 @@ endif
|
|||
|
||||
include $(JWBDIR)/make/dev-utils.mk
|
||||
|
||||
all: cache-projects
|
||||
clean: clean-cache-projects
|
||||
|
||||
ifeq ($(TARGET),mingw)
|
||||
install: $(INSTALL_MAKEDIR)/winres.rc.tmpl
|
||||
endif
|
||||
|
||||
grep-vars:
|
||||
$(Q)sed '/^ *[A-Z]/!d; s/^[ ]*//g; s/[=+?:].*//g; s/[ ]*//g' *.mk | sort -u
|
||||
|
||||
cache-projects: $(CACHE_PROJECTS_MK)
|
||||
clean-cache-projects:
|
||||
rm -f $(CACHE_PROJECTS_MK)
|
||||
$(CACHE_PROJECTS_MK): $(CACHE_PROJECT_MK)
|
||||
sed -E '/^[[:blank:]]*ifndef[[:blank:]]+($(subst $(space),|,$(CACHED_VARS_ONLY_PROJECT)))[[:blank:]]*$$/,/^[[:blank:]]*endif[[:blank:]]*$$/d' $< > $@.tmp
|
||||
mv $@.tmp $@
|
||||
|
|
|
|||
|
|
@ -1,9 +1,15 @@
|
|||
# ----- define these variables
|
||||
# CACHED_FILES = $(TOPDIR)/VERSION
|
||||
# CACHED_VARS = VERSION
|
||||
.PHONY: cache clean-cache clean-cache-projects
|
||||
.PHONY: cache clean.cache
|
||||
|
||||
CACHED_FILES ?= $(VERSION_FILE) $(wildcard $(TOPDIR)/make/project.conf)
|
||||
CACHED_VARS ?= PROJECT PREREQ_BUILD PREREQ_RUN PREREQ VERSION HEX_VERSION \
|
||||
FULL_NAME WHICH PYTHON ECHO TEST BROWSER SED RM PWD ID CUT TR \
|
||||
AWK GETENT XARGS FIND PRINTF PLATFORM_INFO OS_NAME_VERSION \
|
||||
CAT BIN_INSTALL SUDO \
|
||||
JW_PKG_LD_LIBRARY_PATH JW_PKG_EXE_PATH JW_PKG_PYTHON_PATH
|
||||
|
||||
CACHE_PROJECT_MK ?= .cache-project.mk
|
||||
CACHED_VARS_ONLY_PROJECT ?= \
|
||||
PROJECT \
|
||||
PREREQ_BUILD \
|
||||
|
|
@ -15,9 +21,13 @@ CACHED_VARS_ONLY_PROJECT ?= \
|
|||
JW_PKG_LD_LIBRARY_PATH \
|
||||
JW_PKG_EXE_PATH \
|
||||
JW_PKG_PYTHON_PATH
|
||||
|
||||
# We need this to cache JW_PKG_PYTHON_PATH
|
||||
include $(JWBDIR)/make/py-path.mk
|
||||
|
||||
all: cache
|
||||
clean: clean-cache
|
||||
clean-cache:
|
||||
clean: clean.cache
|
||||
clean.cache:
|
||||
rm -f $(CACHE_PROJECT_MK)
|
||||
|
||||
cache: $(CACHE_PROJECT_MK)
|
||||
|
|
|
|||
|
|
@ -8,15 +8,6 @@ include $(JWBDIR)/make/ldlibpath.mk
|
|||
include $(JWBDIR)/make/defs-dirs.mk
|
||||
include $(JWBDIR)/make/dev-utils.mk
|
||||
|
||||
CACHED_FILES ?= $(VERSION_FILE) $(wildcard $(TOPDIR)/make/project.conf)
|
||||
CACHED_VARS ?= PROJECT PREREQ_BUILD PREREQ_RUN PREREQ VERSION HEX_VERSION \
|
||||
FULL_NAME WHICH PYTHON ECHO TEST BROWSER SED RM PWD ID CUT TR \
|
||||
AWK GETENT XARGS FIND PRINTF PLATFORM_INFO OS_NAME_VERSION \
|
||||
CAT BIN_INSTALL SUDO \
|
||||
JW_PKG_LD_LIBRARY_PATH JW_PKG_EXE_PATH JW_PKG_PYTHON_PATH
|
||||
|
||||
include $(JWBDIR)/make/cache.mk
|
||||
|
||||
ifneq ($(CREATE_DEVEL),false)
|
||||
MKFILES += $(wildcard project.conf)
|
||||
DEVEL_TARGETS += install_MAKE $(INSTALLED_PKG_MK)
|
||||
|
|
|
|||
|
|
@ -128,7 +128,7 @@ pkg-update: pkgupdate.dist
|
|||
pkg-upload-local: pkg-upload-local.dist
|
||||
|
||||
clean.rpm:
|
||||
$(RM) -rf $(DIST_DIR) *.dist make/.cache-project.mk
|
||||
$(RM) -rf $(DIST_DIR) *.dist
|
||||
|
||||
pkg-build.dist: $(VERSION_FILE)
|
||||
$(PKG_SH) build $(PKG_SH_BUILD_OPTS)
|
||||
|
|
|
|||
|
|
@ -3,6 +3,16 @@
|
|||
ifndef PLATFORM_MK_INCLUDED
|
||||
PLATFORM_MK_INCLUDED = true
|
||||
|
||||
CACHE_PROJECT_MK ?= $(TOPDIR)/.cache-project.mk
|
||||
CACHE_PROJECTS_MK := $(JWBDIR)/.cache-projects.mk
|
||||
JW_PKG_NO_CACHE ?= false
|
||||
|
||||
ifneq ($(filter clean distclean,$(MAKECMDGOALS)),)
|
||||
ifeq ($(TOPDIR),.)
|
||||
JW_PKG_NO_CACHE = true
|
||||
endif
|
||||
endif
|
||||
|
||||
# "-include" tries search path, we don't want that
|
||||
define try_include
|
||||
ifneq ($$(wildcard $(1)),)
|
||||
|
|
@ -10,12 +20,11 @@ define try_include
|
|||
endif
|
||||
endef
|
||||
|
||||
CACHE_PROJECTS_MK := $(JWBDIR)/cache-projects.mk
|
||||
|
||||
ifeq ($(filter clean distclean,$(MAKECMDGOALS)),)
|
||||
$(eval $(call try_include,$(TOPDIR)/make/.cache-project.mk))
|
||||
$(eval $(call try_include,$(CACHE_PROJECTS_MK)))
|
||||
ifneq ($(JW_PKG_NO_CACHE),true)
|
||||
$(eval $(call try_include,$(CACHE_PROJECT_MK)))
|
||||
$(eval $(call try_include,$(CACHE_PROJECTS_MK)))
|
||||
endif
|
||||
|
||||
$(eval $(call try_include,$(JWBDIR)/make/pre-local.mk))
|
||||
$(eval $(call try_include,$(TOPDIR)/make/pre-local.mk))
|
||||
$(eval $(call try_include,pre-local.mk))
|
||||
|
|
|
|||
|
|
@ -104,6 +104,7 @@ include $(JWBDIR)/make/rules.mk
|
|||
include $(JWBDIR)/make/doc-rules.mk
|
||||
include $(JWBDIR)/make/list-files.mk
|
||||
include $(JWBDIR)/make/projects+project.mk
|
||||
include $(JWBDIR)/make/cache.mk
|
||||
|
||||
STREAMLINE_PROJECT ?= bash $(JWB_SCRIPT_DIR)/streamline-project.sh
|
||||
|
||||
|
|
@ -115,7 +116,7 @@ TD_COPY_FILES ?= $(filter-out Makefile,$(notdir $(wildcard $(TD_CO
|
|||
# -- Internal variables, define JW_PKG_TOPDIR_COPY_PATH if you want to
|
||||
# add more files appended to the target files
|
||||
TD_COPY_SRC_PATH = $(subst :,$(space),$(JW_PKG_TOPDIR_COPY_PATH))
|
||||
TD_GENERATE_FILES += $(TD_COPY_FILES)
|
||||
TD_GENERATE_FILES += $(TD_COPY_FILES) $(CACHE_PROJECT_MK)
|
||||
|
||||
test: all
|
||||
format: topdir
|
||||
|
|
|
|||
|
|
@ -103,8 +103,7 @@ cat_gitignore()
|
|||
*.done
|
||||
*.dist
|
||||
*.dep.mk
|
||||
.cache.mk
|
||||
make/.cache-project.mk
|
||||
.cache-project.mk
|
||||
*.o
|
||||
*.so.*
|
||||
*.so
|
||||
|
|
|
|||
Loading…
Reference in a new issue