[colug-432] Makefile Help

Rick Troth rmt at casita.net
Sun Jul 28 21:20:41 EDT 2013


Remember that each step in the recipe is executed independently. Shell
state is not preserved from step to step.

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.
On Jul 28, 2013 9:04 PM, "Joshua Kramer" <joskra42.list at gmail.com> wrote:

> Hello Colug,
>
> Does anyone know how to test for a file's presence and set a Make variable
> accordingly?
>
> 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:
>
> # Test for presence of /etc/redhat-release:
> which-version:  $(DEFS)
>         export DEFS=-DDEF_REMOTE_IP=client_ip;
>         if test -f /etc/redhat-release; then \
>          echo RedhatRelease is present. ; \
>          export DEFS=-DDEF_REMOTE_IP=remote_ip; \
>         fi;
>         echo DEFS is "$(DEFS)"
>
> $(DEFS) is never getting set.  What am I doing wrong?
>
> Thanks!
> -JK
>
> _______________________________________________
> colug-432 mailing list
> colug-432 at colug.net
> http://lists.colug.net/mailman/listinfo/colug-432
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.colug.net/pipermail/colug-432/attachments/20130728/c33797bd/attachment.html 


More information about the colug-432 mailing list