Home | History | Annotate | Line # | Download | only in mk
bsd.inc.mk revision 1.8
      1 #	$NetBSD: bsd.inc.mk,v 1.8 1997/05/26 03:58:00 cjs Exp $
      2 #
      3 # If an include file is already installed, this always compares the
      4 # installed file to the one we are about to install. If they are the
      5 # same, it doesn't do the install. This is to avoid triggering massive
      6 # amounts of rebuilding.
      7 #
      8 # Targets:
      9 #
     10 # includes:
     11 #	Installs the include files in BUILDDIR if we are using one, DESTDIR
     12 #	otherwise. This is to be run before `make depend' or `make'.
     13 #
     14 # install:
     15 #	Installs the include files in DESTDIR.
     16 #
     17 
     18 .PHONY:		incbuild incinstall
     19 
     20 .if defined(INCS)
     21 
     22 .for I in ${INCS}
     23 
     24 .if defined(OBJDIR)
     25 .PRECIOUS: ${BUILDDIR}${INCSDIR}/$I
     26 ${BUILDDIR}${INCSDIR}/$I: $I
     27 	@cmp -s ${.ALLSRC} ${.TARGET} > /dev/null 2>&1 || \
     28 	    (echo "${INSTALL} -d `dirname ${.TARGET}`" && \
     29 	    ${INSTALL} -d `dirname ${.TARGET}` && \
     30 	    echo "${INSTALL} -c -m ${NONBINMODE} ${.ALLSRC} ${.TARGET}" && \
     31 	     ${INSTALL} -c -m ${NONBINMODE} ${.ALLSRC} ${.TARGET})
     32 
     33 incbuild:: ${BUILDDIR}${INCSDIR}/$I
     34 .else
     35 incbuild:: ${DESTDIR}${INCSDIR}/$I
     36 .endif	# defined(OBJDIR)
     37 
     38 .PRECIOUS: ${DESTDIR}${INCSDIR}/$I
     39 ${DESTDIR}${INCSDIR}/$I: $I
     40 	@cmp -s ${.ALLSRC} ${.TARGET} > /dev/null 2>&1 || \
     41 	    (echo "${INSTALL} -c -o ${BINOWN} -g ${BINGRP} -m ${NONBINMODE} \
     42 		${.ALLSRC} ${.TARGET}" && \
     43 	     ${INSTALL} -c -o ${BINOWN} -g ${BINGRP} -m ${NONBINMODE} \
     44 		${.ALLSRC} ${.TARGET})
     45 
     46 incinstall:: ${DESTDIR}${INCSDIR}/$I
     47 .endfor
     48 
     49 includes:	${INCS} incbuild
     50 
     51 install:	${INCS} incinstall
     52 
     53 .endif	# defined(INCS)
     54 
     55 .if !target(incbuild)
     56 incbuild::
     57 .endif
     58 
     59 .if !target(incinstall)
     60 incinstall::
     61 .endif
     62