bridge(4): document net.link.bridge.pfil_onlyip
[dragonfly.git] / contrib / bmake / mk / auto.dep.mk
1 #
2 # RCSid:
3 #       $Id: auto.dep.mk,v 1.10 2021/12/11 18:57:41 sjg Exp $
4 #
5 #       @(#) Copyright (c) 2010-2021, 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
12 #       left intact.
13 #
14 #       Please send copies of changes and bug-fixes to:
15 #       sjg@crufty.net
16 #
17
18 # This module provides automagic dependency generation along the
19 # lines suggested in the GNU make.info
20
21 # set MKDEP_MK=auto.dep.mk and dep.mk will include us
22
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.
27 #
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.
31 #
32 .if !target(__${.PARSEFILE}__)
33 __${.PARSEFILE}__: .NOTMAIN
34
35 # set this to -MMD to ignore /usr/include
36 # actually it ignores <> so may not be a great idea
37 CFLAGS_MD ?= -MD
38 # -MF etc not available on all gcc versions.
39 .if ${COMPILER_TYPE:Ugcc} == "gcc" && ${COMPILER_VERSION:U0} < 30000
40 CFLAGS_MF=
41 .endif
42 CFLAGS_MF ?= -MF ${.TARGET:T}.d -MT ${.TARGET:T}
43 CFLAGS += ${CFLAGS_MD} ${CFLAGS_MF}
44 CXXFLAGS += ${CFLAGS_MD} ${CFLAGS_MF}
45
46 CLEANFILES += .depend *.d
47
48 .if ${MAKE_VERSION} >= 20160218
49
50 # we have .dinclude and this is all that is required
51 .if empty(_SKIP_BUILD)
52 _all_objs = ${OBJS} ${POBJS} ${SOBJS}
53 .for d in ${_all_objs:M*o:T:O:u:%=%.d}
54 .dinclude <$d>
55 .endfor
56 .endif
57
58 .else                           # we lack .dinclude
59
60 .if ${.MAKE.MODE:Unormal:Mmeta} != ""
61 # ignore .MAKE.DEPENDFILE
62 DEPENDFILE = .depend
63 .else
64 # this what bmake > 20100401 will look for
65 .MAKE.DEPENDFILE ?= .depend
66 DEPENDFILE ?= ${.MAKE.DEPENDFILE}
67 .endif
68
69 CLEANFILES += ${DEPENDFILE}
70
71 # skip generating dependfile for misc targets
72 .if ${.TARGETS:Uall:M*all} != ""
73 .END:   ${DEPENDFILE}
74 .endif
75
76 # doing 'make depend' isn't a big win with this model
77 .if !target(depend)
78 depend: ${DEPENDFILE}
79 .endif
80
81 # this is trivial
82 ${DEPENDFILE}: ${OBJS} ${POBJS} ${SOBJS}
83         -@for f in ${.ALLSRC:M*o:T:O:u:%=%.d}; do \
84                 echo ".-include \"$$f\""; \
85         done > $@
86
87 .endif
88 .endif