开发者

Makefile: Perform specific command when one file was updated after another one

开发者 https://www.devze.com 2023-02-09 16:53 出处:网络
I have a makefile which calls some bash scripts and shell commands. One of those scripts generates a code (say, generated.h) file according to another code file (say source.h) - and I want it to be ca

I have a makefile which calls some bash scripts and shell commands.

One of those scripts generates a code (say, generated.h) file according to another code file (say source.h) - and I want it to be called only if source.h was updated after generated.h was updated.

(In pseudo code:

if update_time(generated.h) < update_time(source.h)  
  call GenerateCodeFile.sh  
end if

)

How can I do it from with开发者_StackOverflow中文版in a makefile?

Thanks.


generated.h: source.h
    sh GenerateCodeFile.sh

Be aware that that's a literal <TAB> character at the start of the sh line.

0

精彩评论

暂无评论...
验证码 换一张
取 消