topdir.mk: Add dynamic file creation machinery

Add generic machinery to dynamically create files in $(TOPDIR). The need arises because version controlled configuration files for linters are going to be introduced.

For that, this commit introduces a variable $(TD_GENERATE_FILES), which target all depends on, and which topdir.clean removes.

It defaults to another variable also introduced by this commit, $(TD_COPY_FILES), which in turn defaults to $(TOPDIR)/conf/topdir.

This commit also adds support for JW_PKG_TOPDIR_COPY_PATH. It supports a PATH-style syntax, which allows pointing to multiple directories to be checked for source files. If they exist, they will be appended to the files found in $(TOPDIR)/conf/topdir after copying. Defining arbitray files to copy is not supported before security implications during CI runs are better understood.

Having the copy prerequisites work comes at the cost of having to add .SECONDEXPANSION. Since it's limited to the toplevel Makefile, I suppose that's acceptable.

Signed-off-by: Jan Lindemann <jan@janware.com>
This commit is contained in:
Jan Lindemann 2026-05-26 10:34:17 +02:00
commit f21ff8e713
Signed by: Jan Lindemann
GPG key ID: 3750640C9E25DD61
2 changed files with 30 additions and 4 deletions

6
conf/topdir/Makefile Normal file
View file

@ -0,0 +1,6 @@
TOPDIR = ../..
CONFIG_SUBDIR = $(notdir $(shell pwd))
include $(TOPDIR)/make/proj.mk
include $(JWBDIR)/make/conf.mk