shell - Makefile loop results from ls command -


i have list of text files, when executing following command:

ls *.txt 

will result in like:

foo.txt bar.txt baz.txt 

now if want have output like:

file: foo.txt file: bar.txt file: baz.txt 

how achieve in makefile?

i've been trying:

txtfiles = $$(ls *.txt)  list: $(txtfiles)  $(txtfiles):     echo "file:" $@ 

but when running make list, results with:

file: $ file: $ 

i thinking of trying achieve using placeholders % wasn't sure how that.

note: instead of $$(ls *.txt) i'm guessing use $(wildcard *.txt) ?

note: instead of $$(ls *.txt) i'm guessing use $(wildcard *.txt)?

you have to.

also add .phony: $(txtfiles) before $(txtfiles): rule make explicit request.


Comments

Popular posts from this blog

android - Gradle sync Error:Configuration with name 'default' not found -

java - Andrioid studio start fail: Fatal error initializing 'null' -

html - jQuery UI Sortable - Remove placeholder after item is dropped -