automake
[Top][All Lists]
Advanced

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

Re: Using shell code within Makefile.am


From: Russ Allbery
Subject: Re: Using shell code within Makefile.am
Date: Tue, 05 Apr 2011 19:46:25 -0700
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.2 (gnu/linux)

David Bruce <address@hidden> writes:

> Snippet from install-nsi-local target in Makefile.am:
> -----------------------------------------

> ## Convert text files from Unix format DOS/Windows format and rename
> ## them with ".txt" extension:
>       (cd $(top_builddir)/$(NSI_INSTALL_DIR)/doc; \
>       FILES=`find . -type f`; \       
>       for file in $(FILES); do \
>           echo "Processing "$(file); \
>           todos -p $(file); \
>           mv $(file) $(file)".txt"; \
>       done)

> But it doesn't work - I think because the 'FILES' and 'file' variables
> aren't available when the subshells are spawned to run the commands.

You're mixing together a couple types of variables.  $FILES and $file are
shell variables, not Makefile variables, so you need to escape the $ so
that make doesn't expand them and lets the shell expand them.

        (cd $(top_builddir)/$(NSI_INSTALL_DIR)/doc; \
        FILES=`find . -type f`; \       
        for file in $$FILES; do \
            echo "Processing "$$file; \
            todos -p $$file; \
            mv $$file $$file".txt"; \
        done)

-- 
Russ Allbery (address@hidden)             <http://www.eyrie.org/~eagle/>



reply via email to

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