1# $MirOS: src/share/mk/bsd.dep.mk,v 1.14 2008/04/10 14:07:45 tg Exp $ 2# $OpenBSD: bsd.dep.mk,v 1.5 2003/08/07 11:24:03 espie Exp $ 3# $NetBSD: bsd.dep.mk,v 1.12 1995/09/27 01:15:09 christos Exp $ 4 5.if !defined(BSD_DEP_MK) 6BSD_DEP_MK=1 7 8# some of the rules involve .h sources, so remove them from mkdep line 9# add them to the beforedepend target 10.if !target(depend) 11depend: beforedepend .depend _SUBDIRUSE afterdepend 12. if defined(SRCS) 13.depend: ${SRCS:S/.l$/.c/:S/.y$/.c/} 14 @rm -f .depend 15 @files="${.ALLSRC:M*.s} ${.ALLSRC:M*.S}"; \ 16 if [[ $$files != *( ) ]]; then \ 17 print -r -- ${MKDEP_SH} -a ${MKDEP} -D_ASM_SOURCE \ 18 ${AFLAGS:M-[ID]*} ${CPPFLAGS} ${AINC} $$files; \ 19 CC=${CC:Q} ${MKDEP_SH} -a ${MKDEP} -D_ASM_SOURCE \ 20 ${AFLAGS:M-[ID]*} ${CPPFLAGS} ${AINC} $$files; \ 21 fi 22 @files="${.ALLSRC:M*.c} ${.ALLSRC:M*.m}"; \ 23 if [[ $$files != *( ) ]]; then \ 24 print -r -- ${MKDEP_SH} -a ${MKDEP} ${CFLAGS:M-[ID]*} \ 25 ${CPPFLAGS} $$files; \ 26 CC=${CC:Q} ${MKDEP_SH} -a ${MKDEP} ${CFLAGS:M-[ID]*} \ 27 ${CPPFLAGS} $$files; \ 28 fi 29 @files="${.ALLSRC:M*.cc} ${.ALLSRC:M*.C} ${.ALLSRC:M*.cxx} ${.ALLSRC:M*.cpp}"; \ 30 if [[ $$files != *( ) ]]; then \ 31 print -r -- ${MKDEP_SH} -a ${MKDEP} ${CXXFLAGS:M-[ID]*} \ 32 ${CPPFLAGS} $$files; \ 33 CC=${CXX:Q} ${MKDEP_SH} -a ${MKDEP} ${CXXFLAGS:M-[ID]*} \ 34 ${CPPFLAGS} $$files; \ 35 fi 36. else 37.depend: 38. endif 39. if !target(beforedepend) 40beforedepend: 41. endif 42. if !target(afterdepend) 43afterdepend: 44. endif 45.endif # not target depend 46 47.if !target(tags) 48. if defined(SRCS) 49tags: ${SRCS} _SUBDIRUSE 50 -cd ${.CURDIR} && ${CTAGS} -f /dev/stdout ${.ALLSRC:N*.h} | \ 51 sed 's${.CURDIR}/' >tags 52. else 53tags: 54. endif 55.endif 56 57.if defined(SRCS) 58cleandir: cleandepend 59cleandepend: 60 rm -f .depend ${.CURDIR}/tags 61.endif 62 63.if exists(${.CURDIR}/Makefile.bsd-wrapper) 64.depend: ${.CURDIR}/Makefile.bsd-wrapper 65.elif exists(${.CURDIR}/BSDmakefile) 66.depend: ${.CURDIR}/BSDmakefile 67.elif exists(${.CURDIR}/makefile) 68.depend: ${.CURDIR}/makefile 69.elif exists(${.CURDIR}/Makefile) 70.depend: ${.CURDIR}/Makefile 71.endif 72 73.PHONY: beforedepend depend afterdepend cleandepend 74 75.endif 76