From d247cb50e8f0902afea1c18c8e4133eba2665e66 Mon Sep 17 00:00:00 2001 From: Roy Marples Date: Thu, 31 Jul 2014 00:57:47 +0000 Subject: [PATCH] Fix dependency and test targets --- GNUmakefile | 4 +++- Makefile | 5 ++--- test/GNUmakefile | 9 +++++++-- test/Makefile | 17 +++++++++-------- 4 files changed, 21 insertions(+), 14 deletions(-) diff --git a/GNUmakefile b/GNUmakefile index e06fb447..55652948 100644 --- a/GNUmakefile +++ b/GNUmakefile @@ -7,4 +7,6 @@ CONFIG_MK?= $(shell test -e ${TOP}/config.mk && \ echo config.mk || echo config-null.mk) include Makefile --include .depend +ifneq ($(wildcard .depend), ) +include .depend +endif diff --git a/Makefile b/Makefile index 6d3730ca..ac637b0c 100644 --- a/Makefile +++ b/Makefile @@ -32,7 +32,6 @@ CLEANFILES= dhcpcd.conf.5 dhcpcd.8 dhcpcd-run-hooks.8 SCRIPTS= dhcpcd-run-hooks SCRIPTSDIR= ${LIBEXECDIR} CLEANFILES+= dhcpcd-run-hooks -CLEANFILES+= .depend FILES= dhcpcd.conf FILESDIR= ${SYSCONFDIR} @@ -91,8 +90,8 @@ dhcpcd-embedded.c: genembedc dhcpcd-definitions.conf 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 diff --git a/test/GNUmakefile b/test/GNUmakefile index 1f97d8c4..2e838d5e 100644 --- a/test/GNUmakefile +++ b/test/GNUmakefile @@ -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 diff --git a/test/Makefile b/test/Makefile index 186e9c84..e29a7cd7 100644 --- a/test/Makefile +++ b/test/Makefile @@ -3,7 +3,7 @@ include ${TOP}/iconfig.mk 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 @@ CFLAGS+= -std=${CSTD} 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 @@ all: ${PROG} 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 -- 2.47.3