I have a C application that I am converting from a set of manually crafted Makefiles to GNU AutoMake. It has a subdirectory that contains the interface header and several platform-dependent implementations. Currently, an implementation is selected and built for an object file with a fixed name in this directory. Code that uses the driver interface is then linked to this object file and automatically receives the correct driver.
What is the best way to convert this system to use AutoTools? I already have AutoConf creating a lookup for the correct driver implementation file. I just can't figure out how to get an AutoMake target whose variables EXTRA_*_SOURCESand *_LDADDI can put implementation files. Do I just need to drop the object intermediate file and put them on the list for the target program that uses them?
EDIT: Solved thanks to ptomato.
Because Automake dependencies are resolved, all possible sources must be named in *_SOURCESand EXTRA_*_SOURCES, as described in the conditional sources section of the manual . So actually the stanza of the library:
noinst_LIBRARIES = libdriver.a
libdriver_a_SOURCES = driver.h
EXTRA_libdriver_a_SOURCES = driver-linux.c driver-windows.c driver-osx.c
libdriver_a_LIBADD = @DRIVERIMPL@
source
share