4 # The user-driven targets are:
6 # universe - *Really* build *everything* (buildworld and
7 # all kernels on all architectures).
8 # buildworld - Rebuild *everything*, including glue to help do
10 # installworld - Install everything built by "buildworld".
11 # world - buildworld + installworld.
12 # buildkernel - Rebuild the kernel and the kernel-modules.
13 # installkernel - Install the kernel and the kernel-modules.
15 # reinstallkernel - Reinstall the kernel and the kernel-modules.
16 # reinstallkernel.debug
17 # kernel - buildkernel + installkernel.
18 # update - Convenient way to update your source tree (cvs).
19 # most - Build user commands, no libraries or include files.
20 # installmost - Install user commands, no libraries or include files.
22 # This makefile is simple by design. The FreeBSD make automatically reads
23 # the /usr/share/mk/sys.mk unless the -m argument is specified on the
24 # command line. By keeping this makefile simple, it doesn't matter too
25 # much how different the installed mk files are from those in the source
26 # tree. This makefile executes a child make process, forcing it to use
27 # the mk files from the source tree which are supposed to DTRT.
29 # The user-driven targets (as listed above) are implemented in Makefile.inc1.
31 # If you want to build your system from source be sure that /usr/obj has
32 # at least 400MB of diskspace available.
34 # For individuals wanting to build from the sources currently on their
35 # system, the simple instructions are:
37 # 1. `cd /usr/src' (or to the directory containing your source tree).
40 # For individuals wanting to upgrade their sources (even if only a
41 # delta of a few days):
43 # 1. `cd /usr/src' (or to the directory containing your source tree).
44 # 2. `make buildworld'
45 # 3. `make buildkernel KERNCONF=YOUR_KERNEL_HERE' (default is GENERIC).
46 # 4. `make installkernel KERNCONF=YOUR_KERNEL_HERE' (default is GENERIC).
47 # 5. `reboot' (in single user mode: boot -s from the loader prompt).
49 # 7. `make installworld'
53 # See src/UPDATING `COMMON ITEMS' for more complete information.
55 # If TARGET_ARCH=arch (e.g. ia64, sparc64, ...) is specified you can
56 # cross build world for other architectures using the buildworld target,
57 # and once the world is built you can cross build a kernel using the
60 # Define the user-driven targets. These are listed here in alphabetical
61 # order, but that's not important.
63 TGTS= all all-man buildkernel buildworld checkdpadd clean \
64 cleandepend cleandir depend distribute distributeworld everything \
65 hierarchy install installcheck installkernel installkernel.debug\
66 reinstallkernel reinstallkernel.debug installmost installworld \
67 libraries lint maninstall \
68 mk most obj objlink regress rerelease tags update
70 BITGTS= files includes
71 BITGTS:=${BITGTS} ${BITGTS:S/^/build/} ${BITGTS:S/^/install/}
73 .ORDER: buildworld installworld
74 .ORDER: buildworld distributeworld
75 .ORDER: buildworld buildkernel
76 .ORDER: buildkernel installkernel
77 .ORDER: buildkernel installkernel.debug
78 .ORDER: buildkernel reinstallkernel
79 .ORDER: buildkernel reinstallkernel.debug
81 PATH= /sbin:/bin:/usr/sbin:/usr/bin
82 MAKEOBJDIRPREFIX?= /usr/obj
83 MAKEPATH= ${MAKEOBJDIRPREFIX}${.CURDIR}/make.${MACHINE}
84 BINMAKE= PATH=${PATH} \
85 `if [ -x ${MAKEPATH}/make ]; then echo ${MAKEPATH}/make; else echo ${MAKE}; fi` \
86 -m ${.CURDIR}/share/mk
87 _MAKE= ${BINMAKE} -f Makefile.inc1
90 # Handle the user-driven targets, using the source relative mk files.
92 ${TGTS} ${BITGTS}: upgrade_checks
96 # Set a reasonable default
99 STARTTIME!= LC_ALL=C date
103 # Attempt to rebuild and reinstall *everything*, with reasonable chance of
104 # success, regardless of how old your existing system is.
106 world: upgrade_checks
107 @echo "--------------------------------------------------------------"
108 @echo ">>> elf make world started on ${STARTTIME}"
109 @echo "--------------------------------------------------------------"
110 .if target(pre-world)
112 @echo "--------------------------------------------------------------"
113 @echo ">>> Making 'pre-world' target"
114 @echo "--------------------------------------------------------------"
115 @cd ${.CURDIR}; ${_MAKE} pre-world
117 @cd ${.CURDIR}; ${_MAKE} buildworld
118 @cd ${.CURDIR}; ${_MAKE} -B installworld
119 .if target(post-world)
121 @echo "--------------------------------------------------------------"
122 @echo ">>> Making 'post-world' target"
123 @echo "--------------------------------------------------------------"
124 @cd ${.CURDIR}; ${_MAKE} post-world
127 @echo "--------------------------------------------------------------"
128 @printf ">>> elf make world completed on `LC_ALL=C date`\n (started ${STARTTIME})\n"
129 @echo "--------------------------------------------------------------"
134 # Short hand for `make buildkernel installkernel'
136 kernel: buildkernel installkernel
139 # Perform a few tests to determine if the installed tools are adequate
140 # for building the world.
143 @if ! (cd ${.CURDIR}/tools/regression/usr.bin/make && \
144 PATH=${PATH} ${MAKE} >/dev/null 2>&1); \
146 (cd ${.CURDIR} && make make); \
150 # Upgrade make(1) to the current version using the installed
151 # headers, libraries and tools.
153 MMAKEENV= MAKEOBJDIRPREFIX=${MAKEPATH} \
155 INSTALL="sh ${.CURDIR}/tools/install.sh"
156 MMAKE= ${MMAKEENV} make \
159 -DNO_CPU_CFLAGS -DNO_WERROR
163 @echo "--------------------------------------------------------------"
164 @echo ">>> Building an up-to-date make(1)"
165 @echo "--------------------------------------------------------------"
166 @cd ${.CURDIR}/usr.bin/make; \
170 ${MMAKE} install DESTDIR=${MAKEPATH} BINDIR=
175 # Attempt to rebuild *everything* for all supported architectures,
176 # with reasonable chance of success, regardless of how old your
177 # existing system is.
181 @echo "--------------------------------------------------------------"
182 @echo ">>> make universe started on ${STARTTIME}"
183 @echo "--------------------------------------------------------------"
184 .for arch in i386 sparc64 alpha ia64
185 .for mach in ${arch} ${${arch}_mach}
186 @echo ">> ${mach} started on `LC_ALL=C date`"
187 -cd ${.CURDIR} && ${MAKE} buildworld \
188 TARGET_ARCH=${arch} TARGET=${mach} \
189 __MAKE_CONF=/dev/null \
190 > _.${mach}.buildworld 2>&1
191 @echo ">> ${mach} buildworld completed on `LC_ALL=C date`"
192 .if exists(${.CURDIR}/sys/${mach}/conf/NOTES)
193 -cd ${.CURDIR}/sys/${mach}/conf && ${MAKE} LINT \
194 > ${.CURDIR}/_.${mach}.makeLINT 2>&1
196 cd ${.CURDIR} && ${MAKE} buildkernels TARGET_ARCH=${arch} TARGET=${mach}
197 @echo ">> ${mach} completed on `LC_ALL=C date`"
200 @echo "--------------------------------------------------------------"
201 @printf ">>> make universe completed on `LC_ALL=C date`\n (started ${STARTTIME})\n"
202 @echo "--------------------------------------------------------------"
204 KERNCONFS!= cd ${.CURDIR}/sys/${TARGET}/conf && \
205 find [A-Z]*[A-Z] -type f -maxdepth 0 ! -name NOTES
208 .for kernel in ${KERNCONFS}
209 -cd ${.CURDIR} && ${MAKE} buildkernel \
211 __MAKE_CONF=/dev/null \
212 > _.${TARGET}.${kernel} 2>&1