diff options
| author | Bruce Hill <bruce@bruce-hill.com> | 2025-05-05 18:39:08 -0400 |
|---|---|---|
| committer | Bruce Hill <bruce@bruce-hill.com> | 2025-05-05 18:39:08 -0400 |
| commit | eb91cf7fb75677f48ce4c4c51c2105e205ea3591 (patch) | |
| tree | 10d3366eccd7e6b540696a7f41798b4cccf12be6 /src/compile.c | |
| parent | 976b4eec075ea76387bb3b424fc0d89b8974ae10 (diff) | |
Get rid of single-file headers for libraries and just include each .tm
file's .build/*.tm.h file individually.
Diffstat (limited to 'src/compile.c')
| -rw-r--r-- | src/compile.c | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/src/compile.c b/src/compile.c index 76f519c8..ce00b479 100644 --- a/src/compile.c +++ b/src/compile.c @@ -4483,7 +4483,20 @@ CORD compile_statement_type_header(env_t *env, Path_t header_path, ast_t *ast) Path_t build_dir = Path$resolved(Path$parent(header_path), Path$current_dir()); switch (use->what) { case USE_MODULE: { - return CORD_all("#include <", use->path, "/", use->path, ".h>\n"); + glob_t tm_files; + if (glob(String(TOMO_PREFIX"/share/tomo/installed/", use->path, "/[!._0-9]*.tm"), GLOB_TILDE, NULL, &tm_files) != 0) + code_err(ast, "Could not find library"); + + CORD includes = CORD_EMPTY; + for (size_t i = 0; i < tm_files.gl_pathc; i++) { + const char *filename = tm_files.gl_pathv[i]; + Path_t tm_file = Path$from_str(filename); + Path_t lib_build_dir = Path$with_component(Path$parent(tm_file), Text(".build")); + Path_t header = Path$with_component(lib_build_dir, Texts(Path$base_name(tm_file), Text(".h"))); + includes = CORD_all(includes, "#include \"", Path$as_c_string(header), "\"\n"); + } + globfree(&tm_files); + return with_source_info(env, ast, includes); } case USE_LOCAL: { Path_t used_path = Path$resolved(Path$from_str(use->path), source_dir); |
