1 1.47 mrg # $NetBSD: bsd.dep.mk,v 1.47 2003/07/27 14:49:22 mrg Exp $ 2 1.13 gwr 3 1.33 tv ##### Basic targets 4 1.15 mycroft .PHONY: cleandepend 5 1.32 tv cleandir: cleandepend 6 1.33 tv realdepend: beforedepend .depend afterdepend 7 1.33 tv .ORDER: beforedepend .depend afterdepend 8 1.14 mycroft 9 1.33 tv beforedepend .depend afterdepend: # ensure existence 10 1.33 tv 11 1.33 tv ##### Default values 12 1.14 mycroft MKDEP?= mkdep 13 1.1 mycroft 14 1.33 tv ##### Build rules 15 1.1 mycroft # some of the rules involve .h sources, so remove them from mkdep line 16 1.33 tv 17 1.1 mycroft .if defined(SRCS) 18 1.35 thorpej __acpp_flags= -traditional-cpp 19 1.33 tv .NOPATH: .depend 20 1.40 christos .if empty(HOST_CYGWIN) 21 1.20 mycroft .depend: ${SRCS} ${DPSRCS} 22 1.12 christos @rm -f .depend 23 1.12 christos @files="${.ALLSRC:M*.s} ${.ALLSRC:M*.S}"; \ 24 1.6 cgd if [ "$$files" != " " ]; then \ 25 1.13 gwr echo ${MKDEP} -a ${MKDEPFLAGS} \ 26 1.37 thorpej ${AFLAGS:M-[ID]*:Q} ${CPPFLAGS:Q} ${__acpp_flags} ${AINC:Q} \ 27 1.28 minoura $$files; \ 28 1.13 gwr ${MKDEP} -a ${MKDEPFLAGS} \ 29 1.37 thorpej ${AFLAGS:M-[ID]*} ${CPPFLAGS} ${__acpp_flags} ${AINC} $$files; \ 30 1.5 mycroft fi 31 1.12 christos @files="${.ALLSRC:M*.c}"; \ 32 1.1 mycroft if [ "$$files" != "" ]; then \ 33 1.13 gwr echo ${MKDEP} -a ${MKDEPFLAGS} \ 34 1.25 tv ${CFLAGS:M-[ID]*:Q} ${CPPFLAGS:Q} $$files; \ 35 1.13 gwr ${MKDEP} -a ${MKDEPFLAGS} \ 36 1.13 gwr ${CFLAGS:M-[ID]*} ${CPPFLAGS} $$files; \ 37 1.22 tv fi 38 1.22 tv @files="${.ALLSRC:M*.m}"; \ 39 1.23 tv if [ "$$files" != "" ]; then \ 40 1.22 tv echo ${MKDEP} -a ${MKDEPFLAGS} \ 41 1.25 tv ${OBJCFLAGS:M-[ID]*:Q} ${CPPFLAGS:Q} $$files; \ 42 1.22 tv ${MKDEP} -a ${MKDEPFLAGS} \ 43 1.22 tv ${OBJCFLAGS:M-[ID]*} ${CPPFLAGS} $$files; \ 44 1.1 mycroft fi 45 1.45 wiz @files="${.ALLSRC:M*.cc} ${.ALLSRC:M*.C} ${.ALLSRC:M*.cxx} ${.ALLSRC:M*.cpp}"; \ 46 1.43 christos if [ "$$files" != " " ]; then \ 47 1.13 gwr echo ${MKDEP} -a ${MKDEPFLAGS} \ 48 1.25 tv ${CXXFLAGS:M-[ID]*:Q} ${CPPFLAGS:Q} $$files; \ 49 1.13 gwr ${MKDEP} -a ${MKDEPFLAGS} \ 50 1.47 mrg ${CXXFLAGS:M-[ID]*} ${DESTDIR:D-nostdinc++ ${CPPFLAG_ISYSTEMXX} ${DESTDIR}/usr/include/g++} ${CPPFLAGS} $$files; \ 51 1.1 mycroft fi 52 1.39 christos .else 53 1.39 christos # 54 1.39 christos # Cygwin workarounds for limited environment & command line space 55 1.39 christos # 56 1.39 christos 57 1.39 christos SRCS_S = ${SRCS:M*.[sS]} ${DPSRCS:M*.[sS]} 58 1.39 christos SRCS_C = ${SRCS:M*.c} ${DPSRCS:M*.c} 59 1.39 christos SRCS_M = ${SRCS:M*.m} ${DPSRCS:M*.m} 60 1.39 christos SRCS_X = ${SRCS:M*.C} ${DPSRCS:M*.C} \ 61 1.39 christos ${SRCS:M*.cc} ${DPSRCS:M*.cc} \ 62 1.44 wiz ${SRCS:M*.cpp} ${DPSRCS:M*.cpp} \ 63 1.46 lukem ${SRCS:M*.cxx} ${DPSRCS:M*.cxx} 64 1.39 christos 65 1.39 christos .depend: ${SRCS} ${DPSRCS} \ 66 1.39 christos ${SRCS_S:C/(.*)/\1.dep/g:S/^.dep$//g} \ 67 1.39 christos ${SRCS_C:C/(.*)/\1.dep/g:S/^.dep$//g} \ 68 1.39 christos ${SRCS_M:C/(.*)/\1.dep/g:S/^.dep$//g} \ 69 1.39 christos ${SRCS_X:C/(.*)/\1.dep/g:S/^.dep$//g} 70 1.39 christos @rm -f .depend 71 1.39 christos @cat ${.ALLSRC:M*.dep} > .depend 72 1.39 christos 73 1.39 christos .for F in ${SRCS_S:O:u} 74 1.39 christos .NOPATH: ${F:C/(.*)/\1.dep/g} 75 1.39 christos ${F:C/(.*)/\1.dep/g}: ${F} 76 1.39 christos @echo ${MKDEP} -a -f $@ ${MKDEPFLAGS} \ 77 1.39 christos ${AFLAGS:M-[ID]*:Q} ${CPPFLAGS:Q} ${__acpp_flags} ${AINC:Q} \ 78 1.39 christos ${.ALLSRC} 79 1.39 christos @${MKDEP} -a -f $@ ${MKDEPFLAGS} ${AFLAGS:M-[ID]*} ${CPPFLAGS} \ 80 1.39 christos ${__acpp_flags} ${AINC} ${.ALLSRC} 81 1.39 christos .endfor 82 1.39 christos 83 1.39 christos .for F in ${SRCS_C:O:u} 84 1.39 christos .NOPATH: ${F:C/(.*)/\1.dep/g} 85 1.39 christos ${F:C/(.*)/\1.dep/g}: ${F} 86 1.39 christos @echo ${MKDEP} -a -f $@ ${MKDEPFLAGS} ${CFLAGS:M-[ID]*:Q} \ 87 1.39 christos ${CPPFLAGS:Q} ${.ALLSRC} 88 1.39 christos @${MKDEP} -a -f $@ ${MKDEPFLAGS} ${CFLAGS:M-[ID]*} ${CPPFLAGS} \ 89 1.39 christos ${.ALLSRC} 90 1.39 christos .endfor 91 1.39 christos 92 1.39 christos .for F in ${SRCS_M:O:u} 93 1.39 christos .NOPATH: ${F:C/(.*)/\1.dep/g} 94 1.39 christos ${F:C/(.*)/\1.dep/g}: ${F} 95 1.39 christos @echo ${MKDEP} -a -f $@ ${MKDEPFLAGS} ${OBJCFLAGS:M-[ID]*:Q} \ 96 1.39 christos ${CPPFLAGS:Q} ${.ALLSRC} 97 1.39 christos @${MKDEP} -a -f $@ ${MKDEPFLAGS} ${OBJCFLAGS:M-[ID]*} ${CPPFLAGS} \ 98 1.39 christos ${.ALLSRC} 99 1.39 christos .endfor 100 1.39 christos 101 1.39 christos .for F in ${SRCS_X:O:u} 102 1.39 christos .NOPATH: ${F:C/(.*)/\1.dep/g} 103 1.39 christos ${F:C/(.*)/\1.dep/g}: ${F} 104 1.39 christos @echo ${MKDEP} -a -f $@ ${MKDEPFLAGS} \ 105 1.39 christos ${CXXFLAGS:M-[ID]*:Q} ${CPPFLAGS:Q} ${.ALLSRC} 106 1.39 christos @${MKDEP} -a -f $@ ${MKDEPFLAGS} ${CXXFLAGS:M-[ID]*} \ 107 1.47 mrg ${DESTDIR:D-nostdinc++ ${CPPFLAG_ISYSTEMXX} \ 108 1.39 christos ${DESTDIR}/usr/include/g++} ${CPPFLAGS} ${.ALLSRC} 109 1.39 christos .endfor 110 1.39 christos 111 1.39 christos .endif # Cygwin 112 1.33 tv .endif # defined(SRCS) 113 1.33 tv 114 1.33 tv ##### Clean rules 115 1.19 mycroft cleandepend: 116 1.33 tv .if defined(SRCS) 117 1.27 sommerfe rm -f .depend ${.CURDIR}/tags ${CLEANDEPEND} 118 1.3 mycroft .endif 119 1.2 mycroft 120 1.33 tv ##### Custom rules 121 1.2 mycroft .if !target(tags) 122 1.33 tv tags: ${SRCS} 123 1.4 mycroft .if defined(SRCS) 124 1.2 mycroft -cd ${.CURDIR}; ctags -f /dev/stdout ${.ALLSRC:N*.h} | \ 125 1.2 mycroft sed "s;\${.CURDIR}/;;" > tags 126 1.4 mycroft .endif 127 1.4 mycroft .endif 128