1 # $Id: inc.mk,v 1.7 2017/05/06 17:29:45 sjg Exp $
3 # @(#) Copyright (c) 2008, Simon J. Gerraty
5 # This file is provided in the hope that it will
6 # be of use. There is absolutely NO WARRANTY.
7 # Permission to copy, redistribute or otherwise
8 # use this file is hereby granted provided that
9 # the above copyright notice and this notice are
12 # Please send copies of changes and bug-fixes to:
19 INC_INSTALL_OWN ?= -o ${LIBOWN} -g ${LIBGRP}
25 STAGE_INCSDIR?= ${STAGE_OBJTOP}${INCSDIR}
27 # accommodate folk used to freebsd
28 INCGROUPS ?= ${INCSGROUPS:UINCS}
29 INCGROUPS := ${INCGROUPS:O:u}
31 .if !target(buildincludes)
32 .for group in ${INCGROUPS}
33 buildincludes: ${${group}}
37 includes: buildincludes
39 .if !target(incinstall)
40 .for group in ${INCGROUPS}
43 ${group}_INSTALL_OWN ?= ${INC_INSTALL_OWN}
44 ${group}DIR ?= ${INCDIR}
46 # incase we are staging
47 STAGE_DIR.${group} ?= ${STAGE_OBJTOP}${${group}DIR}
49 .for header in ${${group}:O:u}
50 ${group}_INSTALL_OWN.${header:T} ?= ${${group}_INSTALL_OWN}
51 ${group}DIR.${header:T} ?= ${${group}DIR}
52 inc_mkdir_list += ${${group}DIR.${header:T}}
54 .if defined(${group}NAME.${header:T})
55 STAGE_AS_SETS += ${group}
56 STAGE_AS_${header} = ${${group}NAME.${header:T}}
57 stage_as.${group}: ${header}
59 incinstall: incinstall.${group}.${header:T}
60 incinstall.${group}.${header:T}: ${header} inc_mkdirs
61 ${INSTALL} ${INC_COPY} ${${group}_INSTALL_OWN.${header:T}} -m ${INCMODE} ${.ALLSRC:Ninc_mkdirs} ${DESTDIR}${${group}DIR}/${${group}NAME.${header:T}}
64 STAGE_SETS += ${group}
65 stage_files.${group}: ${header}
66 incinstall.${group}: ${header}
67 incinstall: incinstall.${group}
72 incinstall.${group}: inc_mkdirs
73 ${INSTALL} ${INC_COPY} ${${group}_INSTALL_OWN} -m ${INCMODE} \
74 ${.ALLSRC:Ninc_mkdirs:O:u} ${DESTDIR}${${group}DIR}
80 @for d in ${inc_mkdir_list:O:u}; do \
81 test -d ${DESTDIR}$$d || \
82 ${INSTALL} -d ${INC_INSTALL_OWN} -m 775 ${DESTDIR}$$d; \
85 .endif # !target(incinstall)
88 realinstall: incinstall
89 .ORDER: beforeinstall incinstall