#!/bin/bash showvar() { ( grep -v Makefile Makefile; echo -e %.var:\\n\\t@echo $\($*\) ) | make -s -f - ${1}.var #<<'EOF' #include Makefile # #%.var: # @echo $($*) #EOF } STRING=$(showvar SRCFILES) echo -n $(showvar CINT) for file in ${STRING[@]}; do echo -ne \ ${1}/${file} done