user181548
user181548

Reputation:

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

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.)

Upvotes: 1

Views: 316

Answers (1)

Greg Hewgill
Greg Hewgill

Reputation: 993303

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.

Upvotes: 1

Related Questions