user360455
user360455

Reputation:

Makefile: Multiple targets, one dependency

I have a script that generates 2 code files (For example, src1.c, src2.c) according to another code file (say origin.h).
I use a makefile to build them.
Now, I want the script to be executed when src1.c OR src2.c is older that origin.h.

What is the best way to do that?

Thanks.

Upvotes: 4

Views: 1272

Answers (1)

Marcelo Cantos
Marcelo Cantos

Reputation: 185852

Make src1.c and src2.c jointly dependent on origin.h:

src1.c src2.c : origin.h
        build-sources

Upvotes: 5

Related Questions