History

kbuild: allow docproc invocation from external

- getcwd returns path without a slash at the end, add the slash - add KBUILD_SRC env support, so that we can specify path for kernel (to know where scripts/kernel-doc resides) and SRCTREE (for searching files referenced in .tmpl) separately [v2] - use KBUILD_SRC instead of a newly introduced environment variable

Jiri Slaby committed 17 years ago

Commit 2d510051 parent cefdff41 file · +9 −4Browse files

Showing the changes to scripts/basic (1 of 1 file). Show all

Unified · Split

scripts/basic/docproc.c+9−4
@@ -69,7 +69,7 @@ FILELINE * docsection; · 68 unmodified lines
69#define NOFUNCTION "-nofunction"69#define NOFUNCTION "-nofunction"
70#define NODOCSECTIONS "-no-doc-sections"70#define NODOCSECTIONS "-no-doc-sections"
71 71
72char *srctree;72static char *srctree, *kernsrctree;
73 73
74void usage (void)74void usage (void)
75{75{
@@ -77,7 +77,8 @@ void usage (void) · 1 unmodified line
77 fprintf(stderr, "Input is read from file.tmpl. Output is sent to stdout\n");77 fprintf(stderr, "Input is read from file.tmpl. Output is sent to stdout\n");
78 fprintf(stderr, "doc: frontend when generating kernel documentation\n");78 fprintf(stderr, "doc: frontend when generating kernel documentation\n");
79 fprintf(stderr, "depend: generate list of files referenced within file\n");79 fprintf(stderr, "depend: generate list of files referenced within file\n");
80 fprintf(stderr, "Environment variable SRCTREE: absolute path to kernel source tree.\n");80 fprintf(stderr, "Environment variable SRCTREE: absolute path to sources.\n");
81 fprintf(stderr, " KBUILD_SRC: absolute path to kernel source tree.\n");
81}82}
82 83
83/*84/*
@@ -96,8 +97,8 @@ void exec_kernel_doc(char **svec) · 12 unmodified lines
96 exit(1);97 exit(1);
97 case 0:98 case 0:
98 memset(real_filename, 0, sizeof(real_filename));99 memset(real_filename, 0, sizeof(real_filename));
99 strncat(real_filename, srctree, PATH_MAX);100 strncat(real_filename, kernsrctree, PATH_MAX);
100 strncat(real_filename, KERNELDOCPATH KERNELDOC,101 strncat(real_filename, "/" KERNELDOCPATH KERNELDOC,
101 PATH_MAX - strlen(real_filename));102 PATH_MAX - strlen(real_filename));
102 execvp(real_filename, svec);103 execvp(real_filename, svec);
103 fprintf(stderr, "exec ");104 fprintf(stderr, "exec ");
@@ -178,6 +179,7 @@ void find_export_symbols(char * filename) · 74 unmodified lines
178 char real_filename[PATH_MAX + 1];179 char real_filename[PATH_MAX + 1];
179 memset(real_filename, 0, sizeof(real_filename));180 memset(real_filename, 0, sizeof(real_filename));
180 strncat(real_filename, srctree, PATH_MAX);181 strncat(real_filename, srctree, PATH_MAX);
182 strncat(real_filename, "/", PATH_MAX - strlen(real_filename));
181 strncat(real_filename, filename,183 strncat(real_filename, filename,
182 PATH_MAX - strlen(real_filename));184 PATH_MAX - strlen(real_filename));
183 sym = add_new_file(filename);185 sym = add_new_file(filename);
@@ -382,6 +384,9 @@ int main(int argc, char *argv[]) · 198 unmodified lines
382 srctree = getenv("SRCTREE");384 srctree = getenv("SRCTREE");
383 if (!srctree)385 if (!srctree)
384 srctree = getcwd(NULL, 0);386 srctree = getcwd(NULL, 0);
387 kernsrctree = getenv("KBUILD_SRC");
388 if (!kernsrctree)
389 kernsrctree = srctree;
385 if (argc != 3) {390 if (argc != 3) {
386 usage();391 usage();
387 exit(1);392 exit(1);