1# $OpenBSD: bsd.dep.mk,v 1.24 2017/10/17 19:31:56 naddy Exp $ 2# $NetBSD: bsd.dep.mk,v 1.12 1995/09/27 01:15:09 christos Exp $ 3 4.if !target(depend) 5depend: 6 @: 7.endif 8 9# relies on DEPS defined by bsd.lib.mk and bsd.prog.mk 10.if defined(DEPS) && !empty(DEPS) 11# catch22: don't include potentially bogus files we are going to clean 12. if !(make(clean) || make(cleandir) || make(obj)) 13. for o in ${DEPS} 14 sinclude $o 15. endfor 16. endif 17.endif 18 19CFLAGS += -MD -MP 20CXXFLAGS += -MD -MP 21 22# libraries need some special love 23DFLAGS += -MD -MP -MT $*.o -MT $*.po -MT $*.so -MT $*.do 24 25.if !target(tags) 26. if defined(SRCS) 27tags: ${SRCS} _SUBDIRUSE 28 -cd ${.CURDIR}; ${CTAGS} -f /dev/stdout -d ${.ALLSRC:N*.h} | \ 29 sed "s;\${.CURDIR}/;;" > tags 30. else 31tags: 32. endif 33.endif 34 35# explicitly tag most source files 36.for i in ${SRCS:N*.[hyl]:N*.sh} ${_LEXINTM} ${_YACCINTM} 37# assume libraries 38${i:R:S/$/.o/} ${i:R:S/$/.po/} ${i:R:S/$/.so/} ${i:R:S/$/.do/}: $i 39.endfor 40 41# give us better rules for yacc 42 43.if ${YFLAGS:M-d} 44# loop may not trigger 45. for f in ${SRCS:M*.y} 46${f:.y=.c} ${f:.y=.h}: $f 47 ${YACC.y} -o ${f:.y=.c} ${.IMPSRC} 48. endfor 49CLEANFILES += ${SRCS:M*.y:.y=.h} 50.endif 51 52.if defined(SRCS) 53cleandir: cleandepend 54cleandepend: 55 rm -f ${.CURDIR}/tags 56.endif 57 58CLEANFILES += ${DEPS} 59 60BUILDFIRST ?= 61BUILDAFTER ?= 62.if !empty(BUILDAFTER) 63. for i in ${BUILDFIRST} ${_LEXINTM} ${_YACCINTM} 64. if !exists($i) 65${BUILDAFTER}: $i 66. endif 67. endfor 68.endif 69.PHONY: cleandepend 70