2004-04-18 08:32:51 +04:00
|
|
|
# $NetBSD: bsd.dep.mk,v 1.67 2004/04/18 04:34:27 lukem Exp $
|
1997-03-08 02:10:18 +03:00
|
|
|
|
2001-11-02 08:21:47 +03:00
|
|
|
##### Basic targets
|
2001-08-14 11:02:13 +04:00
|
|
|
cleandir: cleandepend
|
2001-11-02 08:21:47 +03:00
|
|
|
realdepend: beforedepend .depend afterdepend
|
|
|
|
.ORDER: beforedepend .depend afterdepend
|
1997-05-07 00:54:31 +04:00
|
|
|
|
2001-11-02 08:21:47 +03:00
|
|
|
beforedepend .depend afterdepend: # ensure existence
|
|
|
|
|
|
|
|
##### Default values
|
2003-11-10 21:21:55 +03:00
|
|
|
MKDEP?= mkdep
|
|
|
|
MKDEP_SUFFIXES?= .o
|
1993-08-15 23:37:04 +04:00
|
|
|
|
2001-11-02 08:21:47 +03:00
|
|
|
##### Build rules
|
1993-08-15 23:37:04 +04:00
|
|
|
# some of the rules involve .h sources, so remove them from mkdep line
|
2001-11-02 08:21:47 +03:00
|
|
|
|
2003-07-31 17:47:32 +04:00
|
|
|
.if defined(SRCS) # {
|
2003-10-28 04:25:33 +03:00
|
|
|
_TRADITIONAL_CPP?=-traditional-cpp
|
|
|
|
__acpp_flags= ${_TRADITIONAL_CPP}
|
2003-05-08 17:34:07 +04:00
|
|
|
|
2003-08-01 21:03:41 +04:00
|
|
|
__DPSRCS.all= ${SRCS:C/\.(c|m|s|S|C|cc|cpp|cxx)$/.d/} \
|
|
|
|
${DPSRCS:C/\.(c|m|s|S|C|cc|cpp|cxx)$/.d/}
|
|
|
|
__DPSRCS.d= ${__DPSRCS.all:O:u:M*.d}
|
|
|
|
__DPSRCS.notd= ${__DPSRCS.all:O:u:N*.d}
|
2003-07-31 17:47:32 +04:00
|
|
|
|
2003-08-01 21:03:41 +04:00
|
|
|
.NOPATH: .depend ${__DPSRCS.d}
|
2003-05-08 17:34:07 +04:00
|
|
|
|
2003-08-06 17:55:11 +04:00
|
|
|
.if !empty(__DPSRCS.d) # {
|
2003-08-01 21:03:41 +04:00
|
|
|
${__DPSRCS.d}: ${__DPSRCS.notd} ${DPSRCS}
|
2003-08-06 17:55:11 +04:00
|
|
|
.endif # }
|
2003-05-08 17:34:07 +04:00
|
|
|
|
2003-08-01 21:03:41 +04:00
|
|
|
.depend: ${__DPSRCS.d}
|
2003-10-21 14:01:19 +04:00
|
|
|
${_MKTARGET_CREATE}
|
2003-10-18 19:33:59 +04:00
|
|
|
rm -f .depend
|
2003-11-10 21:21:55 +03:00
|
|
|
${MKDEP} -d -f ${.TARGET} -s ${MKDEP_SUFFIXES:Q} ${__DPSRCS.d}
|
2003-07-29 11:56:23 +04:00
|
|
|
|
2003-08-11 13:59:43 +04:00
|
|
|
.SUFFIXES: .d .s .S .c .C .cc .cpp .cxx .m
|
2003-07-28 19:07:16 +04:00
|
|
|
|
2003-07-29 03:57:24 +04:00
|
|
|
.c.d:
|
2003-10-21 14:01:19 +04:00
|
|
|
${_MKTARGET_CREATE}
|
2004-01-27 06:31:48 +03:00
|
|
|
${MKDEP} -f ${.TARGET} -- ${MKDEPFLAGS} \
|
|
|
|
${CFLAGS:C/-([IDU])[ ]*/-\1/Wg:M-[IDU]*} \
|
|
|
|
${CPPFLAGS} ${CPPFLAGS.${.IMPSRC:T}} ${.IMPSRC}
|
2003-05-08 17:34:07 +04:00
|
|
|
|
2003-07-29 03:57:24 +04:00
|
|
|
.m.d:
|
2003-10-21 14:01:19 +04:00
|
|
|
${_MKTARGET_CREATE}
|
2004-01-27 06:31:48 +03:00
|
|
|
${MKDEP} -f ${.TARGET} -- ${MKDEPFLAGS} \
|
|
|
|
${OBJCFLAGS:C/-([IDU])[ ]*/-\1/Wg:M-[IDU]*} \
|
2003-07-28 19:07:16 +04:00
|
|
|
${CPPFLAGS} ${CPPFLAGS.${.IMPSRC:T}} ${.IMPSRC}
|
2003-05-08 17:34:07 +04:00
|
|
|
|
2003-07-29 03:57:24 +04:00
|
|
|
.s.d .S.d:
|
2003-10-21 14:01:19 +04:00
|
|
|
${_MKTARGET_CREATE}
|
2004-01-27 06:31:48 +03:00
|
|
|
${MKDEP} -f ${.TARGET} -- ${MKDEPFLAGS} \
|
|
|
|
${AFLAGS:C/-([IDU])[ ]*/-\1/Wg:M-[IDU]*} \
|
2004-04-18 08:32:51 +04:00
|
|
|
${CPPFLAGS} ${CPPFLAGS.${.IMPSRC:T}} ${__acpp_flags} ${.IMPSRC}
|
2003-05-08 17:34:07 +04:00
|
|
|
|
2003-07-29 03:57:24 +04:00
|
|
|
.C.d .cc.d .cpp.d .cxx.d:
|
2003-10-21 14:01:19 +04:00
|
|
|
${_MKTARGET_CREATE}
|
2004-01-27 06:31:48 +03:00
|
|
|
${MKDEP} -f ${.TARGET} -- ${MKDEPFLAGS} \
|
|
|
|
${CXXFLAGS:C/-([IDU])[ ]*/-\1/Wg:M-[IDU]*} \
|
2003-07-27 18:49:22 +04:00
|
|
|
${DESTDIR:D-nostdinc++ ${CPPFLAG_ISYSTEMXX} \
|
2004-01-27 06:31:48 +03:00
|
|
|
${DESTDIR}/usr/include/g++} \
|
2003-07-28 19:07:16 +04:00
|
|
|
${CPPFLAGS} ${CPPFLAGS.${.IMPSRC:T}} ${.IMPSRC}
|
2003-05-08 17:34:07 +04:00
|
|
|
|
2003-07-31 17:47:32 +04:00
|
|
|
.endif # defined(SRCS) # }
|
2001-11-02 08:21:47 +03:00
|
|
|
|
|
|
|
##### Clean rules
|
2004-01-29 04:48:45 +03:00
|
|
|
cleandepend: .PHONY
|
2001-11-02 08:21:47 +03:00
|
|
|
.if defined(SRCS)
|
2003-08-01 21:03:41 +04:00
|
|
|
rm -f .depend ${__DPSRCS.d} ${.CURDIR}/tags ${CLEANDEPEND}
|
1993-08-15 23:37:04 +04:00
|
|
|
.endif
|
1993-08-16 00:42:39 +04:00
|
|
|
|
2001-11-02 08:21:47 +03:00
|
|
|
##### Custom rules
|
1993-08-16 00:42:39 +04:00
|
|
|
.if !target(tags)
|
1997-05-07 21:06:16 +04:00
|
|
|
tags: ${SRCS}
|
2001-11-02 08:21:47 +03:00
|
|
|
.if defined(SRCS)
|
1993-08-16 00:42:39 +04:00
|
|
|
-cd ${.CURDIR}; ctags -f /dev/stdout ${.ALLSRC:N*.h} | \
|
|
|
|
sed "s;\${.CURDIR}/;;" > tags
|
1993-08-16 01:14:45 +04:00
|
|
|
.endif
|
1993-08-16 00:42:39 +04:00
|
|
|
.endif
|