bsd.inc.mk revision 1.8.2.1 1 # $NetBSD: bsd.inc.mk,v 1.8.2.1 1997/08/01 21:08: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 # $NetBSD: bsd.inc.mk,v 1.8.2.1 1997/08/01 21:08:00 cjs Exp $
18
19 .PHONY: incbuild incinstall
20
21 .if defined(INCS)
22
23 .for I in ${INCS}
24
25 .if defined(OBJDIR)
26 .PRECIOUS: ${BUILDDIR}${INCSDIR}/$I
27 ${BUILDDIR}${INCSDIR}/$I: $I
28 @cmp -s ${.ALLSRC} ${.TARGET} > /dev/null 2>&1 || \
29 (echo "${INSTALL} -d `dirname ${.TARGET}`" && \
30 ${INSTALL} -d `dirname ${.TARGET}` && \
31 echo "${INSTALL} -c -m ${NONBINMODE} ${.ALLSRC} ${.TARGET}" && \
32 ${INSTALL} -c -m ${NONBINMODE} ${.ALLSRC} ${.TARGET})
33
34 incbuild:: ${BUILDDIR}${INCSDIR}/$I
35 .else
36 incbuild:: ${DESTDIR}${INCSDIR}/$I
37 .endif # defined(OBJDIR)
38
39 .PRECIOUS: ${DESTDIR}${INCSDIR}/$I
40 .if !defined(UPDATE)
41 .PHONY: ${DESTDIR}${INCSDIR}/$I
42 .endif
43 ${DESTDIR}${INCSDIR}/$I: $I
44 @cmp -s ${.ALLSRC} ${.TARGET} > /dev/null 2>&1 || \
45 (echo "${INSTALL} -c -o ${BINOWN} -g ${BINGRP} -m ${NONBINMODE} \
46 ${.ALLSRC} ${.TARGET}" && \
47 ${INSTALL} -c -o ${BINOWN} -g ${BINGRP} -m ${NONBINMODE} \
48 ${.ALLSRC} ${.TARGET})
49
50 incinstall:: ${DESTDIR}${INCSDIR}/$I
51 .endfor
52
53 includes: ${INCS} incbuild
54
55 install: ${INCS} incinstall
56
57 .endif # defined(INCS)
58
59 .if !target(incbuild)
60 incbuild::
61 .endif
62
63 .if !target(incinstall)
64 incinstall::
65 .endif
66