preprocessor: Update mkdeps for modules

This is slightly different to the original patch I posted.  This adds
separate module target and dependency functions (rather than a single
bi-modal function).

	libcpp/
	* include/cpplib.h (struct cpp_options): Add modules to
	dep-options.
	* include/mkdeps.h (deps_add_module_target): Declare.
	(deps_add_module_dep): Declare.
	* mkdeps.c (class mkdeps): Add modules, module_name, cmi_name,
	is_header_unit fields.  Adjust cdtors.
	(deps_add_module_target, deps_add_module_dep): New.
	(make_write): Write module dependencies, if enabled.
This commit is contained in:
Nathan Sidwell
2020-11-18 06:44:38 -08:00
parent d4a788c717
commit db87f19ae3
3 changed files with 96 additions and 1 deletions
+3
View File
@@ -528,6 +528,9 @@ struct cpp_options
one. */
bool phony_targets;
/* Generate dependency info for modules. */
bool modules;
/* If true, no dependency is generated on the main file. */
bool ignore_main_file;
+7
View File
@@ -51,6 +51,13 @@ extern void deps_add_target (class mkdeps *, const char *, int);
string as the default target is interpreted as stdin. */
extern void deps_add_default_target (class mkdeps *, const char *);
/* Adds a module target. The module name and cmi name are copied. */
extern void deps_add_module_target (struct mkdeps *, const char *module,
const char *cmi, bool is_header);
/* Adds a module dependency. The module name is copied. */
extern void deps_add_module_dep (struct mkdeps *, const char *module);
/* Add a dependency (appears on the right side of the colon) to the
deps list. Dependencies will be printed in the order that they
were entered with this function. By convention, the first