changeset 2617:af70013c896e draft

Fix dependency and test targets
author Roy Marples <roy@marples.name>
date Thu, 31 Jul 2014 00:57:47 +0000
parents f678f2da7801
children 8749e9727a06
files GNUmakefile Makefile test/GNUmakefile test/Makefile
diffstat 4 files changed, 21 insertions(+), 14 deletions(-) [+]
line wrap: on
line diff
--- a/GNUmakefile	Wed Jul 30 15:13:12 2014 +0000
+++ b/GNUmakefile	Thu Jul 31 00:57:47 2014 +0000
@@ -7,4 +7,6 @@
 		    echo config.mk || echo config-null.mk)
 
 include Makefile
--include .depend
+ifneq ($(wildcard .depend), )
+include .depend
+endif
--- a/Makefile	Wed Jul 30 15:13:12 2014 +0000
+++ b/Makefile	Thu Jul 31 00:57:47 2014 +0000
@@ -32,7 +32,6 @@
 SCRIPTS=	dhcpcd-run-hooks
 SCRIPTSDIR=	${LIBEXECDIR}
 CLEANFILES+=	dhcpcd-run-hooks
-CLEANFILES+=	.depend
 
 FILES=		dhcpcd.conf
 FILESDIR=	${SYSCONFDIR}
@@ -91,8 +90,8 @@
 
 if-options.c: dhcpcd-embedded.h
 
-.depend: ${SRCS} ${COMPAT_SRCS}
-	${CC} ${CPPFLAGS} -MM ${SRCS} ${COMPAT_SRCS} > .depend
+.depend: ${SRCS} ${COMPAT_SRCS} ${CRYPT_SRCS}
+	${CC} ${CPPFLAGS} -MM ${SRCS} ${COMPAT_SRCS} ${CRYPT_SRCS} > .depend
 
 depend: .depend
 
--- a/test/GNUmakefile	Wed Jul 30 15:13:12 2014 +0000
+++ b/test/GNUmakefile	Thu Jul 31 00:57:47 2014 +0000
@@ -1,2 +1,7 @@
-TOP?=	..
-include ${TOP}/GNUmakefile
+# GNU Make does not automagically include .depend
+# Luckily it does read GNUmakefile over Makefile so we can work around it
+
+include Makefile
+ifneq ($(wildcard .depend), )
+include .depend
+endif
--- a/test/Makefile	Wed Jul 30 15:13:12 2014 +0000
+++ b/test/Makefile	Thu Jul 31 00:57:47 2014 +0000
@@ -3,7 +3,7 @@
 
 PROG=		test
 SRCS=		test.c
-SRCS+=		test_hmac_md5.c hmac_md5.c ${MD5_SRC}
+SRCS+=		test_hmac_md5.c ../crypt/hmac_md5.c
 
 CFLAGS?=	-O2
 CSTD?=		c99
@@ -11,11 +11,9 @@
 
 CPPFLAGS+=	-I../crypt
 
-.PATH:		../crypt
-
-VPATH=		. ../crypt
-
-OBJS+=		${SRCS:.c=.o}
+T_COMPAT_SRCS=	${COMPAT_SRCS:compat/%=../compat/%}
+T_MD5_SRC=	${MD5_SRC:crypt/%=../crypt/%}
+OBJS+=		${SRCS:.c=.o} ${T_COMPAT_SRCS:.c=.o} ${T_MD5_SRC:.c=.o}
 
 .c.o:
 	${CC} ${CFLAGS} ${CPPFLAGS} -c $< -o $@
@@ -25,8 +23,11 @@
 clean:
 	rm -f ${OBJS} ${PROG} ${PROG}.core ${CLEANFILES}
 
-.depend: ${SRCS} ${COMPAT_SRCS}
-	${CC} ${CPPFLAGS} -MM ${SRCS} ${COMPAT_SRCS} > .depend
+distclean: clean
+	rm -f .depend
+
+.depend: ${SRCS} ${T_COMPAT_SRCS} ${T_CRYPT_SRCS}
+	${CC} ${CPPFLAGS} -MM ${SRCS} ${T_COMPAT_SRCS} ${T_CRYPT_SRCS} > .depend
 
 depend: .depend