Subject: Re: bug#79466: 31.0.50; Build in a separate directory

From: Eli Zaretskii <[email-masked]>
Date: Thu, 18 Sep 2025 12:24:27 +0300

> From: Helmut Eller <[email-masked]>
> Date: Thu, 18 Sep 2025 10:01:19 +0200
> 
> The file INSTALL under 3b) says that it should be possible to build in a
> separate directory.  However this doesn't seem to work.  I did something
> like
> 
>   cd /tmp
>   mkdir build
>   cd build
>   /path/to/source/configure -C CFLAGS="-O0 -g3
>   make
> 
> After some progress this aborts with:
> 
>   ...
>   GEN      ../etc/DOC
> /usr/bin/ld: cannot find dispnew.o: No such file or directory
> /usr/bin/ld: cannot find frame.o: No such file or directory
> /usr/bin/ld: cannot find scroll.o: No such file or directory
>   ...

You need to make sure the source tree is free from the artifacts of a
previous build.  Did you do that?

> It seems that changing the .c.o rule in src/Makefile like so
> 
>  .c.o:
> -       $(AM_V_CC)$(CC) -c $(CPPFLAGS) $(ALL_CFLAGS) $(PROFILING_CFLAGS) $<
> +       $(AM_V_CC)$(CC) -c $(CPPFLAGS) $(ALL_CFLAGS) $(PROFILING_CFLAGS) $< -o $@
> 
> allows the build to complete.  However the .elc files still end up in
> the source directory.  This might actually be useful, but I'm not sure
> that it's intended.
> 
> Should we fix this?

Shouldn't be needed, since VPATH should take care of that.  But if
some products of a build are in the source tree, Make could be fooled.