1 # $Id: files.mk,v 1.6 2017/05/07 02:21:02 sjg Exp $
3 # @(#) Copyright (c) 2017, 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:
18 FILES_INSTALL_OWN ?
= -o
${SHAREOWN} -g
${SHAREGRP}
19 FILESMODE ?
= ${SHAREMODE}
23 FILESGROUPS
:= ${FILESGROUPS
:O
:u
}
25 .if
!target
(buildfiles
)
26 .for group in
${FILESGROUPS}
27 buildfiles
: ${${group}}
33 # there is no default FILESDIR so
34 # ignore group if ${group}DIR is not defined
35 .for group in
${FILESGROUPS}
36 .if
!empty
(${group}) && defined
(${group}DIR
)
37 .if
${group} != "FILES"
38 ${group}_INSTALL_OWN ?
= ${FILES_INSTALL_OWN}
40 # incase we are staging
41 STAGE_DIR.
${group} ?
= ${STAGE_OBJTOP}${${group}DIR
}
43 .for file in
${${group}:O
:u
}
44 ${group}_INSTALL_OWN.
${file
:T
} ?
= ${${group}_INSTALL_OWN
}
45 ${group}DIR.
${file
:T
} ?
= ${${group}DIR
}
46 file_mkdir_list
+= ${${group}DIR.
${file
:T
}}
48 .if defined
(${group}NAME.
${file
:T
})
49 STAGE_AS_SETS
+= ${group}
50 STAGE_AS_
${file} = ${${group}NAME.
${file
:T
}}
51 stage_as.
${group}: ${file}
53 installfiles
: installfiles.
${group}.
${file
:T
}
54 installfiles.
${group}.
${file
:T
}: ${file} file_mkdirs
55 ${INSTALL} ${FILES_COPY} ${${group}_INSTALL_OWN.
${file
:T
}} \
56 -m
${FILESMODE} ${.ALLSRC
:Nfile_mkdirs
} ${DESTDIR}${${group}DIR
}/${${group}NAME.
${file
:T
}}
59 STAGE_SETS
+= ${group}
60 stage_files.
${group}: ${file}
61 installfiles.
${group}: ${file}
62 installfiles
: installfiles.
${group}
67 installfiles.
${group}: file_mkdirs
68 ${INSTALL} ${FILES_COPY} ${${group}_INSTALL_OWN
} -m
${FILESMODE} \
69 ${.ALLSRC
:Nfile_mkdirs
:O
:u
} ${DESTDIR}${${group}DIR
}
75 @for d in
${file_mkdir_list
:O
:u
}; do \
76 test -d
${DESTDIR}$$d || \
77 ${INSTALL} -d
${FILES_INSTALL_OWN} -m
755 ${DESTDIR}$$d; \
82 realinstall
: installfiles
83 .ORDER
: beforeinstall installfiles