]> git.ozlabs.org Git - ccan/blobdiff - tools/manifest.c
manifest: Print the directory name if no files are found
[ccan] / tools / manifest.c
index 9a8c4cd097d9632387032ad2366ac438e17c1d97..3494937a4009b1b7dad69eb9efe268e9e44fe1ad 100644 (file)
@@ -112,8 +112,8 @@ static void add_files(struct manifest *m, const char *base, const char *subdir)
                f = new_ccan_file(m, m->dir,
                                  subdir ? path_join(m, subdir, ent->d_name)
                                  : ent->d_name);
-               if (lstat(f->fullname, &st) != 0)
-                       err(1, "lstat %s", f->fullname);
+               if (stat(f->fullname, &st) != 0)
+                       err(1, "stat %s", f->fullname);
 
                if (S_ISDIR(st.st_mode)) {
                        size_t len = tal_count(subs);
@@ -167,10 +167,17 @@ static void add_files(struct manifest *m, const char *base, const char *subdir)
                if (!m->info_file
                    && list_empty(&m->c_files)
                    && list_empty(&m->h_files))
-                       errx(1, "No _info, C or H files found here!");
-
-               for (i = 0; i < tal_count(subs); i++)
-                       add_files(m, base, subs[i]);
+                       errx(1, "No _info, C or H files found in %s", thisdir);
+
+               /* Don't enter subdirs with _info: they're separate modules. */
+               for (i = 0; i < tal_count(subs); i++) {
+                       struct stat st;
+                       char *subinfo = path_join(subs, base,
+                                                 path_join(subs, subs[i],
+                                                           "_info"));
+                       if (lstat(subinfo, &st) != 0)
+                               add_files(m, base, subs[i]);
+               }
        }
        tal_free(subs);
 }