title: Invoking bash commands in makefile
body: <p>Inside of a <code>makefile</code>, I'm trying to check if fileA was modified more recently than fileB. Using a few prior posts (<a href="https://stackoverflow.com/questions/589276/how-can-i-use-bash-syntax-in-makefile-targets">this</a> and <a href="https://stackoverflow.com/questions/4651437/how-to-set-a-variable-equal-to-the-output-from-a-command-in-bash">this</a>) as references, I've come up with this as an attempt to store the time since last file modification as a variable:</p>
  
  <p>(I'd rather this be in a function outside of a <code>make</code> recipe, but one step at a time.)</p>
  
  <pre><code>    .PHONY: all clean
  
      all      : (stuff happens here)
  
      radio    :
                BASE_MOD_TIME="$( expr $(date +%s) - $(date +%s -r src/radio_interface/profile_init.c) )"
                @echo "$(BASE_MOD_TIME)"
  </code></pre>
  
  <p>I thought that I would be assigning the output of the <code>expr</code> command to a variable, <code>BASE_MOD_TIME</code>, but the output is:</p>
  
  <pre><code>    bash-4.1$
      BASE_MOD_TIME=""
      echo ""
  </code></pre>
  
  <p>What am I doing wrong here? Simple attempts to save the output of <code>ls -l</code> also didn't work like this.</p>