diff options
author | Jiri Slaby <jirislaby@gmail.com> | 2009-05-31 12:05:34 -0400 |
---|---|---|
committer | Sam Ravnborg <sam@ravnborg.org> | 2009-06-09 16:37:44 -0400 |
commit | 2d51005c27a12e43d672debbbb918e7f74987f96 (patch) | |
tree | 41a1761f96a1be1b86ba261e12c3a2f3e7bdf1f2 | |
parent | cefdff4b4d5ba3f9b7eee2c1c1827553794cb465 (diff) |
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
Signed-off-by: Jiri Slaby <jirislaby@gmail.com>
Acked-by: Randy Dunlap <randy.dunlap@oracle.com>
Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
-rw-r--r-- | scripts/basic/docproc.c | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/scripts/basic/docproc.c b/scripts/basic/docproc.c index 35bdc68b6e66..4c9523ef9c00 100644 --- a/scripts/basic/docproc.c +++ b/scripts/basic/docproc.c | |||
@@ -69,7 +69,7 @@ FILELINE * docsection; | |||
69 | #define NOFUNCTION "-nofunction" | 69 | #define NOFUNCTION "-nofunction" |
70 | #define NODOCSECTIONS "-no-doc-sections" | 70 | #define NODOCSECTIONS "-no-doc-sections" |
71 | 71 | ||
72 | char *srctree; | 72 | static char *srctree, *kernsrctree; |
73 | 73 | ||
74 | void usage (void) | 74 | void usage (void) |
75 | { | 75 | { |
@@ -77,7 +77,8 @@ void usage (void) | |||
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) | |||
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) | |||
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[]) | |||
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); |