automake
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [BUG] nasm files are not processed in automake generated Makefiles


From: Alexandre Duret-Lutz
Subject: Re: [BUG] nasm files are not processed in automake generated Makefiles
Date: 24 Aug 2002 14:10:58 +0200
User-agent: Gnus/5.0808 (Gnus v5.8.8) Emacs/20.7

>>> "Edouard" == Edouard Gomez <address@hidden> writes:

[...]

 Edouard> The resulting Makefile looks like this

This looks fine.

[...]

 Edouard> So as i far as i understand the generated Makefile, to
 Edouard> build the libxvid lib, make should first create all
 Edouard> *.lo files. So it should find individual nasm file
 Edouard> targets and process them thanks to the .asm.lo
 Edouard> target. 

Yep.

 Edouard> But there's something wrong here because i obtain
 Edouard> that:

 Edouard> address@hidden:src] # make clean all
 Edouard> test -z "libxvid.la" || rm -f libxvid.la
 Edouard> rm -f "libxvid.la/so_locations"
 Edouard> rm -rf .libs _libs
 Edouard> rm -f *.o core *.core
 Edouard> rm -f *.lo

I don't know why the .lo files are not built here.

 Edouard> rpath /usr/local/lib  cpuid.lo cbp_mmx.lo cbp_sse2.lo fdct_mmx.lo 
idct_mmx.lo interpolate8x8_mmx.lo rgb_to_yv12_mmx.lo yuv_to_yv12_mmx.lo 
yuyv_to_yv12_mmx.lo yv12_to_rgb24_mmx.lo yv12_to_rgb32_mmx.lo 
yv12_to_yuyv_mmx.lo sad_mmx.lo quantize4_mmx.lo quantize_mmx.lo 
mem_transfer_mmx.lo interpolate8x8_xmm.lo sad_xmm.lo sad_sse2.lo 
interpolate8x8_3dn.lo sad_3dn.lo  

This is another bug.  The command is `$(LINK) -rpath /usr/local/lib ...'
but Automake forgot to define `$(LINK)'.

As a workaround you can add the following to your Makefile.am:

  # This tricks Automake so it defines the $(LINK) variable.
  EXTRA_PROGRAMS = fubar

 Edouard> make: rpath: Command not found
 Edouard> make: [libxvid.la] Error 127 (ignored)
 Edouard> ******** End of output ********

 Edouard> I've also run a single target to see if it was make
 Edouard> which was failing :

 Edouard> address@hidden:src] # make -d cpuid.lo
 Edouard> [...]
 Edouard> Reading makefile `Makefile'...
 Edouard> Updating makefiles....
 Edouard> Considering target file `Makefile'.
 Edouard> Finished prerequisites of target file `Makefile'.
 Edouard> No need to remake target `Makefile'.
 Edouard> Updating goal targets....
 Edouard> Considering target file `cpuid.lo'.
 Edouard> File `cpuid.lo' does not exist.
 Edouard> Looking for an implicit rule for `cpuid.lo'.
 Edouard> [...]
 Edouard> Trying implicit prerequisite `cpuid.asm'.
 Edouard> Looking for a rule with intermediate file `cpuid.asm'.
 Edouard> [...]
 Edouard> Finished prerequisites of target file 
`../src/utils/x86_asm/cpuid.asm'.
 Edouard> No need to remake target `../src/utils/x86_asm/cpuid.asm'.
 Edouard> Finished prerequisites of target file `cpuid.lo'.
 Edouard> Must remake target `cpuid.lo'.
 Edouard> Successfully remade target file `cpuid.lo'.
 Edouard> make: Nothing to be done for `cpuid.lo'.
 Edouard> ******** End of output ********

I don't really understand why they are not built.  They ouhgt to be.
I've made a short test-case based on what you've shown (I'm just using
`gcc' instead of `nasm' so that I don't have to play with the -fPIC hack)
and it works fine:

| EXTRA_PROGRAMS = foo
| 
| SRC_INTEL = $(top_srcdir)/cpuid.asm
| 
| lib_LTLIBRARIES = libxvid.la
| 
| SUFFIXES = .asm
| 
| libxvid_la_SOURCES = $(SRC_INTEL)
| 
| .asm.lo:
|         $(LIBTOOL) --mode=compile gcc -x c -c $< -o $@

(For the test cpuid.asm is an empty file)

% make
/bin/sh ./libtool --mode=compile gcc -x c -c cpuid.asm -o cpuid.lo
mkdir .libs
gcc -x c -c cpuid.asm  -fPIC -DPIC -o .libs/cpuid.lo
gcc -x c -c cpuid.asm -o cpuid.o >/dev/null 2>&1
mv -f .libs/cpuid.lo cpuid.lo
/bin/sh ./libtool --mode=link gcc  -g -O2   -o libxvid.la -rpath /usr/local/lib 
 cpuid.lo  
rm -fr .libs/libxvid.la .libs/libxvid.* .libs/libxvid.*
gcc -shared  cpuid.lo   -Wl,-soname -Wl,libxvid.so.0 -o .libs/libxvid.so.0.0.0
(cd .libs && rm -f libxvid.so.0 && ln -s libxvid.so.0.0.0 libxvid.so.0)
(cd .libs && rm -f libxvid.so && ln -s libxvid.so.0.0.0 libxvid.so)
ar cru .libs/libxvid.a  cpuid.o 
ranlib .libs/libxvid.a
creating libxvid.la
(cd .libs && rm -f libxvid.la && ln -s ../libxvid.la libxvid.la)

Here is the configure.ac I used.

AC_INIT([nasm], [1.0])
AM_INIT_AUTOMAKE
AC_PROG_CC
AC_PROG_LIBTOOL
AC_CONFIG_FILES([Makefile])
AC_OUTPUT

Could you try start from this minimalist test case and modify it
until it fails?
-- 
Alexandre Duret-Lutz





reply via email to

[Prev in Thread] Current Thread [Next in Thread]