I'm using make to grab a set of files that are updated daily on a Web site. What I'd like to do is place the files into a folder named with the date, and then use make to do other processing on the file. I tried this:SUFFIXES = .csvFILES = file1.csv file2.csv file3.csvBASE_DIR = some/dirDATE = $(shell date +%Y%m%d)SOURCE_FILES = $(patsubst %,$(BASE_DIR)/$(DATE)/%,$(FILES))ACTIVE_FILES = $(patsubst %,$(BASE_DIR)/%,$(FILES))all: $(BASE_DIR)/$(DATE) $(ACTIVE_FILES)$(BASE_DIR)/%.csv: $(BASE_DIR)/$(DATE)/%.csv    rm -f $@    ln $(BASE_DIR)/$(DATE)/%$(BASE_DIR)/$(DATE):    mkdir $@$(BASE_DIR)/$(DATE)/%.csv:    cd $(BASE_DIR)/$(DATE); wget http://example.com/data/%.csvThe problem is the last line. I don't know how to pass the filename to wget, since %.csv isn't valid in this context. How do I accomplish what I'm after?
Calling wget from make based on a pattern
make;wget
I believe you want to use automatic variable $*. From GNU make's documentation:$*The stem with which an implicit rule matches. If the target is  dir/a.foo.b and the target pattern is a.%.b then the stem is  dir/foo. The stem is useful for constructing names of related  files.  In a static pattern rule, the stem is part of the file name  that matched the % in the target pattern.In your specific case, the wget rule could be rewritten as:$(BASE_DIR)/$(DATE)/%.csv:    cd $(BASE_DIR)/$(DATE); wget http://example.com/data/$*.csv