Is this possible at all and how?
Update: I need this because I create a file both from dynamic and static data.
Use case:
SRCS = (wildcard [a-z]*.c)
EXES = $(SRCS:.c=)
GITIGNOREDS = *.o depend
.gitignore: $(SRCS)
echo $(EXES) | sed 's/ /\n/g' > $@
echo $(GITIGNOREDS) | sed 's/ /\n/g' > $@
Important is the GITIGNOREDS line. I would have preferred a heredoc like
GITIGNOREDS = <
but am also happy with a file list, separated by spaces, and a sed script to translate the space into newlines.
Edit As proposed by Ryan V. Bissell: Use a separate test subdirectory which you add to gitignore. And everything falls into place. It's simple.