aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorRoy Marples <roy@marples.name>2008-01-07 14:20:13 +0000
committerRoy Marples <roy@marples.name>2008-01-07 14:20:13 +0000
commitd22fc0dd931e43be5f20526e8e43a303d054ca21 (patch)
tree8c47e8d9a54cfbd42a7ad58f2d01a0a2807e4577 /src
parentc25651057038c6ef4f8cbd6819aa0b5ed892087a (diff)
Allow depend creation again. This doesn't work on GNU make, but does on all others.
Diffstat (limited to 'src')
-rw-r--r--src/cc.mk1
-rw-r--r--src/depend.mk10
-rw-r--r--src/lib.mk6
-rw-r--r--src/libeinfo/Makefile2
-rw-r--r--src/libeinfo/libeinfo.c2
-rw-r--r--src/librc/Makefile2
-rw-r--r--src/librc/librc.h6
-rw-r--r--src/prog.mk6
-rw-r--r--src/rc/rc-update.c6
9 files changed, 30 insertions, 11 deletions
diff --git a/src/cc.mk b/src/cc.mk
index 1dc1b3fe..8b65627c 100644
--- a/src/cc.mk
+++ b/src/cc.mk
@@ -23,3 +23,4 @@ CFLAGS += -pedantic -std=c99 \
$(call check_gcc, -Wdeclaration-after-statement) \
$(call check_gcc, -Wsequence-point) \
$(call check_gcc, -Wextra) $(WEXTRA)
+
diff --git a/src/depend.mk b/src/depend.mk
new file mode 100644
index 00000000..5b2da6d2
--- /dev/null
+++ b/src/depend.mk
@@ -0,0 +1,10 @@
+# This only works for make implementations that always include a .depend if
+# it exists. Only GNU make does not do this.
+
+.depend: ${SCRIPTS} ${SRCS}
+ $(CC) $(CFLAGS) -MM ${SRCS} > .depend
+
+depend: .depend
+
+clean-depend:
+ rm -f .depend
diff --git a/src/lib.mk b/src/lib.mk
index 574fd383..c1b4558c 100644
--- a/src/lib.mk
+++ b/src/lib.mk
@@ -32,7 +32,7 @@ LIBMODE?= 0444
.c.So:
${CC} ${PICFLAG} -DPIC ${CFLAGS} -c $< -o $@
-all: ${_LIBS}
+all: depend ${_LIBS}
lib${LIB}.a: ${OBJS} ${STATICOBJS}
@${ECHO} building static library $@
@@ -59,5 +59,7 @@ install: all
${INSTALL} -d ${DESTDIR}${INCDIR}
for x in ${INCS}; do ${INSTALL} -m ${INCMODE} $$x ${DESTDIR}${INCDIR}; done
-clean:
+clean: clean-depend
rm -f ${OBJS} ${SOBJS} ${_LIBS} ${SHLIB_LINK}
+
+include $(TOPDIR)/depend.mk
diff --git a/src/libeinfo/Makefile b/src/libeinfo/Makefile
index 5cace0cc..de96f7f7 100644
--- a/src/libeinfo/Makefile
+++ b/src/libeinfo/Makefile
@@ -9,6 +9,8 @@ VERSION_MAP= einfo.map
SHLIBDIR= /${LIBNAME}
+CFLAGS+= -I$(TOPDIR)
+
include $(TOPDIR)/cc.mk
include $(TOPDIR)/lib.mk
include $(TOPDIR)/$(TERMCAP).mk
diff --git a/src/libeinfo/libeinfo.c b/src/libeinfo/libeinfo.c
index 14f254eb..8dfe13f2 100644
--- a/src/libeinfo/libeinfo.c
+++ b/src/libeinfo/libeinfo.c
@@ -50,7 +50,7 @@ const char libeinfo_copyright[] = "Copyright (c) 2007-2008 Roy Marples";
#include <unistd.h>
#include "einfo.h"
-#include "../hidden-visibility.h"
+#include "hidden-visibility.h"
hidden_proto(ecolor)
hidden_proto(ebegin)
hidden_proto(ebeginv)
diff --git a/src/librc/Makefile b/src/librc/Makefile
index e510b1f4..741545e1 100644
--- a/src/librc/Makefile
+++ b/src/librc/Makefile
@@ -11,6 +11,8 @@ VERSION_MAP= rc.map
CFLAGS+= -DLIB=\"${LIBNAME}\"
LDADD+= ${LIBKVM}
+CFLAGS+= -I$(TOPDIR)
+
SHLIBDIR= /${LIBNAME}
include $(TOPDIR)/cc.mk
diff --git a/src/librc/librc.h b/src/librc/librc.h
index 491462b8..d70ffa17 100644
--- a/src/librc/librc.h
+++ b/src/librc/librc.h
@@ -65,10 +65,10 @@
#include "librc-depend.h"
#include "rc.h"
-#include "../rc-misc.h"
-#include "../strlist.h"
+#include "rc-misc.h"
+#include "strlist.h"
-#include "../hidden-visibility.h"
+#include "hidden-visibility.h"
#define librc_hidden_proto(x) hidden_proto(x)
#define librc_hidden_def(x) hidden_def(x)
diff --git a/src/prog.mk b/src/prog.mk
index ea7f4fc7..9a222e7d 100644
--- a/src/prog.mk
+++ b/src/prog.mk
@@ -8,10 +8,12 @@ OBJS+= ${SRCS:.c=.o}
INSTALL?= install
-all: ${PROG}
+all: depend ${PROG}
${PROG}: ${SCRIPTS} ${OBJS}
${CC} ${CFLAGS} ${LDFLAGS} ${PROGLDFLAGS} -o $@ ${OBJS} ${LDADD}
-clean:
+clean: clean-depend
rm -f ${OBJS} ${PROG} ${CLEANFILES}
+
+include $(TOPDIR)/depend.mk
diff --git a/src/rc/rc-update.c b/src/rc/rc-update.c
index bbf23af0..4f07503f 100644
--- a/src/rc/rc-update.c
+++ b/src/rc/rc-update.c
@@ -39,10 +39,10 @@
#include <unistd.h>
#include "builtins.h"
-#include "../libeinfo/einfo.h"
+#include "einfo.h"
#include "rc.h"
-#include "../rc-misc.h"
-#include "../strlist.h"
+#include "rc-misc.h"
+#include "strlist.h"
static const char *applet = NULL;