makefile - Matching % in a path -
how can make target match this:
efl_class_bundles = \ efl_class_returnszero \ efl_class_cmd_regcmp \ efl_class_expression .phony: $(efl_class_bundles) $(efl_class_bundles): version syntax \ test/$@/efl_main.json \ test/$@/01_$@.json \ test/$@/02_efl_test_simple.json prove t/efl_class_$@_csv.t prove t/efl_class_$@_json.t test/%/efl_main.json: test/%/efl_main.csv $(csvtojson) -b efl_main < $< > $@ perl -pi -e 's/csv/json/' $@
when attempt 'make efl_class_returnszero' following error, suggests me prerequisite test/$@/efl_main.json cannot match target 'test/%/efl_main.json' han can make work?
prove t/00_version.t t/00_version.t .. ok tests successful. files=1, tests=1, 0 wallclock secs ( 0.03 usr 0.00 sys result: pass prove t/01_syntax.t t/01_syntax.t .. ok tests successful. files=1, tests=1, 0 wallclock secs ( 0.02 usr 0.00 sys result: pass make: *** no rule make target 'test//efl_main.json', needed 'efl_class_returnszero'. stop.
you cannot use automatic variables $@
in prerequisites list. available in recipe. see automatic variables in manual.
you can enable secondary expansion, if want; rule this:
.secondexpansion: (efl_class_bundles): version syntax \ test/$$@/efl_main.json \ test/$$@/01_$$@.json \ test/$$@/02_efl_test_simple.json prove t/efl_class_$@_csv.t prove t/efl_class_$@_json.t
Comments
Post a Comment