Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>What we need here is two (or more) versions of <code>c.o</code>, compiled with different flags and to be linked into different executables. You could do this with contrived filenames like <code>c_for_a.o</code>, but it's tidier to keep them in different directories, <code>for_a/</code> and <code>for_b/</code>:</p> <pre><code>a for_a/%: CFLAGS = a: a.o for_a/c.o b for_b/%: CFLAGS = -mno-cygwin b: b.o for_b/c.o </code></pre> <p>(If this isn't clear I can fill in the rest of the Makefile.)</p> <p><b>EDIT:</b><br> If you don't want to keep multiple <code>c.o</code>'s, you will have to recompile c.o sometimes. There is a small improvement possible on the <code>checkTarget</code> idea.</p> <p>When you are building a target like <code>b</code>, and <code>c.o</code> already exists, it matters whether that <code>c.o</code> was built with the <code>CFLAGS</code> suited to <code>b</code>, and you use <code>checkTarget</code> to record that information. <em>But you don't care what <code>CFLAGS</code> were used, only whether they were <code>b</code>'s <code>CFLAGS</code></em>. So you don't have to record anything in the <code>checkTarget</code> file, just update it when you build a new target:</p> <pre><code>a: CFLAGS = b: CFLAGS = -mno-cygwin # You may be able to combine the a and b rules... a: a.o c.o checkTarget # build c.o touch checkTarget # build the target b: b.o c.o checkTarget # build c.o touch checkTarget # build the target # Need this to create checkTarget the first time checkTarget: @touch $@ </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
 

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