I am trying to configure a makefile so that I can use aspell in it to check a folder of .mb files. I am not sure how to configure it but I tried this:
spellcheck-en:
for f in src/docs/en/*.md; do aspell --lang=en check $f; done
The thing is, the makefile is not reading the $f so when I run 'make spellcheck-en' I get this:
Error: You must specify a file name.
Error: You must specify a file name.
Error: You must specify a file name.
Error: You must specify a file name.
Error: You must specify a file name.
make: *** [Makefile:29: spellcheck-en] Error 255
However, running this: "for f in src/docs/en/*.md; do aspell --lang=en check $f; done" on the terminal is not an issue. Is there another way to indicate $f in a makefile?
Thank you.
This answer is not about your issues which have been fixed in the comments. Your Makefile, while working after you'll replace
$fby$$f, is not better than the equivalent shell script. It has 2 main drawbacks:The following solves these two drawbacks:
If you now run:
or just (because being the first target
spellcheck-enis the default goal):You'll check only the files that changed since the last check and you'll run these checks in parallel with up to 8 jobs at a time.
Explanations:
wildcardandpatsubstare 2 GNU make functions..PHONYspecial target. They are targets that are not real files. Make needs to know about them, just in case a file with the same name exists.$(OKDIR)/%: $(MDDIR)/%.md | $(OKDIR) ...is a pattern rule.| $(OKDIR)is a order-only prerequisite.All these are well explained in the GNU make manual.