From 7b8b96a327f2201531c0a2b32db490532db4aa39 Mon Sep 17 00:00:00 2001 From: Jason Merrill Date: Tue, 4 Jun 2024 21:15:02 -0400 Subject: libcpp: add .c++-header-unit target The dependency output for header unit modules is based on the absolute pathname of the header file, but that's not something that a makefile can portably refer to. This patch adds a .c++-header-unit target based on the header name relative to an element of the include path. libcpp/ChangeLog: * internal.h (_cpp_get_file_dir): Declare. * files.cc (_cpp_get_file_dir): New fn. * mkdeps.cc (make_write): Use it. gcc/testsuite/ChangeLog: * g++.dg/modules/dep-4.H: New test. --- libcpp/files.cc | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'libcpp/files.cc') diff --git a/libcpp/files.cc b/libcpp/files.cc index 840dffc..1cbce49 100644 --- a/libcpp/files.cc +++ b/libcpp/files.cc @@ -2336,6 +2336,13 @@ _cpp_get_file_stat (_cpp_file *file) return &file->st; } +/* Return the directory where FILE was found. */ +struct cpp_dir * +_cpp_get_file_dir (_cpp_file *file) +{ + return file->dir; +} + /* Set the include chain for "" to QUOTE, for <> to BRACKET. If QUOTE_IGNORES_SOURCE_DIR, then "" includes do not look in the directory of the including file. -- cgit v1.1