diff options
Diffstat (limited to 'mk')
-rw-r--r-- | mk/depend.mk | 1 | ||||
-rw-r--r-- | mk/gitignore.mk | 15 | ||||
-rw-r--r-- | mk/lib.mk | 3 | ||||
-rw-r--r-- | mk/prog.mk | 5 | ||||
-rw-r--r-- | mk/scripts.mk | 2 | ||||
-rw-r--r-- | mk/subdir.mk | 2 |
6 files changed, 27 insertions, 1 deletions
diff --git a/mk/depend.mk b/mk/depend.mk index a4d717ae..3d72cac1 100644 --- a/mk/depend.mk +++ b/mk/depend.mk @@ -4,6 +4,7 @@ # Copyright 2008 Roy Marples <roy@marples.name> CLEANFILES+= .depend +IGNOREFILES+= .depend .depend: ${SRCS} ${CC} ${CFLAGS} -MM ${SRCS} > .depend diff --git a/mk/gitignore.mk b/mk/gitignore.mk new file mode 100644 index 00000000..34d3539e --- /dev/null +++ b/mk/gitignore.mk @@ -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 @@ -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 @@ -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 diff --git a/mk/scripts.mk b/mk/scripts.mk index 34536f85..81fae3d2 100644 --- a/mk/scripts.mk +++ b/mk/scripts.mk @@ -41,3 +41,5 @@ install: all realinstall ${INSTALLAFTER} CLEANFILES+= ${OBJS} clean: if test -n "${CLEANFILES}"; then rm -f ${CLEANFILES}; fi + +include ${MK}/gitignore.mk diff --git a/mk/subdir.mk b/mk/subdir.mk index d3074ca1..6d9031d2 100644 --- a/mk/subdir.mk +++ b/mk/subdir.mk @@ -37,3 +37,5 @@ realinstall: install: realinstall ${INSTALLAFTER} depend: ${_SUBDIR} +gitignore: + ${_SUBDIR} |