diff options
author | sjg <sjg@FreeBSD.org> | 2015-05-10 20:02:26 +0000 |
---|---|---|
committer | sjg <sjg@FreeBSD.org> | 2015-05-10 20:02:26 +0000 |
commit | 168edd726ad8a54339e142aec8bee10c893b7326 (patch) | |
tree | 1e70dc5e5574c3e64ad07c94b7275fae0b638a40 /20150505/mk/auto.dep.mk | |
parent | 6b3bd5224a01da593382e075c1de2696c3261ebe (diff) | |
download | FreeBSD-src-168edd726ad8a54339e142aec8bee10c893b7326.zip FreeBSD-src-168edd726ad8a54339e142aec8bee10c893b7326.tar.gz |
Tag bmake-20150505
Diffstat (limited to '20150505/mk/auto.dep.mk')
-rw-r--r-- | 20150505/mk/auto.dep.mk | 64 |
1 files changed, 64 insertions, 0 deletions
diff --git a/20150505/mk/auto.dep.mk b/20150505/mk/auto.dep.mk new file mode 100644 index 0000000..3313724 --- /dev/null +++ b/20150505/mk/auto.dep.mk @@ -0,0 +1,64 @@ +# +# RCSid: +# $Id: auto.dep.mk,v 1.3 2014/08/04 05:19:10 sjg Exp $ +# +# @(#) Copyright (c) 2010, Simon J. Gerraty +# +# This file is provided in the hope that it will +# be of use. There is absolutely NO WARRANTY. +# Permission to copy, redistribute or otherwise +# use this file is hereby granted provided that +# the above copyright notice and this notice are +# left intact. +# +# Please send copies of changes and bug-fixes to: +# sjg@crufty.net +# + +# This module provides automagic dependency generation along the +# lines suggested in the GNU make.info + +# set MKDEP_MK=auto.dep.mk and dep.mk will include us + +# This version differs from autodep.mk, in that +# we use ${.TARGET:T}.d rather than ${.TARGET:T:R}.d +# this makes it simpler to get the args to -MF and -MT right +# and ensure we can simply include all the .d files. +# +# However suffix rules do not work with something like .o.d so we +# don't even try to handle 'make depend' gracefully. +# dep.mk will handle that itself. +# +.if !target(__${.PARSEFILE}__) +__${.PARSEFILE}__: + +# this what bmake > 20100401 will look for +.MAKE.DEPENDFILE ?= .depend + +# set this to -MMD to ignore /usr/include +# actually it ignores <> so may not be a great idea +CFLAGS_MD ?= -MD +# -MF etc not available on all gcc versions. +CFLAGS_MF ?= -MF ${.TARGET:T}.d -MT ${.TARGET:T} +CFLAGS += ${CFLAGS_MD} ${CFLAGS_MF} +CXXFLAGS += ${CFLAGS_MD} ${CFLAGS_MF} + +CLEANFILES += .depend ${.MAKE.DEPENDFILE} *.d + +# skip generating dependfile for misc targets +.if ${.TARGETS:Uall:M*all} != "" +.END: ${.MAKE.DEPENDFILE} +.endif + +# doing 'make depend' isn't a big win with this model +.if !target(depend) +depend: ${.MAKE.DEPENDFILE} +.endif + +# this is trivial +${.MAKE.DEPENDFILE}: ${OBJS} ${POBJS} ${SOBJS} + -@for f in ${.ALLSRC:M*o:T:O:u:%=%.d}; do \ + echo ".-include \"$$f\""; \ + done > $@ + +.endif |