Correct math and limerick.
[dragonfly.git] / contrib / bmake / mk / auto.dep.mk
blobbb2d4c195a77ffa3d30209d9e112fdd510603ebf
2 # RCSid:
3 # $Id: auto.dep.mk,v 1.2 2010/04/19 17:37:19 sjg Exp $
5 # @(#) Copyright (c) 2010, Simon J. Gerraty
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
12 # left intact.
14 # Please send copies of changes and bug-fixes to:
15 # sjg@crufty.net
18 # This module provides automagic dependency generation along the
19 # lines suggested in the GNU make.info
21 # set MKDEP=auto.dep and dep.mk will include us
23 # This version differs from autodep.mk, in that
24 # we use ${.TARGET:T}.d rather than ${.TARGET:T:R}.d
25 # this makes it simpler to get the args to -MF and -MT right
26 # and ensure we can simply include all the .d files.
28 # However suffix rules do not work with something like .o.d so we
29 # don't even try to handle 'make depend' gracefully.
30 # dep.mk will handle that itself.
32 .if !target(__${.PARSEFILE}__)
33 __${.PARSEFILE}__:
35 # this what bmake > 20100401 will look for
36 .MAKE.DEPENDFILE ?= .depend
38 # set this to -MMD to ignore /usr/include
39 # actually it ignores <> so may not be a great idea
40 CFLAGS_MD ?= -MD
41 # -MF etc not available on all gcc versions.
42 CFLAGS_MF ?= -MF ${.TARGET:T}.d -MT ${.TARGET:T}
43 CFLAGS += ${CFLAGS_MD} ${CFLAGS_MF}
44 CXXFLAGS += ${CFLAGS_MD} ${CFLAGS_MF}
46 CLEANFILES += .depend ${.MAKE.DEPENDFILE} *.d
48 # skip generating dependfile for misc targets
49 .if ${.TARGETS:Uall:M*all} != ""
50 .END: ${.MAKE.DEPENDFILE}
51 .endif
53 # doing 'make depend' isn't a big win with this model
54 .if !target(depend)
55 depend: ${.MAKE.DEPENDFILE}
56 .endif
58 # this is trivial
59 ${.MAKE.DEPENDFILE}: ${OBJS} ${POBJS} ${SOBJS}
60 -@for f in ${.ALLSRC:M*o:T:O:u:%=%.d}; do \
61 echo ".-include \"$$f\""; \
62 done > $@
64 .endif