summaryrefslogtreecommitdiff
path: root/src/logic/linkcmd
diff options
context:
space:
mode:
authormidipix <writeonce@midipix.org>2024-03-09 00:08:37 +0000
committermidipix <writeonce@midipix.org>2024-03-09 00:10:46 +0000
commit6ccc20a339c59993709ecacf79e4011c0493d3b2 (patch)
treee9e10470bb88d70d969b512ed666ffbe8e132f7c /src/logic/linkcmd
parent2b6d0b31bf96c4476ed5248f71ff1d109818b20a (diff)
downloadslibtool-6ccc20a339c59993709ecacf79e4011c0493d3b2.tar.bz2
slibtool-6ccc20a339c59993709ecacf79e4011c0493d3b2.tar.xz
slbt_exec_link_create_dep_file(): store dependency trace information.
Diffstat (limited to 'src/logic/linkcmd')
-rw-r--r--src/logic/linkcmd/slbt_linkcmd_deps.c38
1 files changed, 38 insertions, 0 deletions
diff --git a/src/logic/linkcmd/slbt_linkcmd_deps.c b/src/logic/linkcmd/slbt_linkcmd_deps.c
index 4a33b98..147103c 100644
--- a/src/logic/linkcmd/slbt_linkcmd_deps.c
+++ b/src/logic/linkcmd/slbt_linkcmd_deps.c
@@ -353,6 +353,7 @@ slbt_hidden int slbt_exec_link_create_dep_file(
char * mark;
char * base;
size_t size;
+ bool fdep;
char deplib [PATH_MAX];
bool is_reladir;
char reladir[PATH_MAX];
@@ -378,6 +379,21 @@ slbt_hidden int slbt_exec_link_create_dep_file(
if ((deps = openat(fdcwd,depfile,O_RDWR|O_CREAT|O_TRUNC,0644)) < 0)
return SLBT_SYSTEM_ERROR(dctx,depfile);
+ /* informational header */
+ if (slbt_realpath(fdcwd,"./",0,reladir,sizeof(reladir)) < 0)
+ return SLBT_SYSTEM_ERROR(dctx,0);
+
+ if (slbt_dprintf(deps,
+ "# makefile target: %s\n"
+ "# slibtool target: %s\n"
+ "# cprocess fdcwd: %s\n",
+ dctx->cctx->output,
+ libfilename,
+ reladir) < 0)
+ return SLBT_SYSTEM_ERROR(dctx,0);
+
+ fdep = 0;
+
/* iterate */
for (parg=altv; *parg; parg++) {
popt = 0;
@@ -386,10 +402,30 @@ slbt_hidden int slbt_exec_link_create_dep_file(
mapinfo = 0;
if (!strncmp(*parg,"-l",2)) {
+ if (fdep) {
+ if (slbt_dprintf(
+ deps,
+ "#\n# makefile target: %s\n",
+ dctx->cctx->output) < 0)
+ return SLBT_SYSTEM_ERROR(dctx,0);
+
+ fdep = false;
+ }
+
popt = *parg;
plib = popt + 2;
} else if (!strncmp(*parg,"-L",2)) {
+ if (fdep) {
+ if (slbt_dprintf(
+ deps,
+ "#\n# makefile target: %s\n",
+ dctx->cctx->output) < 0)
+ return SLBT_SYSTEM_ERROR(dctx,0);
+
+ fdep = false;
+ }
+
popt = *parg;
path = popt + 2;
@@ -398,6 +434,8 @@ slbt_hidden int slbt_exec_link_create_dep_file(
} else if ((popt = strrchr(*parg,'.')) && !strcmp(popt,".la")) {
/* import dependency list */
+ fdep = true;
+
if ((base = strrchr(*parg,'/')))
base++;
else