Remove building with NOCRYPTO option
[minix3.git] / Makefile
blobd01843b3a1dd6032dc4a60079d504662aec30616
1 # $NetBSD: Makefile,v 1.316 2015/07/23 08:03:25 mrg Exp $
4 # This is the top-level makefile for building NetBSD. For an outline of
5 # how to build a snapshot or release, as well as other release engineering
6 # information, see http://www.NetBSD.org/developers/releng/index.html
8 # Not everything you can set or do is documented in this makefile. In
9 # particular, you should review the files in /usr/share/mk (especially
10 # bsd.README) for general information on building programs and writing
11 # Makefiles within this structure, and see the comments in src/etc/Makefile
12 # for further information on installation and release set options.
14 # Variables listed below can be set on the make command line (highest
15 # priority), in /etc/mk.conf (middle priority), or in the environment
16 # (lowest priority).
18 # Variables:
19 # DESTDIR is the target directory for installation of the compiled
20 # software. It defaults to /. Note that programs are built against
21 # libraries installed in DESTDIR.
22 # MKMAN, if `no', will prevent building of manual pages.
23 # MKOBJDIRS, if not `no', will build object directories at
24 # an appropriate point in a build.
25 # MKSHARE, if `no', will prevent building and installing
26 # anything in /usr/share.
27 # MKUPDATE, if not `no', will avoid a `make cleandir' at the start of
28 # `make build', as well as having the effects listed in
29 # /usr/share/mk/bsd.README.
30 # NOCLEANDIR, if defined, will avoid a `make cleandir' at the start
31 # of the `make build'.
32 # NOINCLUDES will avoid the `make includes' usually done by `make build'.
34 # See mk.conf(5) for more details.
37 # Targets:
38 # build:
39 # Builds a full release of NetBSD in DESTDIR, except for the
40 # /etc configuration files.
41 # If BUILD_DONE is set, this is an empty target.
42 # distribution:
43 # Builds a full release of NetBSD in DESTDIR, including the /etc
44 # configuration files.
45 # buildworld:
46 # As per `make distribution', except that it ensures that DESTDIR
47 # is not the root directory.
48 # installworld:
49 # Install the distribution from DESTDIR to INSTALLWORLDDIR (which
50 # defaults to the root directory). Ensures that INSTALLWORLDDIR
51 # is not the root directory if cross compiling.
52 # release:
53 # Does a `make distribution', and then tars up the DESTDIR files
54 # into ${RELEASEDIR}/${RELEASEMACHINEDIR}, in release(7) format.
55 # (See etc/Makefile for more information on this.)
56 # regression-tests:
57 # Runs the regression tests in "regress" on this host.
58 # sets:
59 # Populate ${RELEASEDIR}/${RELEASEMACHINEDIR}/binary/sets
60 # from ${DESTDIR}
61 # sourcesets:
62 # Populate ${RELEASEDIR}/source/sets from ${NETBSDSRCDIR}
63 # syspkgs:
64 # Populate ${RELEASEDIR}/${RELEASEMACHINEDIR}/binary/syspkgs
65 # from ${DESTDIR}
66 # iso-image:
67 # Create CD-ROM image in RELEASEDIR/images.
68 # RELEASEDIR must already have been populated by `make release'
69 # or equivalent.
70 # iso-image-source:
71 # Create CD-ROM image with source in RELEASEDIR/images.
72 # RELEASEDIR must already have been populated by
73 # `make release sourcesets' or equivalent.
74 # live-image:
75 # Create bootable live image for emulators or USB stick etc.
76 # in RELEASEDIR/liveimage.
77 # RELEASEDIR must already have been populated by `make release'
78 # or equivalent.
79 # install-image:
80 # Create bootable installation image for USB stick etc.
81 # in RELEASEDIR/installimage.
82 # RELEASEDIR must already have been populated by `make release'
83 # or equivalent.
85 # Targets invoked by `make build,' in order:
86 # cleandir: cleans the tree.
87 # do-top-obj: creates the top level object directory.
88 # do-tools-obj: creates object directories for the host toolchain.
89 # do-tools: builds host toolchain.
90 # params: record the values of variables that might affect the
91 # build.
92 # obj: creates object directories.
93 # do-distrib-dirs: creates the distribution directories.
94 # includes: installs include files.
95 # do-lib: builds and installs prerequisites from lib
96 # if ${MKCOMPAT} != "no".
97 # do-compat-lib: builds and installs prerequisites from compat/lib
98 # if ${MKCOMPAT} != "no".
99 # do-build: builds and installs the entire system.
100 # do-x11: builds and installs X11 if ${MKX11} != "no"; either
101 # X11R7 from src/external/mit/xorg
102 # do-extsrc: builds and installs extsrc if ${MKEXTSRC} != "no".
103 # do-obsolete: installs the obsolete sets (for the postinstall-* targets).
106 .if ${.MAKEFLAGS:M${.CURDIR}/share/mk} == ""
107 .MAKEFLAGS: -m ${.CURDIR}/share/mk
108 .endif
111 # If _SRC_TOP_OBJ_ gets set here, we will end up with a directory that may
112 # not be the top level objdir, because "make obj" can happen in the *middle*
113 # of "make build" (long after <bsd.own.mk> is calculated it). So, pre-set
114 # _SRC_TOP_OBJ_ here so it will not be added to ${.MAKEOVERRIDES}.
116 _SRC_TOP_OBJ_=
118 .include <bsd.own.mk>
121 # Sanity check: make sure that "make build" is not invoked simultaneously
122 # with a standard recursive target.
125 .if make(build) || make(release) || make(snapshot)
126 .for targ in ${TARGETS:Nobj:Ncleandir}
127 .if make(${targ}) && !target(.BEGIN)
128 .BEGIN:
129 @echo 'BUILD ABORTED: "make build" and "make ${targ}" are mutually exclusive.'
130 @false
131 .endif
132 .endfor
133 .endif
136 # _SUBDIR is used to set SUBDIR, after removing directories that have
137 # BUILD_${dir}=no, or that have no ${dir}/Makefile.
139 _SUBDIR= tools lib include gnu external crypto/external bin games
140 _SUBDIR+= libexec sbin usr.bin
141 _SUBDIR+= usr.sbin share sys etc tests compat
142 _SUBDIR+= .WAIT rescue .WAIT distrib regress
143 .if defined(__MINIX)
144 # the minix subdir depends on some other things (e.g. lib/)
145 _SUBDIR+= .WAIT minix
146 .endif # defined(__MINIX)
148 .for dir in ${_SUBDIR}
149 .if "${dir}" == ".WAIT" \
150 || (${BUILD_${dir}:Uyes} != "no" && exists(${dir}/Makefile))
151 SUBDIR+= ${dir}
152 .endif
153 .endfor
155 .if exists(regress)
156 regression-tests: .PHONY .MAKE
157 @echo Running regression tests...
158 ${MAKEDIRTARGET} regress regress
159 .endif
161 .if ${MKUNPRIVED} != "no"
162 NOPOSTINSTALL= # defined
163 .endif
165 afterinstall: .PHONY .MAKE
166 .if ${MKMAN} != "no"
167 .if !defined(__MINIX)
168 ${MAKEDIRTARGET} share/man makedb
169 .else
170 ${MAKEDIRTARGET} minix/man makedb
171 .endif # !defined(__MINIX)
172 .endif
173 .if (${MKUNPRIVED} != "no" && ${MKINFO} != "no")
174 ${MAKEDIRTARGET} gnu/usr.bin/texinfo/install-info infodir-meta
175 .endif
176 .if !defined(NOPOSTINSTALL)
177 ${MAKEDIRTARGET} . postinstall-check
178 .endif
180 _POSTINSTALL= ${.CURDIR}/usr.sbin/postinstall/postinstall \
181 -m ${MACHINE} -a ${MACHINE_ARCH}
182 _POSTINSTALL_ENV= \
183 AWK=${TOOL_AWK:Q} \
184 DB=${TOOL_DB:Q} \
185 HOST_SH=${HOST_SH:Q} \
186 MAKE=${MAKE:Q} \
187 PWD_MKDB=${TOOL_PWD_MKDB:Q} \
188 SED=${TOOL_SED:Q} \
189 STAT=${TOOL_STAT:Q}
191 .if ${MKX11} != "no"
192 _POSTINSTALL_X11=-x ${X11SRCDIR:Q}
193 .endif
195 postinstall-check: .PHONY
196 @echo " === Post installation checks ==="
197 ${_POSTINSTALL_ENV} ${HOST_SH} ${_POSTINSTALL} -s ${.CURDIR} ${_POSTINSTALL_X11} -d ${DESTDIR}/ check; if [ $$? -gt 1 ]; then exit 1; fi
198 @echo " ================================"
200 postinstall-fix: .NOTMAIN .PHONY
201 @echo " === Post installation fixes ==="
202 ${_POSTINSTALL_ENV} ${HOST_SH} ${_POSTINSTALL} -s ${.CURDIR} ${_POSTINSTALL_X11} -d ${DESTDIR}/ fix
203 @echo " ==============================="
205 postinstall-fix-obsolete: .NOTMAIN .PHONY
206 @echo " === Removing obsolete files ==="
207 ${_POSTINSTALL_ENV} ${HOST_SH} ${_POSTINSTALL} -s ${.CURDIR} ${_POSTINSTALL_X11} -d ${DESTDIR}/ fix obsolete
208 @echo " ==============================="
210 postinstall-fix-obsolete_stand: .NOTMAIN .PHONY
211 @echo " === Removing obsolete files ==="
212 ${_POSTINSTALL_ENV} ${HOST_SH} ${_POSTINSTALL} -s ${.CURDIR} ${_POSTINSTALL_X11} -d ${DESTDIR}/ fix obsolete_stand
213 @echo " ==============================="
217 # Targets (in order!) called by "make build".
219 BUILDTARGETS+= check-tools
220 .if ${MKUPDATE} == "no" && !defined(NOCLEANDIR)
221 BUILDTARGETS+= cleandir
222 .endif
223 .if ${MKOBJDIRS} != "no"
224 BUILDTARGETS+= do-top-obj
225 .endif
226 .if ${USETOOLS} == "yes" # {
227 .if ${MKOBJDIRS} != "no"
228 BUILDTARGETS+= do-tools-obj
229 .endif
230 BUILDTARGETS+= do-tools
231 .endif # USETOOLS # }
232 BUILDTARGETS+= params
233 .if ${MKOBJDIRS} != "no"
234 BUILDTARGETS+= obj
235 .endif
236 BUILDTARGETS+= clean_METALOG
237 .if !defined(NODISTRIBDIRS)
238 BUILDTARGETS+= do-distrib-dirs
239 .endif
240 .if !defined(NOINCLUDES)
241 BUILDTARGETS+= includes
242 .endif
243 BUILDTARGETS+= do-lib
244 .if !defined(__MINIX)
245 # LSC Not used in MINIX3
246 BUILDTARGETS+= do-compat-lib
247 .endif # !defined(__MINIX)
248 .if ${MKX11} != "no"
249 BUILDTARGETS+= do-x11
250 .endif
251 BUILDTARGETS+= do-build
252 .if ${MKEXTSRC} != "no"
253 BUILDTARGETS+= do-extsrc
254 .endif
256 .if defined(__MINIX) && ${MKSRC} == "yes"
257 BUILDTARGETS+= do-installsrc
258 .endif # defined(__MINIX)
260 BUILDTARGETS+= do-obsolete
263 # Enforce proper ordering of some rules.
266 .ORDER: ${BUILDTARGETS}
267 includes-lib: .PHONY includes-include includes-sys
268 includes-gnu: .PHONY includes-lib
271 # Record the values of variables that might affect the build.
272 # If no values have changed, avoid updating the timestamp
273 # of the params file.
275 # This is referenced by _NETBSD_VERSION_DEPENDS in <bsd.own.mk>.
277 .include "${NETBSDSRCDIR}/etc/Makefile.params"
278 CLEANDIRFILES+= params
279 params: .EXEC
280 ${_MKMSG_CREATE} params
281 @${PRINT_PARAMS} >${.TARGET}.new
282 @if cmp -s ${.TARGET}.new ${.TARGET} > /dev/null 2>&1; then \
283 : "params is unchanged" ; \
284 rm ${.TARGET}.new ; \
285 else \
286 : "params has changed or is new" ; \
287 mv ${.TARGET}.new ${.TARGET} ; \
291 # Display current make(1) parameters
293 show-params: .PHONY .MAKE
294 @${PRINT_PARAMS}
297 # Build the system and install into DESTDIR.
300 START_TIME!= date
302 .if defined(__MINIX)
303 world: build .PHONY .MAKE
304 ${MAKEDIRTARGET} . etcfiles
305 @echo "WARNING: "
306 @echo "WARNING: The 'world' target is obsolete, please use 'build' instead."
307 @echo "WARNING: "
309 etcfiles: .PHONY .MAKE
310 ${MAKEDIRTARGET} etc install-etc-files-safe DESTDIR=${DESTDIR:U/}
312 etcforce: .PHONY .MAKE
313 ${MAKEDIRTARGET} etc install-etc-files DESTDIR=${DESTDIR:U/}
315 .endif # defined(__MINIX)
317 build: .PHONY .MAKE
318 .if defined(BUILD_DONE)
319 @echo "Build already installed into ${DESTDIR}"
320 .else
321 @echo "Build started at: ${START_TIME}"
322 .for tgt in ${BUILDTARGETS}
323 ${MAKEDIRTARGET} . ${tgt}
324 .endfor
325 ${MAKEDIRTARGET} etc install-etc-release
326 .if defined(__MINIX)
327 ${MAKEDIRTARGET} etc install-etc-files-safe DESTDIR=${DESTDIR:U/}
328 ${MAKEDIRTARGET} releasetools do-hdboot
329 .endif # defined(__MINIX)
330 @echo "Build started at: ${START_TIME}"
331 @printf "Build finished at: " && date
332 .endif
335 # Build a full distribution, but not a release (i.e. no sets into
336 # ${RELEASEDIR}). "buildworld" enforces a build to ${DESTDIR} != /
339 distribution buildworld: .PHONY .MAKE
340 .if make(buildworld) && \
341 (!defined(DESTDIR) || ${DESTDIR} == "" || ${DESTDIR} == "/")
342 @echo "Won't make ${.TARGET} with DESTDIR=/"
343 @false
344 .endif
345 ${MAKEDIRTARGET} . build NOPOSTINSTALL=1
346 ${MAKEDIRTARGET} etc distribution INSTALL_DONE=1
347 .if defined(DESTDIR) && ${DESTDIR} != "" && ${DESTDIR} != "/"
348 ${MAKEDIRTARGET} . postinstall-fix-obsolete
349 ${MAKEDIRTARGET} . postinstall-fix-obsolete_stand
350 ${MAKEDIRTARGET} distrib/sets checkflist
351 .endif
352 @echo "make ${.TARGET} started at: ${START_TIME}"
353 @printf "make ${.TARGET} finished at: " && date
356 # Install the distribution from $DESTDIR to $INSTALLWORLDDIR (defaults to `/')
357 # If installing to /, ensures that the host's operating system is NetBSD and
358 # the host's `uname -m` == ${MACHINE}.
361 HOST_UNAME_S!= uname -s
362 .if ${HOST_OSTYPE:C/\-.*//} != "Minix"
363 HOST_UNAME_M!= uname -m
364 .else
365 HOST_UNAME_M:= ${MACHINE}
366 .endif
368 installworld: .PHONY .MAKE
369 .if (!defined(DESTDIR) || ${DESTDIR} == "" || ${DESTDIR} == "/")
370 @echo "Can't make ${.TARGET} to DESTDIR=/"
371 @false
372 .endif
373 .if !defined(INSTALLWORLDDIR) || \
374 ${INSTALLWORLDDIR} == "" || ${INSTALLWORLDDIR} == "/"
375 .if (${HOST_UNAME_S} != "NetBSD") && (${HOST_UNAME_S} != "Minix")
376 @echo "Won't cross-make ${.TARGET} from ${HOST_UNAME_S} to Minix with INSTALLWORLDDIR=/"
377 @false
378 .endif
379 .if (${HOST_UNAME_M} != ${MACHINE})
380 @echo "Won't cross-make ${.TARGET} from ${HOST_UNAME_M} to ${MACHINE} with INSTALLWORLDDIR=/"
381 @false
382 .endif
383 .endif
384 ${MAKEDIRTARGET} distrib/sets installsets \
385 INSTALLDIR=${INSTALLWORLDDIR:U/} INSTALLSETS=${INSTALLSETS:Q}
386 ${MAKEDIRTARGET} . postinstall-check DESTDIR=${INSTALLWORLDDIR}
387 @echo "make ${.TARGET} started at: ${START_TIME}"
388 @printf "make ${.TARGET} finished at: " && date
391 # Install modules from $DESTDIR to $INSTALLMODULESDIR
393 installmodules: .PHONY .MAKE
394 .if (!defined(DESTDIR) || ${DESTDIR} == "" || ${DESTDIR} == "/")
395 @echo "Can't make ${.TARGET} to DESTDIR=/"
396 @false
397 .endif
398 .if !defined(INSTALLMODULESDIR) || \
399 ${INSTALLMODULESDIR} == "" || ${INSTALLMODULESDIR} == "/"
400 .if (${HOST_UNAME_S} != "NetBSD")
401 @echo "Won't cross-make ${.TARGET} from ${HOST_UNAME_S} to NetBSD with INSTALLMODULESDIR=/"
402 @false
403 .endif
404 .if (${HOST_UNAME_M} != ${MACHINE})
405 @echo "Won't cross-make ${.TARGET} from ${HOST_UNAME_M} to ${MACHINE} with INSTALLMODULESDIR=/"
406 @false
407 .endif
408 .endif
409 ${MAKEDIRTARGET} sys/modules install DESTDIR=${INSTALLMODULESDIR:U/}
410 @echo "make ${.TARGET} started at: ${START_TIME}"
411 @printf "make ${.TARGET} finished at: " && date
414 # Create sets from $DESTDIR or $NETBSDSRCDIR into $RELEASEDIR
417 .for tgt in sets sourcesets syspkgs
418 ${tgt}: .PHONY .MAKE
419 ${MAKEDIRTARGET} distrib/sets ${tgt}
420 .endfor
423 # Build a release or snapshot (implies "make distribution"). Note that
424 # in this case, the set lists will be checked before the tar files
425 # are made.
428 release snapshot: .PHONY .MAKE
429 ${MAKEDIRTARGET} . distribution
430 ${MAKEDIRTARGET} etc release DISTRIBUTION_DONE=1
431 @echo "make ${.TARGET} started at: ${START_TIME}"
432 @printf "make ${.TARGET} finished at: " && date
435 # Create a CD-ROM image.
438 iso-image: .PHONY
439 ${MAKEDIRTARGET} distrib iso_image
440 ${MAKEDIRTARGET} etc iso-image
441 @echo "make ${.TARGET} started at: ${START_TIME}"
442 @printf "make ${.TARGET} finished at: " && date
444 iso-image-source: .PHONY
445 ${MAKEDIRTARGET} distrib iso_image CDSOURCE=true
446 ${MAKEDIRTARGET} etc iso-image
447 @echo "make ${.TARGET} started at: ${START_TIME}"
448 @printf "make ${.TARGET} finished at: " && date
451 # Create bootable live images.
454 live-image: .PHONY
455 ${MAKEDIRTARGET} etc live-image
456 @echo "make ${.TARGET} started at: ${START_TIME}"
457 @printf "make ${.TARGET} finished at: " && date
460 # Create bootable installation images.
463 install-image: .PHONY
464 ${MAKEDIRTARGET} etc install-image
465 @echo "make ${.TARGET} started at: ${START_TIME}"
466 @printf "make ${.TARGET} finished at: " && date
469 # Special components of the "make build" process.
472 check-tools: .PHONY
473 .if ${TOOLCHAIN_MISSING} != "no" && !defined(EXTERNAL_TOOLCHAIN)
474 @echo '*** WARNING: Building on MACHINE=${MACHINE} with missing toolchain.'
475 @echo '*** May result in a failed build or corrupt binaries!'
476 .elif defined(EXTERNAL_TOOLCHAIN)
477 @echo '*** Using external toolchain rooted at ${EXTERNAL_TOOLCHAIN}.'
478 .endif
479 .if defined(NBUILDJOBS)
480 @echo '*** WARNING: NBUILDJOBS is obsolete; use -j directly instead!'
481 .endif
483 # Delete or sanitise a leftover METALOG from a previous build.
484 clean_METALOG: .PHONY .MAKE
485 .if ${MKUPDATE} != "no"
486 ${MAKEDIRTARGET} distrib/sets clean_METALOG
487 .endif
489 do-distrib-dirs: .PHONY .MAKE
490 .if !defined(DESTDIR) || ${DESTDIR} == ""
491 ${MAKEDIRTARGET} etc distrib-dirs DESTDIR=/
492 .else
493 ${MAKEDIRTARGET} etc distrib-dirs DESTDIR=${DESTDIR}
494 .endif
496 .for targ in cleandir obj includes
497 do-${targ}: .PHONY ${targ}
498 @true
499 .endfor
501 do-tools: .PHONY .MAKE
502 ${MAKEDIRTARGET} tools build_install
504 do-lib: .PHONY .MAKE
505 ${MAKEDIRTARGET} lib build_install
507 do-compat-lib: .PHONY .MAKE
508 ${MAKEDIRTARGET} compat build_install BOOTSTRAP_SUBDIRS="../../../lib"
510 do-top-obj: .PHONY .MAKE
511 ${MAKEDIRTARGET} . obj NOSUBDIR=
513 do-tools-obj: .PHONY .MAKE
514 ${MAKEDIRTARGET} tools obj
516 do-build: .PHONY .MAKE
517 .for targ in dependall install
518 ${MAKEDIRTARGET} . ${targ} BUILD_tools=no BUILD_lib=no
519 .endfor
521 do-x11: .PHONY .MAKE
522 .if ${MKX11} != "no"
523 ${MAKEDIRTARGET} external/mit/xorg/tools all
524 ${MAKEDIRTARGET} external/mit/xorg/lib build_install
525 .if ${MKCOMPATX11} != "no"
526 ${MAKEDIRTARGET} compat build_install BOOTSTRAP_SUBDIRS="../../../external/mit/xorg/lib"
527 .endif
528 .else
529 @echo "MKX11 is not enabled"
530 @false
531 .endif
533 do-extsrc: .PHONY .MAKE
534 .if ${MKEXTSRC} != "no"
535 ${MAKEDIRTARGET} extsrc build
536 .else
537 @echo "MKEXTSRC is not enabled"
538 @false
539 .endif
541 do-obsolete: .PHONY .MAKE
542 ${MAKEDIRTARGET} etc install-obsolete-lists
545 # Speedup stubs for some subtrees that don't need to run these rules.
546 # (Tells <bsd.subdir.mk> not to recurse for them.)
549 .for dir in bin etc distrib games libexec regress sbin usr.bin usr.sbin tools
550 includes-${dir}: .PHONY
551 @true
552 .endfor
553 .for dir in etc distrib regress
554 install-${dir}: .PHONY
555 @true
556 .endfor
558 .if defined(__MINIX)
559 SRCTAR=src.tar.gz
560 do-installsrc:
561 cd ${.CURDIR} && git ls-tree -r HEAD --name-only | tar czf ${.OBJDIR}/$(SRCTAR) -T -
562 ${INSTALL_FILE} ${.OBJDIR}/$(SRCTAR) ${DESTDIR}/usr/src/
563 .endif # defined(__MINIX)
566 # XXX this needs to change when distrib Makefiles are recursion compliant
567 # XXX many distrib subdirs need "cd etc && make snap_pre snap_kern" first...
569 dependall-distrib depend-distrib all-distrib: .PHONY
570 @true
572 .include <bsd.obj.mk>
573 .include <bsd.kernobj.mk>
574 .include <bsd.subdir.mk>