Hello,

I've encountered a problem where GNU Hello build fails with a cross compiler, 
after the switch to non-recursive make
(of course there's no reason to need GNU hello cross-compiled, but my project 
is based on GNU hello's build system).

If I use:
    ./configure --host=arm-linux-gnueabi

Then 'make' fails in the man-page step:
    <...>
    make[2]: Entering directory 
'/home/gordon/projects/hello/temp/hello-2.9.38-6bac'
    : --include=./man/hello.x ./hello -o hello.1-t
    chmod a=r hello.1-t
    chmod: cannot access 'hello.1-t': No such file or directory
    Makefile:2605: recipe for target 'hello.1' failed
    make[2]: *** [hello.1] Error 1
    make[2]: Leaving directory 
'/home/gordon/projects/hello/temp/hello-2.9.38-6bac'
    Makefile:1872: recipe for target 'all-recursive' failed
    make[1]: *** [all-recursive] Error 1
    make[1]: Leaving directory 
'/home/gordon/projects/hello/temp/hello-2.9.38-6bac'
    Makefile:1407: recipe for target 'all' failed
    make: *** [all] Error 2
If I trace it back correctly, then "configure" has this statement:
    if test $cross_compiling = no; then :
      HELP2MAN=${HELP2MAN-"${am_missing_run}help2man"}
    else
      HELP2MAN=:
    fi

Which makes HELP2MAN a no-op in a cross-compile, but the rule in "Makefile.am" 
is:
    hello.1: hello
            $(HELP2MAN) --include=$(top_srcdir)/man/hello.x 
$(top_builddir)/hello -o $@-t
            chmod a=r $@-t
            mv -f $@-t $@

Which assumes "HELP2MAN" will always run, and re-generate "hello.1".

I suspect this rule needs to be a bit more complicated, to accommodate few 
possibilities:
1. Native compiling from GIT repository, where "hello.1" doesn't exist (yet) and "hello" 
can be executed - then "hello.1" can be generated.
2. Native compiling from tarball, where "hello.1" already exists (due to 'make dist') and 
"hello" can be executed - then either re-generate "hello.1" or not ?
3. Cross-compiling from GIT repository, "hello.1" doesn't exist but "hello" *can not* be 
executed - ignore and use empty "hello.1" ?
4. Cross-compiling from tarball, where "hello.1" exists but "hello" *can not* be executed - use 
existing "hello.1" (despite it being older than "hello", which might confuse the make target?) .


The following hack "works for me", thought I haven't thoroughly tested:

    hello.1: hello
            $(HELP2MAN) --include=$(top_srcdir)/man/hello.x 
$(top_builddir)/hello -o $@-t
            if test -e $@-t ; then \
              chmod a=r $@-t ;\
              mv -f $@-t $@ ;\
            elif ! test -e $@ ; then \
              touch $@ ; \
            fi

(If the new temp man-page was created, override any existing man page. If not 
created, and no existing man page, create an empty one).



For comparison, the last tarball release of GNU Hello version 2.9 which still 
uses recursive makefiles compiles fine under cross-compiler.

Thanks for reading so far,
 - Assaf.

Reply via email to