开发者

Is there a way to generate a gitignore from a makefile?

开发者 https://www.devze.com 2022-12-26 12:26 出处:网络
I have a lot of files such as JavaScript, HTML, and even C and C header (.h) files which are automatically generated, so they appear in the makefile like

I have a lot of files such as JavaScript, HTML, and even C and C header (.h) files which are automatically generated, so they appear in the makefile like

myfile.js:    myfile.js.tmpl

etc. I want all of these target files to be ignored by the version control system. I am using git but this question is not git-specific. Is there a utility or a trick which exists to make the ignore file (like .gitignore) from a makefile?

(If there isn't such a facility, I 开发者_高级运维can make a script to create one, but before I do that I am just checking I haven't missed some obvious tool or method.)


One way to do this would be to start with a clean checkout, do a build, then run a git status to find out which files are untracked. Add those files (or suitable patterns) to your .gitignore file.

Makefiles can be so complex that the only way to find out what they do might be to actually run them.

0

精彩评论

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