aaronstacy
aaronstacy

Reputation: 6428

Makefile target with multiple dependencies

I have a little script that compiles a markdown file into html, and inserts that into the body of a template, along with some stylesheets and javascript. I've got a GNU makefile to accomplish this:

output.html: content.md compile.py style.css script.js
    python compile.py < $< > $@

When I run this I get the error:

make: * No rule to make target style.css', needed byoutput.html'. Stop.

If I remove compile.py, style.css, and script.js, the target runs, but then it no longer depends on the files, so I can make a change in style.css, and it won't re-run the target.

All of these files are in the same directory:

my_project_directory/
    content.md
    compile.py
    style.css
    script.js

How do I declare all of these files as dependencies without causing errors?

Upvotes: 6

Views: 13595

Answers (1)

Kyle Jones
Kyle Jones

Reputation: 5532

You've told make that output.html needs style.css, but the style.css file doesn't exist in the current directory and you haven't told make how to create it. Specify the real location of style.css (and the other files) and the dependency will work.

Upvotes: 4

Related Questions