On Mon, 2009-11-23 at 22:21 -0600, Peng Yu wrote: > $(wildcard *.py) > > Suppose that I have the above list of file names. I want to replace > any .py file by the coresponding .sh file if it exists. > > That is, > > If I have the following files, > > a.py a.sh b.py > > I want to get the following files > > a.sh b.py > > Could somebody show me how to do it?
PY_FILES := $(patsubst %.py,%,$(wildcard *.py)) SH_FILES := $(foreach F,$(PYFILES),$(if $(wildcard $F.sh),$F.sh,$F.py)) something like that should work. -- ------------------------------------------------------------------------------- Paul D. Smith <[email protected]> Find some GNU make tips at: http://www.gnu.org http://make.mad-scientist.net "Please remain calm...I may be mad, but I am a professional." --Mad Scientist _______________________________________________ Help-make mailing list [email protected] http://lists.gnu.org/mailman/listinfo/help-make
