libtool
generated files typically use the following layout: The .lo
file in a build
directory consisting of location metadata; the static object .o
files in the build
directory; and the PIC / shared .o
objects in the build/.libs
directory.
You can use the libtool compile mode. I'm not familiar with yasm, so you'll have to fill in the switches. It will run the yasm
build twice, once with -DPIC
(and maybe other shared object options).
libtool --tag=CC --mode=compile yasm <options> src.asm
If using automake, this may require an explicit rule for the .asm
files:
.asm.lo:
$(LIBTOOL) --tag=CC --mode=compile \
yasm <options> $<
Keep in mind that those are TABs in Makefiles, not (8) space characters!
You might also need to add: .SUFFIXES: .asm .lo
prior to this. I use the variable $(LIBTOOL)
, because some platforms (OSX for example) need to install it as glibtool
, and it's what Makefile.in
does.
The generated src.lo
, src.o
, .libs/src.o
should be respected by make clean
for example.
For your library libfoo
, you will need to let automake know about these sources with: EXTRA_libfoo_la_SOURCES = src.asm
, and obj deps with libfoo_la_LIBADD = src.lo
. It might be even be worthwhile adding to dependencies: libfoo_la_DEPENDENCIES = src.lo
.
Though I don't see why just putting src.asm
in libfoo_la_SOURCES
wouldn't be sufficient.