help-make
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Problems with empty macros.


From: Raja R Harinath
Subject: Re: Problems with empty macros.
Date: Fri, 26 Sep 2003 18:41:44 -0500
User-agent: Gnus/5.1003 (Gnus v5.10.3) Emacs/21.3.50 (gnu/linux)

"Paul D. Smith" <address@hidden> writes:
[snip]
> You can add a dummy file into your for-loop then check for it, like
> this:
>
>   install_target1: $(SRC_FILES)
>         $(INS) ...
>         for i in / $(SRC_FILES) ; do \
>           case $$i in /) continue ;; esac; \
>           echo "Installing $$i"; \
>             ...; \
>         done
>
> Or, you can test before the for loop:
>
>   install_target1: $(SRC_FILES)
>         $(INS) ...
>         if [ -n "$(SRC_FILES)" ]; then \
>           for i in $(SRC_FILES) ; do \
>             echo "Installing $$i"; \
>               ...; \
>           done; \
>         fi

Almost :-)  (This is still off-topic, but one more piece of trivia...)

Some shells complain about syntax errors in this use of 'for' too.  Try

  install_target1: $(SRC_FILES)
        $(INS) ...
        if [ -n "$(SRC_FILES)" ]; then \
          for i in ''$(SRC_FILES) ; do \
            echo "Installing $$i"; \
              ...; \
          done; \

For those playing find the difference:

 - for i in $(SRC_FILES)
 + for i in ''$(SRC_FILES)

The '[ -n "$(SRC_FILES)" ]' check is still needed.

- Hari
-- 
Raja R Harinath ------------------------------ address@hidden





reply via email to

[Prev in Thread] Current Thread [Next in Thread]