<p>Remember that each step in the recipe is executed independently. Shell state is not preserved from step to step. </p>
<p>You could inline the test (so it becomes part of a longer command. You could store the result of the test (or opts formed from it) in an intermediate file. Lots if ways to skin this cat. </p>
<div class="gmail_quote">On Jul 28, 2013 9:04 PM, "Joshua Kramer" <<a href="mailto:joskra42.list@gmail.com">joskra42.list@gmail.com</a>> wrote:<br type="attribution"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div dir="ltr"><div><div><div>Hello Colug,<br><br>Does anyone know how to test for a file's presence and set a Make variable accordingly?<br><br></div>I have an apache module that needs one of two structure elements, depending on whether it's 2.2 or 2.4. I have the following function in my makefile:<br>
<br># Test for presence of /etc/redhat-release:<br>which-version: $(DEFS)<br> export DEFS=-DDEF_REMOTE_IP=client_ip;<br> if test -f /etc/redhat-release; then \<br> echo RedhatRelease is present. ; \<br>
export DEFS=-DDEF_REMOTE_IP=remote_ip; \<br> fi;<br> echo DEFS is "$(DEFS)"<br><br></div>$(DEFS) is never getting set. What am I doing wrong?<br><br>Thanks!<br></div>-JK<br></div>
<br>_______________________________________________<br>
colug-432 mailing list<br>
<a href="mailto:colug-432@colug.net">colug-432@colug.net</a><br>
<a href="http://lists.colug.net/mailman/listinfo/colug-432" target="_blank">http://lists.colug.net/mailman/listinfo/colug-432</a><br>
<br></blockquote></div>