From 6a3ded9d3c85e54a5a008ba2f125520c63cfb641 Mon Sep 17 00:00:00 2001 From: Freeyorp Date: Wed, 5 Jun 2024 23:46:21 +0000 Subject: real.make: Permit existant SRC_DIR relative paths This allows files that already exist to be specified relative to SRC_DIR, rather than just relative to the current file. This is used in tests, though it appears not to be used in main tmwa. --- Makefile.in | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/Makefile.in b/Makefile.in index 2f62baf..2b0c632 100644 --- a/Makefile.in +++ b/Makefile.in @@ -372,13 +372,17 @@ $(foreach root,${PATTERN_ROOTS},$(eval \ # Secondly, make sure that the files actually exist, or are files we expect to # generate ourselves. Sort the result for readability. -# Note that we re-add and remove the ${SRC_DIR} prefix when testing for +# Note that we re-add and remove the ${SRC_DIR} prefix when first testing for # existence, as we need to test for existence relative to our build directory. +# The second wildcard test doesn't add a ${SRC_DIR} prefix, but does strip it, +# handling the case where the file is specified relative to the source +# directory (mostly the case in test sources). $(foreach root,${PATTERN_ROOTS},$(eval \ ${root} := $(sort \ $(patsubst ${SRC_DIR}/%,%,$(wildcard $(addprefix ${SRC_DIR}/, \ $(value ${root}) \ ))) \ + $(patsubst ${SRC_DIR}/%,%,$(wildcard ${SRC_DIR})) \ $(filter conf-raw/%.h,$(value ${root})) \ $(filter ${GENERATED_FILES},$(value ${root})) \ ) \ @@ -738,7 +742,7 @@ conf-raw/str-%.h: FORCE FORCE:: ; .PHONY: FORCE -override CPPFLAGS += -I. -I${SRC_DIR}/include +override CPPFLAGS += -I. -I${SRC_DIR} -I${SRC_DIR}/include # distribution tarballs # this only works from within a git checkout -- cgit v1.2.3-60-g2f50