Add a gitignore make target.

This commit is contained in:
Roy Marples
2008-03-03 13:04:08 +00:00
parent 61c476e72d
commit 7a8e9d4ddb
18 changed files with 145 additions and 17 deletions

View File

@@ -4,6 +4,7 @@
# Copyright 2008 Roy Marples <roy@marples.name>
CLEANFILES+= .depend
IGNOREFILES+= .depend
.depend: ${SRCS}
${CC} ${CFLAGS} -MM ${SRCS} > .depend

15
mk/gitignore.mk Normal file
View File

@@ -0,0 +1,15 @@
# rules to make .gitignore files
# Copyright 2008 Roy Marples <roy@marples.name>
IGNOREFILES+= ${CLEANFILES}
.gitignore:
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

View File

@@ -11,6 +11,8 @@ OBJS+= ${SRCS:.c=.o}
SOBJS+= ${OBJS:.o=.So}
_LIBS= lib${LIB}.a ${SHLIB_NAME}
CLEANFILES+= ${OBJS} ${SOBJS} ${_LIBS} ${SHLIB_LINK}
.SUFFIXES: .So
.c.So:
@@ -50,3 +52,4 @@ clean:
include ${MK}/sys.mk
include ${MK}/depend.mk
include ${MK}/gitignore.mk

View File

@@ -20,12 +20,15 @@ LDFLAGS+= ${_DYNLINK}$(shell ${_DYNLINK_SH})
LDFLAGS+= -Wl,-rpath=${PREFIX}/${LIBNAME} -L${PREFIX}/${LIBNAME}
LDFLAGS+= ${PROGLDFLAGS}
CLEANFILES+= ${OBJS} ${PROG}
all: depend ${PROG}
${PROG}: ${SCRIPTS} ${OBJS}
${CC} ${LDFLAGS} -o $@ ${OBJS} ${LDADD}
clean:
rm -f ${OBJS} ${PROG} ${CLEANFILES}
rm -f ${CLEANFILES}
include ${MK}/depend.mk
include ${MK}/gitignore.mk

View File

@@ -41,3 +41,5 @@ install: all realinstall ${INSTALLAFTER}
CLEANFILES+= ${OBJS}
clean:
if test -n "${CLEANFILES}"; then rm -f ${CLEANFILES}; fi
include ${MK}/gitignore.mk

View File

@@ -37,3 +37,5 @@ realinstall:
install: realinstall ${INSTALLAFTER}
depend:
${_SUBDIR}
gitignore:
${_SUBDIR}