autodep.mk (281812) | autodep.mk (300313) |
---|---|
1# 2# RCSid: | 1# 2# RCSid: |
3# $Id: autodep.mk,v 1.34 2014/08/04 05:12:27 sjg Exp $ | 3# $Id: autodep.mk,v 1.36 2016/04/05 15:58:37 sjg Exp $ |
4# 5# @(#) Copyright (c) 1999-2010, Simon J. Gerraty 6# 7# This file is provided in the hope that it will 8# be of use. There is absolutely NO WARRANTY. 9# Permission to copy, redistribute or otherwise 10# use this file is hereby granted provided that 11# the above copyright notice and this notice are --- 8 unchanged lines hidden (view full) --- 20# dependencies are normally updated as part of compilation. 21 22.if !target(__${.PARSEFILE}__) 23__${.PARSEFILE}__: 24 25DEPENDFILE?= .depend 26.for d in ${DEPENDFILE:N.depend} 27# bmake only groks .depend | 4# 5# @(#) Copyright (c) 1999-2010, Simon J. Gerraty 6# 7# This file is provided in the hope that it will 8# be of use. There is absolutely NO WARRANTY. 9# Permission to copy, redistribute or otherwise 10# use this file is hereby granted provided that 11# the above copyright notice and this notice are --- 8 unchanged lines hidden (view full) --- 20# dependencies are normally updated as part of compilation. 21 22.if !target(__${.PARSEFILE}__) 23__${.PARSEFILE}__: 24 25DEPENDFILE?= .depend 26.for d in ${DEPENDFILE:N.depend} 27# bmake only groks .depend |
28.-include "$d" | 28.if ${MAKE_VERSION} < 20160218 29.-include <$d> 30.else 31.dinclude <$d> 32.endif |
29.endfor 30 31# it does nothing if SRCS is not defined or is empty 32.if defined(SRCS) && !empty(SRCS) 33DEPSRCS?=${SRCS} 34__depsrcs=${DEPSRCS:M*.c} 35__depsrcs+=${DEPSRCS:M*.y} 36__depsrcs+=${DEPSRCS:M*.l} --- 33 unchanged lines hidden (view full) --- 70# watch out for people who don't use CPPFLAGS 71CPPFLAGS_MD=${CFLAGS:M-[IUD]*} ${CPPFLAGS} 72CXXFLAGS_MD=${CXXFLAGS:M-[IUD]*} ${CPPFLAGS} 73 74# just in case these need to be different 75CC_MD?=${CC} 76CXX_MD?=${CXX} 77 | 33.endfor 34 35# it does nothing if SRCS is not defined or is empty 36.if defined(SRCS) && !empty(SRCS) 37DEPSRCS?=${SRCS} 38__depsrcs=${DEPSRCS:M*.c} 39__depsrcs+=${DEPSRCS:M*.y} 40__depsrcs+=${DEPSRCS:M*.l} --- 33 unchanged lines hidden (view full) --- 74# watch out for people who don't use CPPFLAGS 75CPPFLAGS_MD=${CFLAGS:M-[IUD]*} ${CPPFLAGS} 76CXXFLAGS_MD=${CXXFLAGS:M-[IUD]*} ${CPPFLAGS} 77 78# just in case these need to be different 79CC_MD?=${CC} 80CXX_MD?=${CXX} 81 |
82# should have been set by sys.mk 83CXX_SUFFIXES?= .cc .cpp .cxx .C 84 |
|
78# so we can do an explicit make depend, but not otherwise 79.if make(depend) 80.SUFFIXES: .d 81 82.if empty(CFLAGS_MD) 83.y.d: 84 @echo updating dependencies for $< 85 @${YACC} ${YFLAGS} $< --- 9 unchanged lines hidden (view full) --- 95.c.d: 96 @echo updating dependencies for $< 97 @${SHELL} -ec "${CC_MD} -M ${CPPFLAGS_MD} $< | sed '/:/s/^/$@ /' > $@" || { ${RM} -f $@; false; } 98 99.s.d .S.d: 100 @echo updating dependencies for $< 101 @${SHELL} -ec "${CC_MD} -M ${CPPFLAGS_MD} ${AINC} $< | sed '/:/s/^/$@ /' > $@" || { ${RM} -f $@; false; } 102 | 85# so we can do an explicit make depend, but not otherwise 86.if make(depend) 87.SUFFIXES: .d 88 89.if empty(CFLAGS_MD) 90.y.d: 91 @echo updating dependencies for $< 92 @${YACC} ${YFLAGS} $< --- 9 unchanged lines hidden (view full) --- 102.c.d: 103 @echo updating dependencies for $< 104 @${SHELL} -ec "${CC_MD} -M ${CPPFLAGS_MD} $< | sed '/:/s/^/$@ /' > $@" || { ${RM} -f $@; false; } 105 106.s.d .S.d: 107 @echo updating dependencies for $< 108 @${SHELL} -ec "${CC_MD} -M ${CPPFLAGS_MD} ${AINC} $< | sed '/:/s/^/$@ /' > $@" || { ${RM} -f $@; false; } 109 |
103.cc.d .cpp.d .C.d .cxx.d: | 110${CXX_SUFFIXES:%=%.d}: |
104 @echo updating dependencies for $< 105 @${SHELL} -ec "${CXX_MD} -M ${CXXFLAGS_MD} $< | sed '/:/s/^/$@ /' > $@" || { ${RM} -f $@; false; } 106.else 107.y.d: 108 ${YACC} ${YFLAGS} $< 109 ${CC_MD} ${CFLAGS_MD:S/D//} ${CPPFLAGS_MD} y.tab.c > $@ || { ${RM} -f y.tab.c $@; false; } 110 ${RM} -f y.tab.c 111 112.l.d: 113 ${LEX} ${LFLAGS} $< 114 ${CC_MD} ${CFLAGS_MD:S/D//} ${CPPFLAGS_MD} lex.yy.c > $@ || { ${RM} -f lex.yy.c $@; false; } 115 ${RM} -f lex.yy.c 116 117.c.d: 118 ${CC_MD} ${CFLAGS_MD:S/D//} ${CPPFLAGS_MD} $< > $@ || { ${RM} -f $@; false; } 119 120.s.d .S.d: 121 ${CC_MD} ${CFLAGS_MD:S/D//} ${CPPFLAGS_MD} ${AINC} $< > $@ || { ${RM} -f $@; false; } 122 | 111 @echo updating dependencies for $< 112 @${SHELL} -ec "${CXX_MD} -M ${CXXFLAGS_MD} $< | sed '/:/s/^/$@ /' > $@" || { ${RM} -f $@; false; } 113.else 114.y.d: 115 ${YACC} ${YFLAGS} $< 116 ${CC_MD} ${CFLAGS_MD:S/D//} ${CPPFLAGS_MD} y.tab.c > $@ || { ${RM} -f y.tab.c $@; false; } 117 ${RM} -f y.tab.c 118 119.l.d: 120 ${LEX} ${LFLAGS} $< 121 ${CC_MD} ${CFLAGS_MD:S/D//} ${CPPFLAGS_MD} lex.yy.c > $@ || { ${RM} -f lex.yy.c $@; false; } 122 ${RM} -f lex.yy.c 123 124.c.d: 125 ${CC_MD} ${CFLAGS_MD:S/D//} ${CPPFLAGS_MD} $< > $@ || { ${RM} -f $@; false; } 126 127.s.d .S.d: 128 ${CC_MD} ${CFLAGS_MD:S/D//} ${CPPFLAGS_MD} ${AINC} $< > $@ || { ${RM} -f $@; false; } 129 |
123.cc.d .cpp.d .C.d .cxx.d: | 130${CXX_SUFFIXES:%=%.d}: |
124 ${CXX_MD} ${CFLAGS_MD:S/D//} ${CXXFLAGS_MD} $< > $@ || { ${RM} -f $@; false; } 125.endif 126 127.if !target(depend) 128depend: beforedepend ${DEPENDFILE} afterdepend _SUBDIRUSE 129 130${DEPENDFILE}: ${DEPSRCS} ${__dependsrcs} 131.NOPATH: ${__dependsrcs} --- 80 unchanged lines hidden --- | 131 ${CXX_MD} ${CFLAGS_MD:S/D//} ${CXXFLAGS_MD} $< > $@ || { ${RM} -f $@; false; } 132.endif 133 134.if !target(depend) 135depend: beforedepend ${DEPENDFILE} afterdepend _SUBDIRUSE 136 137${DEPENDFILE}: ${DEPSRCS} ${__dependsrcs} 138.NOPATH: ${__dependsrcs} --- 80 unchanged lines hidden --- |