简体   繁体   English

Makefile:多个目标,一个依赖项

[英]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). 我有一个脚本,根据另一个代码文件(比如origin.h)生成2个代码文件(例如,src1.c,src2.c)。
I use a makefile to build them. 我使用makefile来构建它们。
Now, I want the script to be executed when src1.c OR src2.c is older that origin.h. 现在,我希望在src1.c或src2.c比origin.h更旧时执行脚本。

What is the best way to do that? 最好的方法是什么?

Thanks. 谢谢。

Make src1.c and src2.c jointly dependent on origin.h: 使src1.c和src2.c共同依赖于origin.h:

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM