Home | History | Annotate | Line # | Download | only in mk
bsd.dep.mk revision 1.34
      1 #	$NetBSD: bsd.dep.mk,v 1.34 2001/11/28 04:38:29 tv 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 .NOPATH:	.depend
     19 .depend: ${SRCS} ${DPSRCS}
     20 	@rm -f .depend
     21 	@files="${.ALLSRC:M*.s} ${.ALLSRC:M*.S}"; \
     22 	if [ "$$files" != " " ]; then \
     23 	  echo ${MKDEP} -a ${MKDEPFLAGS} \
     24 	    ${AFLAGS:M-[ID]*:Q} ${CPPFLAGS:Q} -traditional-cpp ${AINC:Q} \
     25 	    $$files; \
     26 	  ${MKDEP} -a ${MKDEPFLAGS} \
     27 	    ${AFLAGS:M-[ID]*} ${CPPFLAGS} -traditional-cpp ${AINC} $$files; \
     28 	fi
     29 	@files="${.ALLSRC:M*.c}"; \
     30 	if [ "$$files" != "" ]; then \
     31 	  echo ${MKDEP} -a ${MKDEPFLAGS} \
     32 	    ${CFLAGS:M-[ID]*:Q} ${CPPFLAGS:Q} $$files; \
     33 	  ${MKDEP} -a ${MKDEPFLAGS} \
     34 	    ${CFLAGS:M-[ID]*} ${CPPFLAGS} $$files; \
     35 	fi
     36 	@files="${.ALLSRC:M*.m}"; \
     37 	if [ "$$files" != "" ]; then \
     38 	  echo ${MKDEP} -a ${MKDEPFLAGS} \
     39 	    ${OBJCFLAGS:M-[ID]*:Q} ${CPPFLAGS:Q} $$files; \
     40 	  ${MKDEP} -a ${MKDEPFLAGS} \
     41 	    ${OBJCFLAGS:M-[ID]*} ${CPPFLAGS} $$files; \
     42 	fi
     43 	@files="${.ALLSRC:M*.cc} ${.ALLSRC:M*.C} ${.ALLSRC:M*.cxx}"; \
     44 	if [ "$$files" != "  " ]; then \
     45 	  echo ${MKDEP} -a ${MKDEPFLAGS} \
     46 	    ${CXXFLAGS:M-[ID]*:Q} ${CPPFLAGS:Q} $$files; \
     47 	  ${MKDEP} -a ${MKDEPFLAGS} \
     48 	    ${CXXFLAGS:M-[ID]*} ${DESTDIR:D-nostdinc++ ${CPPFLAG_ISYSTEM} ${DESTDIR}/usr/include/g++} ${CPPFLAGS} $$files; \
     49 	fi
     50 .endif # defined(SRCS)
     51 
     52 ##### Clean rules
     53 cleandepend:
     54 .if defined(SRCS)
     55 	rm -f .depend ${.CURDIR}/tags ${CLEANDEPEND}
     56 .endif
     57 
     58 ##### Custom rules
     59 .if !target(tags)
     60 tags: ${SRCS}
     61 .if defined(SRCS)
     62 	-cd ${.CURDIR}; ctags -f /dev/stdout ${.ALLSRC:N*.h} | \
     63 	    sed "s;\${.CURDIR}/;;" > tags
     64 .endif
     65 .endif
     66