Add scripts to manage Makefile-local .gitignore files containing clean/clobber-targeted derived files
/.gitignore is insufficient to filter derived files after a full build, and consequently a git-status does not show "working directory clean". After an illumos-gate build, nearly ten thousand files are shown as "untracked".
Joyent's manually-maintained, 9000+ line
/.gitignore is also insufficient, as admitted by the caveat: "this does not try to ignore all files in a fully built workspace. Rather, you are expected to
make clobber before running
The solution is to have the build create transient, Makefile-local .gitignore files containing translated file-path names gleaned from clean/clobber-style targets.
This "part 1" contains the script, make_gitignore.pl, to be run from a Makefile; and a script, infer_make_gitignore.pl, to add (or update) a Makefile
.DONE target to run make_gitignore.pl with the same objects that would be cleaned/clobbered.
This issue also contains Makefile revisions so that clean/clobber targets use only "simple" macro references—e.g.,
$(FOO)* and not
$(BAR:x=blah/%)—so that infer_make_gi@
tignore.pl has a straightforward task of replicating the recipes of clean/clobber targets for use by a .DONE@ target calling make_gitignore.pl.
The "part 2" issue will be the actual revision of the five thousand illumos-gate Makefiles using:
find usr/ -name Makefile\* | xargs ./usr/src/tools/scripts/infer_make_gitignore.pl
This issue only affects Makefiles' clean/clobber targets and adds two scripts to be used in "part 2".
Testing shows that:
1) all objects and files are still created after a full-build;
make clobber still results in a clean working directory (even without the "part 2" .gitignore files);