假设我有以下文件:
def addTimeEntry(request, userId):
if request.POST:
form = EntryTimeForm(request.POST)
if form.is_valid():
form.instance.user_id = userId
form.save()
return redirect('some_view')
else:
form = EntryTimeForm()
args={'form': form}
return render(request, 'timesheets/addTimeEntry.html', args)
以及以下生成文件:
// name: listfile
one
two
three
如果我运行
.PHONY: foo
foo: $(foreach member,$(shell cat listfile),bar-$(member))
bar-%:
@echo "bar-$*"
现在,我要抽象$: make foo
bar-one
bar-two
bar-three
的名称,以便我写:
listfile
但是,我尝试过的每个语义排列都失败了。有没有办法动态计算此规则列表?
答案 0 :(得分:1)
您可以使用secondary expansion:
.SECONDEXPANSION:
foo-%: $$(foreach member,$$(shell cat $$*),bar-$$(member))
...。我认为。尚未实际测试:)