From 56f847b9be0d7632f95d67a6edac957fe3b09090 Mon Sep 17 00:00:00 2001 From: wosch Date: Mon, 1 Apr 1996 18:58:28 +0000 Subject: add MKDEPCMD?= and DEPENDFILE?= replace sh(1) commands with make(1) builtins --- share/mk/bsd.dep.mk | 47 +++++++++++++++++++++++++++++------------------ 1 file changed, 29 insertions(+), 18 deletions(-) (limited to 'share/mk/bsd.dep.mk') diff --git a/share/mk/bsd.dep.mk b/share/mk/bsd.dep.mk index 9c7afab..9cdc00f 100644 --- a/share/mk/bsd.dep.mk +++ b/share/mk/bsd.dep.mk @@ -1,25 +1,36 @@ -# $Id: bsd.dep.mk,v 1.1 1994/08/04 21:10:07 wollman Exp $ +# $Id: bsd.dep.mk,v 1.5 1996/03/31 20:04:08 wosch Exp $ + +MKDEPCMD?= mkdep +DEPENDFILE?= .depend # some of the rules involve .h sources, so remove them from mkdep line .if !target(depend) -depend: beforedepend .depend afterdepend ${_DEPSUBDIR} +depend: beforedepend ${DEPENDFILE} afterdepend ${_DEPSUBDIR} .if defined(SRCS) -.depend: ${SRCS} - rm -f .depend - files="${.ALLSRC:M*.[sS]}"; \ - if [ "$$files" != "" ]; then \ - mkdep -a ${MKDEP} ${CFLAGS:M-[ID]*} ${AINC} $$files; \ - fi - files="${.ALLSRC:M*.c}"; \ - if [ "$$files" != "" ]; then \ - mkdep -a ${MKDEP} ${CFLAGS:M-[ID]*} $$files; \ - fi - files="${.ALLSRC:M*.cc} ${.ALLSRC:M*.C} ${.ALLSRC:M*.cxx}"; \ - if [ "$$files" != " " ]; then \ - mkdep -a ${MKDEP} ${CXXFLAGS:M-nostd*} ${CXXFLAGS:M-[ID]*} $$files; \ - fi + +# .if defined ${SRCS:M*.[sS]} does not work +__depend_s= ${SRCS:M*.[sS]} +__depend_c= ${SRCS:M*.c} +__depend_cc= ${SRCS:M*.cc} ${SRCS:M*.C} ${SRCS:M*.cxx} + +${DEPENDFILE}: ${SRCS} + rm -f ${DEPENDFILE} +.if defined(__depend_s) && !empty(__depend_s) + ${MKDEPCMD} -f ${DEPENDFILE} -a ${MKDEP} ${CFLAGS:M-[ID]*} ${AINC} \ + ${.ALLSRC:M*.[sS]} +.endif +.if defined(__depend_c) && !empty(__depend_c) + ${MKDEPCMD} -f ${DEPENDFILE} -a ${MKDEP} ${CFLAGS:M-[ID]*} \ + ${.ALLSRC:M*.c} +.endif +.if defined(__depend_cc) && !empty(__depend_cc) + ${MKDEPCMD} -f ${DEPENDFILE} -a ${MKDEP} \ + ${CXXFLAGS:M-nostd*} ${CXXFLAGS:M-[ID]*} \ + ${.ALLSRC:M*.cc} ${.ALLSRC:M*.C} ${.ALLSRC:M*.cxx} +.endif + .else -.depend: ${_DEPSUBDIR} +${DEPENDFILE}: ${_DEPSUBDIR} .endif .if !target(beforedepend) beforedepend: @@ -43,5 +54,5 @@ tags: clean: cleandir: cleandepend cleandepend: - rm -f .depend ${.CURDIR}/tags + rm -f ${DEPENDFILE} ${.CURDIR}/tags .endif -- cgit v1.1