Home | History | Annotate | Line # | Download | only in mk
bsd.dep.mk revision 1.36
      1 #	$NetBSD: bsd.dep.mk,v 1.36 2002/11/10 18:15:29 thorpej Exp $
      2 
      3 ##### Basic targets
      4 .PHONY:		cleandepend
      5 cleandir:	cleandepend
      6 realdepend:	beforedepend .depend afterdepend
      7 .ORDER:		beforedepend .depend afterdepend
      8 
      9 beforedepend .depend afterdepend: # ensure existence
     10 
     11 ##### Default values
     12 MKDEP?=		mkdep
     13 
     14 ##### Build rules
     15 # some of the rules involve .h sources, so remove them from mkdep line
     16 
     17 .if defined(SRCS)
     18 .if defined(HAVE_GCC3)
     19 __acpp_flags=
     20 .else
     21 __acpp_flags=	-traditional-cpp
     22 .endif
     23 .NOPATH:	.depend
     24 .depend: ${SRCS} ${DPSRCS}
     25 	@rm -f .depend
     26 	@files="${.ALLSRC:M*.s} ${.ALLSRC:M*.S}"; \
     27 	if [ "$$files" != " " ]; then \
     28 	  echo ${MKDEP} -a ${MKDEPFLAGS} \
     29 	    ${AFLAGS:M-[ID]*:Q} ${CPPFLAGS:Q} ${__acpp_flags} \
     30 	    $$files; \
     31 	  ${MKDEP} -a ${MKDEPFLAGS} \
     32 	    ${AFLAGS:M-[ID]*} ${CPPFLAGS} ${__acpp_flags} $$files; \
     33 	fi
     34 	@files="${.ALLSRC:M*.c}"; \
     35 	if [ "$$files" != "" ]; then \
     36 	  echo ${MKDEP} -a ${MKDEPFLAGS} \
     37 	    ${CFLAGS:M-[ID]*:Q} ${CPPFLAGS:Q} $$files; \
     38 	  ${MKDEP} -a ${MKDEPFLAGS} \
     39 	    ${CFLAGS:M-[ID]*} ${CPPFLAGS} $$files; \
     40 	fi
     41 	@files="${.ALLSRC:M*.m}"; \
     42 	if [ "$$files" != "" ]; then \
     43 	  echo ${MKDEP} -a ${MKDEPFLAGS} \
     44 	    ${OBJCFLAGS:M-[ID]*:Q} ${CPPFLAGS:Q} $$files; \
     45 	  ${MKDEP} -a ${MKDEPFLAGS} \
     46 	    ${OBJCFLAGS:M-[ID]*} ${CPPFLAGS} $$files; \
     47 	fi
     48 	@files="${.ALLSRC:M*.cc} ${.ALLSRC:M*.C} ${.ALLSRC:M*.cxx}"; \
     49 	if [ "$$files" != "  " ]; then \
     50 	  echo ${MKDEP} -a ${MKDEPFLAGS} \
     51 	    ${CXXFLAGS:M-[ID]*:Q} ${CPPFLAGS:Q} $$files; \
     52 	  ${MKDEP} -a ${MKDEPFLAGS} \
     53 	    ${CXXFLAGS:M-[ID]*} ${DESTDIR:D-nostdinc++ ${CPPFLAG_ISYSTEM} ${DESTDIR}/usr/include/g++} ${CPPFLAGS} $$files; \
     54 	fi
     55 .endif # defined(SRCS)
     56 
     57 ##### Clean rules
     58 cleandepend:
     59 .if defined(SRCS)
     60 	rm -f .depend ${.CURDIR}/tags ${CLEANDEPEND}
     61 .endif
     62 
     63 ##### Custom rules
     64 .if !target(tags)
     65 tags: ${SRCS}
     66 .if defined(SRCS)
     67 	-cd ${.CURDIR}; ctags -f /dev/stdout ${.ALLSRC:N*.h} | \
     68 	    sed "s;\${.CURDIR}/;;" > tags
     69 .endif
     70 .endif
     71