Home | History | Annotate | Line # | Download | only in mk
bsd.dep.mk revision 1.43
      1  1.43  christos #	$NetBSD: bsd.dep.mk,v 1.43 2003/06/11 17:24:55 christos 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.43  christos 	@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.34        tv 	    ${CXXFLAGS:M-[ID]*} ${DESTDIR:D-nostdinc++ ${CPPFLAG_ISYSTEM} ${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.39  christos 	 ${SRCS:M*.cxx} ${DPSRCS:M*.cxx} 
     63  1.39  christos 
     64  1.39  christos .depend: ${SRCS} ${DPSRCS} \
     65  1.39  christos 	 ${SRCS_S:C/(.*)/\1.dep/g:S/^.dep$//g} \
     66  1.39  christos 	 ${SRCS_C:C/(.*)/\1.dep/g:S/^.dep$//g} \
     67  1.39  christos 	 ${SRCS_M:C/(.*)/\1.dep/g:S/^.dep$//g} \
     68  1.39  christos 	 ${SRCS_X:C/(.*)/\1.dep/g:S/^.dep$//g}
     69  1.39  christos 	@rm -f .depend
     70  1.39  christos 	@cat ${.ALLSRC:M*.dep} > .depend
     71  1.39  christos 
     72  1.39  christos .for F in ${SRCS_S:O:u}
     73  1.39  christos .NOPATH: ${F:C/(.*)/\1.dep/g}
     74  1.39  christos ${F:C/(.*)/\1.dep/g}: ${F}
     75  1.39  christos 	@echo ${MKDEP} -a -f $@ ${MKDEPFLAGS} \
     76  1.39  christos 	    ${AFLAGS:M-[ID]*:Q} ${CPPFLAGS:Q} ${__acpp_flags} ${AINC:Q} \
     77  1.39  christos 	    ${.ALLSRC}
     78  1.39  christos 	@${MKDEP} -a -f $@ ${MKDEPFLAGS} ${AFLAGS:M-[ID]*} ${CPPFLAGS} \
     79  1.39  christos 	    ${__acpp_flags} ${AINC} ${.ALLSRC}
     80  1.39  christos .endfor
     81  1.39  christos 
     82  1.39  christos .for F in ${SRCS_C:O:u}
     83  1.39  christos .NOPATH: ${F:C/(.*)/\1.dep/g}
     84  1.39  christos ${F:C/(.*)/\1.dep/g}: ${F}
     85  1.39  christos 	@echo ${MKDEP} -a -f $@ ${MKDEPFLAGS} ${CFLAGS:M-[ID]*:Q} \
     86  1.39  christos 	    ${CPPFLAGS:Q} ${.ALLSRC}
     87  1.39  christos 	@${MKDEP} -a -f $@ ${MKDEPFLAGS} ${CFLAGS:M-[ID]*} ${CPPFLAGS} \
     88  1.39  christos 	    ${.ALLSRC}
     89  1.39  christos .endfor
     90  1.39  christos 
     91  1.39  christos .for F in ${SRCS_M:O:u}
     92  1.39  christos .NOPATH: ${F:C/(.*)/\1.dep/g}
     93  1.39  christos ${F:C/(.*)/\1.dep/g}: ${F}
     94  1.39  christos 	@echo ${MKDEP} -a -f $@ ${MKDEPFLAGS} ${OBJCFLAGS:M-[ID]*:Q} \
     95  1.39  christos 	    ${CPPFLAGS:Q} ${.ALLSRC}
     96  1.39  christos 	@${MKDEP} -a -f $@ ${MKDEPFLAGS} ${OBJCFLAGS:M-[ID]*} ${CPPFLAGS} \
     97  1.39  christos 	    ${.ALLSRC}
     98  1.39  christos .endfor
     99  1.39  christos 
    100  1.39  christos .for F in ${SRCS_X:O:u}
    101  1.39  christos .NOPATH: ${F:C/(.*)/\1.dep/g}
    102  1.39  christos ${F:C/(.*)/\1.dep/g}: ${F}
    103  1.39  christos 	@echo ${MKDEP} -a -f $@ ${MKDEPFLAGS} \
    104  1.39  christos 	    ${CXXFLAGS:M-[ID]*:Q} ${CPPFLAGS:Q} ${.ALLSRC}
    105  1.39  christos 	@${MKDEP} -a -f $@ ${MKDEPFLAGS} ${CXXFLAGS:M-[ID]*} \
    106  1.39  christos 	    ${DESTDIR:D-nostdinc++ ${CPPFLAG_ISYSTEM} \
    107  1.39  christos 	    ${DESTDIR}/usr/include/g++} ${CPPFLAGS} ${.ALLSRC}
    108  1.39  christos .endfor
    109  1.39  christos 
    110  1.39  christos .endif # Cygwin
    111  1.33        tv .endif # defined(SRCS)
    112  1.33        tv 
    113  1.33        tv ##### Clean rules
    114  1.19   mycroft cleandepend:
    115  1.33        tv .if defined(SRCS)
    116  1.27  sommerfe 	rm -f .depend ${.CURDIR}/tags ${CLEANDEPEND}
    117   1.3   mycroft .endif
    118   1.2   mycroft 
    119  1.33        tv ##### Custom rules
    120   1.2   mycroft .if !target(tags)
    121  1.33        tv tags: ${SRCS}
    122   1.4   mycroft .if defined(SRCS)
    123   1.2   mycroft 	-cd ${.CURDIR}; ctags -f /dev/stdout ${.ALLSRC:N*.h} | \
    124   1.2   mycroft 	    sed "s;\${.CURDIR}/;;" > tags
    125   1.4   mycroft .endif
    126   1.4   mycroft .endif
    127