David Bruce <davidstuartbr...@gmail.com> 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 (r...@stanford.edu)             <http://www.eyrie.org/~eagle/>

Reply via email to