1999-01-18 07:48:41 +00:00
|
|
|
# $Id: bsd.dep.mk,v 1.25 1998/06/05 18:38:54 dt Exp $
|
1996-05-25 23:09:49 +00:00
|
|
|
#
|
|
|
|
# The include file <bsd.dep.mk> handles Makefile dependencies.
|
|
|
|
#
|
|
|
|
#
|
|
|
|
# +++ variables +++
|
|
|
|
#
|
|
|
|
# DEPENDFILE dependencies file [.depend]
|
|
|
|
#
|
|
|
|
# MKDEP Options for ${MKDEPCMD} [not set]
|
|
|
|
#
|
|
|
|
# MKDEPCMD Makefile dependency list program [mkdep]
|
|
|
|
#
|
|
|
|
# SRCS List of source files (c, c++, assembler)
|
|
|
|
#
|
|
|
|
#
|
|
|
|
# +++ targets +++
|
|
|
|
#
|
|
|
|
# cleandepend:
|
|
|
|
# Remove depend and tags file
|
|
|
|
#
|
|
|
|
# depend:
|
|
|
|
# Make the dependencies for the source files, and store
|
|
|
|
# them in the file ${DEPENDFILE}.
|
|
|
|
#
|
|
|
|
# tags:
|
1997-04-13 06:44:25 +00:00
|
|
|
# Create a (GLOBAL) gtags file for the source files.
|
|
|
|
# If HTML is defined, htags is also run after gtags.
|
1996-05-25 23:09:49 +00:00
|
|
|
|
1996-04-01 18:58:28 +00:00
|
|
|
|
|
|
|
MKDEPCMD?= mkdep
|
|
|
|
DEPENDFILE?= .depend
|
1994-08-04 21:10:08 +00:00
|
|
|
|
1998-05-11 15:37:13 +00:00
|
|
|
.if defined(SRCS)
|
|
|
|
CLEANFILES?=
|
|
|
|
|
|
|
|
.for _LSRC in ${SRCS:M*.l:N*/*}
|
|
|
|
.for _LC in ${_LSRC:S/.l/.c/}
|
|
|
|
${_LC}: ${_LSRC}
|
|
|
|
${LEX} -t ${LFLAGS} ${.ALLSRC} > ${.TARGET}
|
|
|
|
SRCS:= ${SRCS:S/${_LSRC}/${_LC}/}
|
|
|
|
CLEANFILES:= ${CLEANFILES} ${_LC}
|
|
|
|
.endfor
|
|
|
|
.endfor
|
|
|
|
|
|
|
|
.for _YSRC in ${SRCS:M*.y:N*/*}
|
|
|
|
.for _YC in ${_YSRC:S/.y/.c/}
|
|
|
|
SRCS:= ${SRCS:S/${_YSRC}/${_YC}/}
|
|
|
|
CLEANFILES:= ${CLEANFILES} ${_YC}
|
|
|
|
.if ${YFLAGS:M-d} != "" && ${SRCS:My.tab.h}
|
|
|
|
.ORDER: ${_YC} y.tab.h
|
|
|
|
${_YC} y.tab.h: ${_YSRC}
|
|
|
|
${YACC} ${YFLAGS} ${.ALLSRC}
|
|
|
|
cp y.tab.c ${_YC}
|
|
|
|
SRCS:= ${SRCS} y.tab.h
|
|
|
|
CLEANFILES:= ${CLEANFILES} y.tab.c y.tab.h
|
|
|
|
.elif ${YFLAGS:M-d} != ""
|
|
|
|
.for _YH in ${_YC:S/.c/.h/}
|
|
|
|
.ORDER: ${_YC} ${_YH}
|
|
|
|
${_YC} ${_YH}: ${_YSRC}
|
|
|
|
${YACC} ${YFLAGS} -o ${_YC} ${.ALLSRC}
|
|
|
|
SRCS:= ${SRCS} ${_YH}
|
|
|
|
CLEANFILES:= ${CLEANFILES} ${_YH}
|
|
|
|
.endfor
|
|
|
|
.else
|
|
|
|
${_YC}: ${_YSRC}
|
|
|
|
${YACC} ${YFLAGS} -o ${_YC} ${.ALLSRC}
|
|
|
|
.endif
|
|
|
|
.endfor
|
|
|
|
.endfor
|
|
|
|
.endif
|
|
|
|
|
1994-08-04 21:10:08 +00:00
|
|
|
.if !target(depend)
|
|
|
|
.if defined(SRCS)
|
1997-10-05 09:40:24 +00:00
|
|
|
depend: beforedepend ${DEPENDFILE} afterdepend _SUBDIR
|
1996-04-01 18:58:28 +00:00
|
|
|
|
1998-03-07 13:57:37 +00:00
|
|
|
# Different types of sources are compiled with slightly different flags.
|
|
|
|
# Split up the sources, and filter out headers and non-applicable flags.
|
1996-04-01 18:58:28 +00:00
|
|
|
${DEPENDFILE}: ${SRCS}
|
|
|
|
rm -f ${DEPENDFILE}
|
1998-03-07 13:57:37 +00:00
|
|
|
.if ${SRCS:M*.[sS]} != ""
|
|
|
|
${MKDEPCMD} -f ${DEPENDFILE} -a ${MKDEP} \
|
|
|
|
${CFLAGS:M-nostdinc*} ${CFLAGS:M-[BID]*} \
|
|
|
|
${AINC} \
|
|
|
|
${.ALLSRC:M*.[sS]}
|
1996-04-01 18:58:28 +00:00
|
|
|
.endif
|
1998-03-07 13:57:37 +00:00
|
|
|
.if ${SRCS:M*.c} != ""
|
|
|
|
${MKDEPCMD} -f ${DEPENDFILE} -a ${MKDEP} \
|
|
|
|
${CFLAGS:M-nostdinc*} ${CFLAGS:M-[BID]*} \
|
|
|
|
${.ALLSRC:M*.c}
|
1996-04-01 18:58:28 +00:00
|
|
|
.endif
|
1998-06-05 18:38:55 +00:00
|
|
|
.if ${SRCS:M*.cc} != "" || ${SRCS:M*.C} != "" || ${SRCS:M*.cpp} != "" || \
|
|
|
|
${SRCS:M*.cxx} != ""
|
1996-04-01 18:58:28 +00:00
|
|
|
${MKDEPCMD} -f ${DEPENDFILE} -a ${MKDEP} \
|
1998-03-07 13:57:37 +00:00
|
|
|
${CXXFLAGS:M-nostdinc*} ${CXXFLAGS:M-[BID]*} \
|
1998-06-05 18:38:55 +00:00
|
|
|
${.ALLSRC:M*.cc} ${.ALLSRC:M*.C} ${.ALLSRC:M*.cpp} ${.ALLSRC:M*.cxx}
|
1996-04-01 18:58:28 +00:00
|
|
|
.endif
|
1998-05-15 09:30:13 +00:00
|
|
|
.if ${SRCS:M*.m} != ""
|
|
|
|
${MKDEPCMD} -f ${DEPENDFILE} -a ${MKDEP} \
|
|
|
|
${OBJCFLAGS:M-nostdinc*} ${OBJCFLAGS:M-[BID]*} \
|
|
|
|
${OBJCFLAGS:M-Wno-import*} \
|
|
|
|
${.ALLSRC:M*.m}
|
|
|
|
.endif
|
1997-04-09 16:10:27 +00:00
|
|
|
.if target(_EXTRADEPEND)
|
|
|
|
cd ${.CURDIR}; ${MAKE} _EXTRADEPEND
|
|
|
|
.endif
|
1996-04-01 18:58:28 +00:00
|
|
|
|
1997-10-05 09:40:24 +00:00
|
|
|
.ORDER: ${DEPENDFILE} afterdepend
|
1994-08-04 21:10:08 +00:00
|
|
|
.else
|
1997-10-05 09:40:24 +00:00
|
|
|
depend: beforedepend afterdepend _SUBDIR
|
1994-08-04 21:10:08 +00:00
|
|
|
.endif
|
|
|
|
.if !target(beforedepend)
|
|
|
|
beforedepend:
|
1997-10-05 09:40:24 +00:00
|
|
|
.else
|
|
|
|
.ORDER: beforedepend ${DEPENDFILE}
|
|
|
|
.ORDER: beforedepend afterdepend
|
1994-08-04 21:10:08 +00:00
|
|
|
.endif
|
|
|
|
.if !target(afterdepend)
|
|
|
|
afterdepend:
|
|
|
|
.endif
|
|
|
|
.endif
|
|
|
|
|
1997-04-13 06:44:25 +00:00
|
|
|
.if defined(NOTAGS)
|
|
|
|
tags:
|
|
|
|
.endif
|
|
|
|
|
1994-08-04 21:10:08 +00:00
|
|
|
.if !target(tags)
|
1996-06-24 04:26:21 +00:00
|
|
|
tags: ${SRCS} _SUBDIR
|
1998-03-23 14:58:30 +00:00
|
|
|
@cd ${.CURDIR} && gtags ${GTAGSFLAGS} ${.OBJDIR}
|
1997-04-13 06:44:25 +00:00
|
|
|
.if defined(HTML)
|
1998-03-23 14:58:30 +00:00
|
|
|
@cd ${.CURDIR} && htags ${HTAGSFLAGS} -d ${.OBJDIR} ${.OBJDIR}
|
1994-08-04 21:10:08 +00:00
|
|
|
.endif
|
|
|
|
.endif
|
|
|
|
|
1996-06-24 04:26:21 +00:00
|
|
|
.if !target(cleandepend)
|
|
|
|
cleandepend: _SUBDIR
|
1997-08-26 16:54:33 +00:00
|
|
|
.if defined(SRCS)
|
1999-01-18 07:48:41 +00:00
|
|
|
rm -f ${DEPENDFILE} ${.OBJDIR}/GPATH ${.OBJDIR}/GRTAGS \
|
|
|
|
${.OBJDIR}/GSYMS ${.OBJDIR}/GTAGS
|
1997-04-13 06:44:25 +00:00
|
|
|
.if defined(HTML)
|
1998-03-23 14:58:30 +00:00
|
|
|
rm -rf ${.OBJDIR}/HTML
|
1997-04-13 06:44:25 +00:00
|
|
|
.endif
|
1996-06-24 04:26:21 +00:00
|
|
|
.endif
|
|
|
|
.endif
|