summaryrefslogtreecommitdiff
path: root/mk/gitignore.mk
blob: fca262be68b5212b0f637d5e0025360b11f10eda (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
# rules to make .gitignore files
# Copyright 2008 Roy Marples <roy@marples.name>

IGNOREFILES+=	${CLEANFILES}

.PHONY:		.gitignore

.gitignore:
	@if test -n "${IGNOREFILES}"; then echo "Ignoring ${IGNOREFILES}"; fi
	@for obj in ${IGNOREFILES}; do \
		if ! test -r .gitignore; then \
			echo "$${obj}" > .gitignore || exit $$?; \
		elif ! grep -q "^$${obj}$$" .gitignore; then \
			echo "$${obj}" >> .gitignore || exit $$?; \
		fi; \
	done

gitignore: .gitignore