lib/fm/topo/module: build 64-bit
[unleashed.git] / share / mk / manifest.mk
blob36e97e93b2a09c9a3944af37680a233fb6c4d54d
1 # $Id: manifest.mk,v 1.2 2014/10/31 18:06:17 sjg Exp $
3 # @(#) Copyright (c) 2014, 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
10 # left intact.
12 # Please send copies of changes and bug-fixes to:
13 # sjg@crufty.net
16 # generate mtree style manifest supported by makefs in FreeBSD
18 # input looks like
19 # MANIFEST= my.mtree
20 # for each MANIFEST we have a list of dirs
21 # ${MANIFEST}.DIRS += bin sbin usr/bin ...
22 # for each dir we have a ${MANIFEST}.SRCS.$dir
23 # that provides the absolute path to the contents
24 # ${MANIFEST}.SRCS.bin += ${OBJTOP}/bin/sh/sh
25 # ${MANIFEST}.SYMLINKS is a list of src target pairs
26 # for each file/dir there are a number of attributes
27 # UID GID MODE FLAGS
28 # which can be set per dir, per file or we use defaults
29 # eg.
30 # MODE.sbin = 550
31 # MODE.usr/sbin = 550
32 # MODE.dirs = 555
33 # means that sbin and usr/sbin get 550 all other dirs get 555
34 # MODE.usr/bin/passwd = 4555
35 # MODE.usr/bin.files = 555
36 # MODE.usr/sbin.files = 500
37 # means passwd gets 4555 other files in usr/bin get 555 and
38 # files in usr/sbin get 500
39 # STORE defaults to basename of src and target directory
40 # but we can use
41 # ${MANIFEST}.SRCS.sbin += ${OBJTOP}/bin/sh-static/sh-static
42 # STORE.sbin/sh-static = sbin/sh
44 # the above is a little overkill but means we can easily adapt to
45 # different formats
47 UID.dirs ?= 0
48 GID.dirs ?= 0
49 MODE.dirs ?= 755
50 FLAGS.dirs ?=
52 UID.files ?= 0
53 GID.files ?= 0
54 MODE.files ?= 555
56 # a is attribute name d is dirname
57 M_DIR_ATTR = L:@a@$${$$a.$$d:U$${$$a.dirs}}@
58 # as above and s is set to the name we store f as
59 M_FILE_ATTR = L:@a@$${$$a.$$s:U$${$$a.$$d.files:U$${$$a.files}}}@
61 # this produces the body of the manifest
62 # there should typically be a header prefixed
63 _GEN_MTREE_MANIFEST_USE: .USE
64 @(${${.TARGET}.DIRS:O:u:@d@echo '$d type=dir uid=${UID:${M_DIR_ATTR}} gid=${GID:${M_DIR_ATTR}} mode=${MODE:${M_DIR_ATTR}} ${FLAGS:${M_DIR_ATTR}}';@} \
65 ${${.TARGET}.DIRS:O:u:@d@${${.TARGET}.SRCS.$d:O:u:@f@echo '${s::=${STORE.$d/${f:T}:U$d/${f:T}}}$s contents="$f" type=file uid=${UID:${M_FILE_ATTR}} gid=${GID:${M_FILE_ATTR}} mode=${MODE:${M_FILE_ATTR}} ${FLAGS:${M_FILE_ATTR}}';@}@} \
66 set ${${.TARGET}.SYMLINKS}; while test $$# -ge 2; do echo "$$2 type=link link=$$1"; shift 2; done) > ${.TARGET}