aboutsummaryrefslogtreecommitdiff
path: root/mk
diff options
context:
space:
mode:
Diffstat (limited to 'mk')
-rw-r--r--mk/depend.mk1
-rw-r--r--mk/gitignore.mk15
-rw-r--r--mk/lib.mk3
-rw-r--r--mk/prog.mk5
-rw-r--r--mk/scripts.mk2
-rw-r--r--mk/subdir.mk2
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
diff --git a/mk/lib.mk b/mk/lib.mk
index 825af96d..a649c2ca 100644
--- a/mk/lib.mk
+++ b/mk/lib.mk
@@ -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
diff --git a/mk/prog.mk b/mk/prog.mk
index a52681f2..46bfb56b 100644
--- a/mk/prog.mk
+++ b/mk/prog.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}