Remove building with NOCRYPTO option
[minix3.git] / distrib / common / Makefile.mdset
blob6844642ea71f756f08dd44194076d40aedc9447b
1 #       $NetBSD: Makefile.mdset,v 1.40 2014/08/05 15:40:58 apb Exp $
3 # Makefile snippet to ${TOOL_MDSETIMAGE} file system images into kernels
7 # Required variables:
8 #       NETBSDSRCDIR    Top level of src tree (set by <bsd.own.mk>)
9 #       MDSETTARGETS    List of images to ${TOOL_MDSETIMAGE} into kernels,
10 #                       containing one or more tuples of the form:
11 #                               KERNEL  IMAGE   FILENAME
13 #                       The kernel is ${TOOL_MDSETIMAGE} with ${IMAGE},
14 #                       ${STRIP}ped (after the symbols are stored in
15 #                       ${FILENAME}.symbols.gz), and gzipped into
16 #                       ${FILENAME}.gz.
18 #                       If KERNEL does not contain a `/', use
19 #                       ${KERNOBJDIR}/KERNEL/netbsd as the kernel.
21 #                       If FILENAME is "-", use "netbsd-${KERNEL}" as
22 #                       the target name.  This may not be a sensible
23 #                       name if KERNEL contains a `/'.
25 # Optional variables:
26 #       MDSET_RELEASEDIR                Where to install release kernels.
28 #       MDSET_NOGZIP                    If defined, don't gzip any kernels.
30 #       MDSET_NOGZIP.${FILENAME}        If defined, don't gzip ${FILENAME}
32 #       MDSET_NOIMAGE.${FILENAME}       If defined, don't add ${IMAGE} to
33 #                                       ${FILENAME}
35 #       MDSET_NOSTRIP                   If defined, don't strip any kernels.
37 #       MDSET_NOSTRIP.${FILENAME}       If defined, don't strip ${FILENAME}
39 #       MDSET_NOSYMBOLS                 If defined, don't generate *.symbols.gz
41 #       MDSET_NOSYMBOLS.${FILENAME}     If defined, don't generate
42 #                                       ${FILENAME}.symbols.gz
44 #       MDSET_POST                      For each kernel,
45 #                                       execute this after ${NM} / ${STRIP}.
46 #                                       Kernel is available as "${.TARGET}"
48 #       MDSET_POST.${FILENAME}          For each kernel named ${FILENAME},
49 #                                       execute this after ${NM} / ${STRIP}.
50 #                                       Kernel is available as "${.TARGET}"
52 #       MDSET_SUFFIXES.${FILENAME}      List of extra install kernel suffixes
53 #                                       and build commands to create from
54 #                                       ${FILENAME} after its created by
55 #                                       ${TOOL_MDSETIMAGE} ; ${NM} ; ${STRIP}:
56 #                                               SUFFIX  COMMANDVAR
57 #                                       "${.TARGET}" is "${FILENAME}.${SUFFIX}"
58 #                                       COMMANDVAR is the name of the variable
59 #                                       containing the command to build
60 #                                       ${.TARGET}.
62 # Variables modified by this:
63 #       KERNELS                 List of kernel .gz files to build
64 #       KERNELSYMS              List of kernel .symbol.gz files to build
67 .if !defined(_MAKEFILE_MDSET_)
68 _MAKEFILE_MDSET_=1
70 .include <bsd.kernobj.mk>
72 # The default is to build for all MDSETTARGETS
73 ALL_KERNELS?= +
75 .for _K _I _F in ${MDSETTARGETS}                        # {
76 .for currentsel in ${ALL_KERNELS}                       # {
77 .if ${currentsel} == "+" || ${_K} == ${currentsel}
79 _KERNEL:=${_K}                  # (work around obscure issue in make(1))
80 .if (${_KERNEL:M*/*} != "")
81 _KERNNAME.${_K}.${_F}:= ${_K}
82 .else
83 _KERNNAME.${_K}.${_F}:= ${KERNOBJDIR}/${_K}/netbsd
84 .endif
86 _FILENAME:=${_F}                # (work around obscure issue in make(1))
87 .if ${_FILENAME} == "-"
88 _KERNEL.${_K}.${_F}:=   netbsd-${_K}
89 _FILENAME:=             ${_KERNEL.${_K}.${_F}}
90 .else
91 _KERNEL.${_K}.${_F}:=   ${_F}
92 .endif
94 .for _S _C in ${MDSET_SUFFIXES.${_F}}           # {
95 CLEANFILES+=    ${_KERNEL.${_K}.${_F}}.${_S}
97 ${_KERNEL.${_K}.${_F}}.${_S}: ${_KERNEL.${_K}.${_F}}
98 .if defined(${_C})
99         ${${_C}}
100 .else
101         @echo "No such variable \"${_C}\""
102         false
103 .endif
105 .if defined(MDSET_NOGZIP.${_FILENAME}) && defined(MDSET_NOGZIP)
106 KERNELS+=       ${_KERNEL.${_K}.${_F}}.${_S}
107 .else                                                   # {
108 KERNELS+=       ${_KERNEL.${_K}.${_F}}.${_S}.gz
110 ${_KERNEL.${_K}.${_F}}.${_S}.gz: ${_KERNEL.${_K}.${_F}}.${_S}
111         ${_MKTARGET_CREATE}
112         -rm -f ${.TARGET}
113         ${TOOL_GZIP_N} -9c ${.ALLSRC} > ${.TARGET}
114 .endif                                                  # }
116 .endfor                                                 # }
118 .if !defined(MDSET_NOSYMBOLS.${_FILENAME}) && !defined(MDSET_NOSYMBOLS)
119 KERNELSYMS+=    ${_KERNEL.${_K}.${_F}}.symbols.gz
120 .endif
122 .if defined(MDSET_POST.${_FILENAME})
123 _POST.${_KERNEL.${_K}.${_F}}:= ${MDSET_POST.${_FILENAME}}
124 .elif defined(MDSET_POST)
125 _POST.${_KERNEL.${_K}.${_F}}:= ${MDSET_POST}
126 .endif
129 CLEANFILES+=    ${_KERNEL.${_K}.${_F}}
131 .if defined(MDSET_NOIMAGE.${_FILENAME})
132 ${_I}=
133 .endif
135 # Darwin requires a special hack - this is documented in
136 # doc/HACKS, and just works around the problems described more
137 # fully in http://mail-index.netbsd.org/current-users/2008/06/27/msg003242.html
138 OPSYS!= uname -s
139 .if ${OPSYS} == "Darwin"
140 MDSETIMAGEFLAGS=
141 .else
142 MDSETIMAGEFLAGS=-v
143 .endif
145 ${_KERNEL.${_K}.${_F}}: .NOTMAIN ${_KERNNAME.${_K}.${_F}} ${_I}
146         ${_MKTARGET_CREATE} "(from: ${.ALLSRC})"
147         @rm -f ${.TARGET} ${.TARGET}.tmp ${.TARGET}.symbols.gz
148         @cp ${_KERNNAME.${_K}.${_F}} ${.TARGET}.tmp
149 .if !defined(MDSET_NOIMAGE.${_FILENAME})
150         ${TOOL_MDSETIMAGE} ${MDSETIMAGEFLAGS} ${.TARGET}.tmp ${_I}
151 .endif
152 .if !defined(MDSET_NOSYMBOLS.${_FILENAME}) && !defined(MDSET_NOSYMBOLS)
153         ${NM} ${.TARGET}.tmp | ${TOOL_GZIP_N} -9 > ${.TARGET}.symbols.gz
154 .endif
155 .if !defined(MDSET_NOSTRIP.${_FILENAME}) && !defined(MDSET_NOSTRIP)
156         ${STRIP} -R .eh_frame -R .eh_frame_hdr -R .comment -R .ident ${.TARGET}.tmp
157 .endif
158         @mv ${.TARGET}.tmp ${.TARGET}
159 .if defined(MDSET_POST.${_FILENAME}) || defined(MDSET_POST)
160         ${_POST.${.TARGET}}
161 .endif
163 .if defined(MDSET_NOGZIP.${_FILENAME}) || defined(MDSET_NOGZIP)
164 KERNELS+=       ${_KERNEL.${_K}.${_F}}
165 .else                                                   # {
166 KERNELS+=       ${_KERNEL.${_K}.${_F}}.gz
168 ${_KERNEL.${_K}.${_F}}.gz: ${_KERNEL.${_K}.${_F}}
169         ${_MKTARGET_CREATE}
170         -rm -f ${.TARGET}
171         ${TOOL_GZIP_N} -9c ${.ALLSRC} > ${.TARGET}
172 .endif                                                  # }
174 .endif
175 .endfor                                                 # }
176 .endfor                                                 # }
178 CLEANFILES+=    ${KERNELS} ${KERNELSYMS}
180 realall: ${KERNELS}
182 .if defined(MDSET_RELEASEDIR)
183 release:: check_RELEASEDIR .WAIT ${KERNELS}
184         test -z "${KERNELS}" || \
185         ${RELEASE_INSTALL} ${KERNELS} ${KERNELSYMS} \
186             ${RELEASEDIR}/${RELEASEMACHINEDIR}/${MDSET_RELEASEDIR}
187 .endif
190 .endif  # _MAKEFILE_MDSET_