]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - Makefile
This commit was generated by cvs2svn to compensate for changes in r119582,
[FreeBSD/FreeBSD.git] / Makefile
1 #
2 # $FreeBSD$
3 #
4 # The user-driven targets are:
5 #
6 # universe            - *Really* build *everything* (buildworld and
7 #                       all kernels on all architectures).
8 # buildworld          - Rebuild *everything*, including glue to help do
9 #                       upgrades.
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.
14 # installkernel.debug
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.
21 #
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.
28 #
29 # The user-driven targets (as listed above) are implemented in Makefile.inc1.
30 #
31 # If you want to build your system from source be sure that /usr/obj has
32 # at least 400MB of diskspace available.
33 #
34 # For individuals wanting to build from the sources currently on their
35 # system, the simple instructions are:
36 #
37 # 1.  `cd /usr/src'  (or to the directory containing your source tree).
38 # 2.  `make world'
39 #
40 # For individuals wanting to upgrade their sources (even if only a
41 # delta of a few days):
42 #
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).
48 # 6.  `mergemaster -p'
49 # 7.  `make installworld'
50 # 8.  `mergemaster'
51 # 9.  `reboot'
52 #
53 # See src/UPDATING `COMMON ITEMS' for more complete information.
54 #
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
58 # buildkernel target.
59 #
60 # Define the user-driven targets. These are listed here in alphabetical
61 # order, but that's not important.
62 #
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         most obj objlink regress rerelease tags update
69
70 BITGTS= files includes
71 BITGTS:=${BITGTS} ${BITGTS:S/^/build/} ${BITGTS:S/^/install/}
72 TGTS+=  ${BITGTS}
73
74 .ORDER: buildworld installworld
75 .ORDER: buildworld distributeworld
76 .ORDER: buildworld buildkernel
77 .ORDER: buildkernel installkernel
78 .ORDER: buildkernel installkernel.debug
79 .ORDER: buildkernel reinstallkernel
80 .ORDER: buildkernel reinstallkernel.debug
81
82 PATH=   /sbin:/bin:/usr/sbin:/usr/bin
83 MAKEOBJDIRPREFIX?=      /usr/obj
84 MAKEPATH=       ${MAKEOBJDIRPREFIX}${.CURDIR}/make.${MACHINE}
85 BINMAKE= \
86         `if [ -x ${MAKEPATH}/make ]; then echo ${MAKEPATH}/make; else echo ${MAKE}; fi` \
87         -m ${.CURDIR}/share/mk
88 _MAKE=  PATH=${PATH} ${BINMAKE} -f Makefile.inc1
89
90 #
91 # Make sure we have an up-to-date make(1). Only world and buildworld
92 # should do this as those are the initial targets used for upgrades.
93 # The user can define ALWAYS_CHECK_MAKE to have this check performed
94 # for all targets.
95 #
96 .if defined(ALWAYS_CHECK_MAKE)
97 ${TGTS}: upgrade_checks
98 .else
99 buildworld: upgrade_checks
100 .endif
101
102 #
103 # Handle the user-driven targets, using the source relative mk files.
104 #
105
106 ${TGTS}:
107         @cd ${.CURDIR}; \
108                 ${_MAKE} ${.TARGET}
109
110 # Set a reasonable default
111 .MAIN:  all
112
113 STARTTIME!= LC_ALL=C date
114 #
115 # world
116 #
117 # Attempt to rebuild and reinstall *everything*, with reasonable chance of
118 # success, regardless of how old your existing system is.
119 #
120 world: upgrade_checks
121         @echo "--------------------------------------------------------------"
122         @echo ">>> make world started on ${STARTTIME}"
123         @echo "--------------------------------------------------------------"
124 .if target(pre-world)
125         @echo
126         @echo "--------------------------------------------------------------"
127         @echo ">>> Making 'pre-world' target"
128         @echo "--------------------------------------------------------------"
129         @cd ${.CURDIR}; ${_MAKE} pre-world
130 .endif
131         @cd ${.CURDIR}; ${_MAKE} buildworld
132         @cd ${.CURDIR}; ${_MAKE} -B installworld
133 .if target(post-world)
134         @echo
135         @echo "--------------------------------------------------------------"
136         @echo ">>> Making 'post-world' target"
137         @echo "--------------------------------------------------------------"
138         @cd ${.CURDIR}; ${_MAKE} post-world
139 .endif
140         @echo
141         @echo "--------------------------------------------------------------"
142         @echo ">>> make world completed on `LC_ALL=C date`"
143         @echo "                   (started ${STARTTIME})"
144         @echo "--------------------------------------------------------------"
145
146 #
147 # kernel
148 #
149 # Short hand for `make buildkernel installkernel'
150 #
151 kernel: buildkernel installkernel
152
153 #
154 # Perform a few tests to determine if the installed tools are adequate
155 # for building the world.
156 #
157 upgrade_checks:
158         @if ! (cd ${.CURDIR}/tools/regression/usr.bin/make && \
159             PATH=${PATH} ${BINMAKE} >/dev/null 2>&1); \
160         then \
161             (cd ${.CURDIR} && make make); \
162         fi
163
164 #
165 # Upgrade make(1) to the current version using the installed
166 # headers, libraries and tools.
167 #
168 MMAKEENV=       MAKEOBJDIRPREFIX=${MAKEPATH} \
169                 DESTDIR= \
170                 INSTALL="sh ${.CURDIR}/tools/install.sh"
171 MMAKE=          ${MMAKEENV} make \
172                 -D_UPGRADING \
173                 -DNOMAN -DNOSHARED \
174                 -DNO_CPU_CFLAGS -DNO_WERROR
175
176 make:
177         @echo
178         @echo "--------------------------------------------------------------"
179         @echo ">>> Building an up-to-date make(1)"
180         @echo "--------------------------------------------------------------"
181         @cd ${.CURDIR}/usr.bin/make; \
182                 ${MMAKE} obj && \
183                 ${MMAKE} depend && \
184                 ${MMAKE} all && \
185                 ${MMAKE} install DESTDIR=${MAKEPATH} BINDIR=
186
187 #
188 # universe
189 #
190 # Attempt to rebuild *everything* for all supported architectures,
191 # with reasonable chance of success, regardless of how old your
192 # existing system is.
193 #
194 i386_mach=      pc98
195 universe:
196         @echo "--------------------------------------------------------------"
197         @echo ">>> make universe started on ${STARTTIME}"
198         @echo "--------------------------------------------------------------"
199 .for arch in i386 sparc64 alpha ia64
200 .for mach in ${arch} ${${arch}_mach}
201         @echo ">> ${mach} started on `LC_ALL=C date`"
202         -cd ${.CURDIR} && ${MAKE} buildworld \
203             TARGET_ARCH=${arch} TARGET=${mach} \
204             __MAKE_CONF=/dev/null \
205             > _.${mach}.buildworld 2>&1
206         @echo ">> ${mach} buildworld completed on `LC_ALL=C date`"
207 .if exists(${.CURDIR}/sys/${mach}/conf/NOTES)
208         -cd ${.CURDIR}/sys/${mach}/conf && ${MAKE} LINT \
209             > ${.CURDIR}/_.${mach}.makeLINT 2>&1
210 .endif
211         cd ${.CURDIR} && ${MAKE} buildkernels TARGET_ARCH=${arch} TARGET=${mach}
212         @echo ">> ${mach} completed on `LC_ALL=C date`"
213 .endfor
214 .endfor
215         @echo "--------------------------------------------------------------"
216         @echo ">>> make universe completed on `LC_ALL=C date`"
217         @echo "                      (started ${STARTTIME})"
218         @echo "--------------------------------------------------------------"
219
220 KERNCONFS!=     cd ${.CURDIR}/sys/${TARGET}/conf && \
221                 find [A-Z]*[A-Z] -type f -maxdepth 0 ! -name NOTES
222
223 buildkernels:
224 .for kernel in ${KERNCONFS}
225         -cd ${.CURDIR} && ${MAKE} buildkernel \
226             KERNCONF=${kernel} \
227             __MAKE_CONF=/dev/null \
228             > _.${TARGET}.${kernel} 2>&1
229 .endfor