Commit 111cf588 authored by Tom Rini's avatar Tom Rini Committed by Sam Ravnborg

kbuild: fix 'htmldocs' and friends with O=

The following patch fixes up 'htmldocs' and related to work when
trees are being built with O=.  I fixed it all up by passing the srctree
as an env-var to docproc (and thus what it calls) and then pull that out
when needed.
Signed-off-by: default avatarTom Rini <trini@kernel.crashing.org>
Signed-off-by: default avatarSam Ravnborg <sam@ravnborg.org>
parent 98d80463
...@@ -58,14 +58,14 @@ MAKEMAN = $(PERL) $(srctree)/scripts/makeman ...@@ -58,14 +58,14 @@ MAKEMAN = $(PERL) $(srctree)/scripts/makeman
# The following rules are used to generate the .sgml documentation # The following rules are used to generate the .sgml documentation
# required to generate the final targets. (ps, pdf, html). # required to generate the final targets. (ps, pdf, html).
quiet_cmd_docproc = DOCPROC $@ quiet_cmd_docproc = DOCPROC $@
cmd_docproc = $(DOCPROC) doc $< >$@ cmd_docproc = SRCTREE=$(srctree)/ $(DOCPROC) doc $< >$@
define rule_docproc define rule_docproc
set -e; \ set -e; \
$(if $($(quiet)cmd_$(1)),echo ' $($(quiet)cmd_$(1))';) \ $(if $($(quiet)cmd_$(1)),echo ' $($(quiet)cmd_$(1))';) \
$(cmd_$(1)); \ $(cmd_$(1)); \
( \ ( \
echo 'cmd_$@ := $(cmd_$(1))'; \ echo 'cmd_$@ := $(cmd_$(1))'; \
echo $@: `$(DOCPROC) depend $<`; \ echo $@: `SRCTREE=$(srctree) $(DOCPROC) depend $<`; \
) > $(dir $@).$(notdir $@).cmd ) > $(dir $@).$(notdir $@).cmd
endef endef
...@@ -129,6 +129,9 @@ quiet_cmd_db2html = DB2HTML $@ ...@@ -129,6 +129,9 @@ quiet_cmd_db2html = DB2HTML $@
# Rule to generate man files - output is placed in the man subdirectory # Rule to generate man files - output is placed in the man subdirectory
%.9: %.sgml %.9: %.sgml
ifneq ($(KBUILD_SRC),)
$(Q)mkdir -p $(objtree)/Documentation/DocBook/man
endif
$(SPLITMAN) $< $(objtree)/Documentation/DocBook/man "$(VERSION).$(PATCHLEVEL).$(SUBLEVEL)" $(SPLITMAN) $< $(objtree)/Documentation/DocBook/man "$(VERSION).$(PATCHLEVEL).$(SUBLEVEL)"
$(MAKEMAN) convert $(objtree)/Documentation/DocBook/man $< $(MAKEMAN) convert $(objtree)/Documentation/DocBook/man $<
......
...@@ -79,6 +79,7 @@ void exec_kernel_doc(char **svec) ...@@ -79,6 +79,7 @@ void exec_kernel_doc(char **svec)
{ {
pid_t pid; pid_t pid;
int ret; int ret;
char real_filename[PATH_MAX + 1];
/* Make sure output generated so far are flushed */ /* Make sure output generated so far are flushed */
fflush(stdout); fflush(stdout);
switch(pid=fork()) { switch(pid=fork()) {
...@@ -86,8 +87,13 @@ void exec_kernel_doc(char **svec) ...@@ -86,8 +87,13 @@ void exec_kernel_doc(char **svec)
perror("fork"); perror("fork");
exit(1); exit(1);
case 0: case 0:
execvp(KERNELDOCPATH KERNELDOC, svec); memset(real_filename, 0, sizeof(real_filename));
perror("exec " KERNELDOCPATH KERNELDOC); strncat(real_filename, getenv("SRCTREE"), PATH_MAX);
strncat(real_filename, KERNELDOCPATH KERNELDOC,
PATH_MAX - strlen(real_filename));
execvp(real_filename, svec);
fprintf(stderr, "exec ");
perror(real_filename);
exit(1); exit(1);
default: default:
waitpid(pid, &ret ,0); waitpid(pid, &ret ,0);
...@@ -160,12 +166,17 @@ void find_export_symbols(char * filename) ...@@ -160,12 +166,17 @@ void find_export_symbols(char * filename)
struct symfile *sym; struct symfile *sym;
char line[MAXLINESZ]; char line[MAXLINESZ];
if (filename_exist(filename) == NULL) { if (filename_exist(filename) == NULL) {
char real_filename[PATH_MAX + 1];
memset(real_filename, 0, sizeof(real_filename));
strncat(real_filename, getenv("SRCTREE"), PATH_MAX);
strncat(real_filename, filename,
PATH_MAX - strlen(real_filename));
sym = add_new_file(filename); sym = add_new_file(filename);
fp = fopen(filename, "r"); fp = fopen(real_filename, "r");
if (fp == NULL) if (fp == NULL)
{ {
fprintf(stderr, "docproc: "); fprintf(stderr, "docproc: ");
perror(filename); perror(real_filename);
} }
while(fgets(line, MAXLINESZ, fp)) { while(fgets(line, MAXLINESZ, fp)) {
char *p; char *p;
......
...@@ -1531,7 +1531,7 @@ sub process_state3_type($$) { ...@@ -1531,7 +1531,7 @@ sub process_state3_type($$) {
} }
sub process_file($) { sub process_file($) {
my ($file) = @_; my ($file) = "$ENV{'SRCTREE'}@_";
my $identifier; my $identifier;
my $func; my $func;
my $initial_section_counter = $section_counter; my $initial_section_counter = $section_counter;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment