Note that there are some explanatory texts on larger screens.

plurals
  1. POExplicit Intermediate Object Files in GNU AutoMake
    text
    copied!<p>I have a C application I'm converting from a set of hand coded Makefiles to GNU AutoMake. It has a subdirectory that contains an interface header and several platform-dependent implementations. Currently an implementation is selected and built to an object file with a fixed name in that directory. The code that uses the driver interface then links against that object file and automagically gets the right driver.</p> <p>What's the best way to convert this system to use AutoTools? I already have AutoConf creating a substitution for the correct driver implementation file. I just can't figure out how to get an AutoMake target whose <code>EXTRA_*_SOURCES</code> and <code>*_LDADD</code> variables I can put the implementation files in. Do I just need to give up on the intermediate object file and put them in the list for the program target that uses them?</p> <p><strong>EDIT:</strong> Solved thanks to ptomato.</p> <p>Because of Automake's dependency resolution all possible sources must be named in <code>*_SOURCES</code> and <code>EXTRA_*_SOURCES</code>, as explained in <a href="http://www.gnu.org/software/automake/manual/html_node/Conditional-Sources.html" rel="nofollow noreferrer">the Conditional Sources section of the manual</a>. Therefore, the library stanza is actually:</p> <pre><code>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@ </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload