]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - Makefile
This commit was generated by cvs2svn to compensate for changes in r112158,
[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 # reinstallkernel     - Reinstall the kernel and the kernel-modules.
15 # kernel              - buildkernel + installkernel.
16 # update              - Convenient way to update your source tree (cvs).
17 # upgrade             - Upgrade a.out (2.2.x/3.0) system to the new ELF way
18 # most                - Build user commands, no libraries or include files.
19 # installmost         - Install user commands, no libraries or include files.
20 # aout-to-elf         - Upgrade a system from a.out to elf format (see below).
21 # aout-to-elf-build   - Build everything required to upgrade a system from
22 #                       a.out to elf format (see below).
23 # aout-to-elf-install - Install everything built by aout-to-elf-build (see
24 #                       below).
25 # move-aout-libs      - Move the a.out libraries into an aout sub-directory
26 #                       of each elf library sub-directory.
27 #
28 # This makefile is simple by design. The FreeBSD make automatically reads
29 # the /usr/share/mk/sys.mk unless the -m argument is specified on the
30 # command line. By keeping this makefile simple, it doesn't matter too
31 # much how different the installed mk files are from those in the source
32 # tree. This makefile executes a child make process, forcing it to use
33 # the mk files from the source tree which are supposed to DTRT.
34 #
35 # The user-driven targets (as listed above) are implemented in Makefile.inc1.
36 #
37 # If you want to build your system from source be sure that /usr/obj has
38 # at least 400MB of diskspace available.
39 #
40 # For individuals wanting to build from the sources currently on their
41 # system, the simple instructions are:
42 #
43 # 1.  `cd /usr/src'  (or to the directory containing your source tree).
44 # 2.  `make world'
45 #
46 # For individuals wanting to upgrade their sources (even if only a
47 # delta of a few days):
48 #
49 # 1.  `cd /usr/src'       (or to the directory containing your source tree).
50 # 2.  `make buildworld'
51 # 3.  `make buildkernel KERNCONF=YOUR_KERNEL_HERE'     (default is GENERIC).
52 # 4.  `make installkernel KERNCONF=YOUR_KERNEL_HERE'   (default is GENERIC).
53 # 5.  `reboot'        (in single user mode: boot -s from the loader prompt).
54 # 6.  `mergemaster -p'
55 # 7.  `make installworld'
56 # 8.  `mergemaster'
57 # 9.  `reboot'
58 #
59 # See src/UPDATING `COMMON ITEMS' for more complete information.
60 #
61 # If TARGET_ARCH=arch (e.g. ia64, sparc64, ...) is specified you can
62 # cross build world for other architectures using the buildworld target,
63 # and once the world is built you can cross build a kernel using the
64 # buildkernel target.
65 #
66 # ----------------------------------------------------------------------------
67 #
68 #           Upgrading an i386 system from a.out to elf format
69 #
70 #
71 # The aout->elf transition build is performed by doing a `make upgrade' (or
72 # `make aout-to-elf') or in two steps by a `make aout-to-elf-build' followed
73 # by a `make aout-to-elf-install', depending on user preference.
74 # You need to have at least 320 MB of free space for the object tree.
75 #
76 # The upgrade process checks the installed release. If this is 3.0-CURRENT,
77 # it is assumed that your kernel contains all the syscalls required by the
78 # current sources.
79 #
80 # The upgrade procedure will stop and ask for confirmation to proceed
81 # several times. On each occasion, you can type Ctrl-C to abort the
82 # upgrade.  Optionally, you can also start it with NOCONFIRM=yes and skip
83 # the confirmation steps.
84 #
85 # ----------------------------------------------------------------------------
86 #
87 #
88 # Define the user-driven targets. These are listed here in alphabetical
89 # order, but that's not important.
90 #
91 TGTS=   all all-man buildkernel buildworld checkdpadd clean \
92         cleandepend cleandir depend distribute distributeworld everything \
93         hierarchy install installcheck installkernel \
94         reinstallkernel installmost installworld libraries lint maninstall \
95         mk most obj objlink regress rerelease tags update
96
97 BITGTS= files includes
98 BITGTS:=${BITGTS} ${BITGTS:S/^/build/} ${BITGTS:S/^/install/}
99
100 .ORDER: buildworld installworld
101 .ORDER: buildworld distributeworld
102 .ORDER: buildworld buildkernel
103 .ORDER: buildkernel installkernel
104 .ORDER: buildkernel reinstallkernel
105
106 PATH=   /sbin:/bin:/usr/sbin:/usr/bin
107 MAKEOBJDIRPREFIX?=      /usr/obj
108 MAKEPATH=       ${MAKEOBJDIRPREFIX}${.CURDIR}/make.${MACHINE}
109 _MAKE=  PATH=${PATH} \
110         `if [ -x ${MAKEPATH}/make ]; then echo ${MAKEPATH}/make; else echo ${MAKE}; fi` \
111         -m ${.CURDIR}/share/mk -f Makefile.inc1
112
113 #
114 # Handle the user-driven targets, using the source relative mk files.
115 #
116 ${TGTS} ${BITGTS}: upgrade_checks
117         @cd ${.CURDIR}; \
118                 ${_MAKE} ${.TARGET}
119
120 # Set a reasonable default
121 .MAIN:  all
122
123 STARTTIME!= LC_ALL=C date
124 #
125 # world
126 #
127 # Attempt to rebuild and reinstall *everything*, with reasonable chance of
128 # success, regardless of how old your existing system is.
129 #
130 world: upgrade_checks
131         @echo "--------------------------------------------------------------"
132         @echo ">>> elf make world started on ${STARTTIME}"
133         @echo "--------------------------------------------------------------"
134 .if target(pre-world)
135         @echo
136         @echo "--------------------------------------------------------------"
137         @echo ">>> Making 'pre-world' target"
138         @echo "--------------------------------------------------------------"
139         @cd ${.CURDIR}; ${_MAKE} pre-world
140 .endif
141         @cd ${.CURDIR}; ${_MAKE} buildworld
142         @cd ${.CURDIR}; ${_MAKE} -B installworld
143 .if target(post-world)
144         @echo
145         @echo "--------------------------------------------------------------"
146         @echo ">>> Making 'post-world' target"
147         @echo "--------------------------------------------------------------"
148         @cd ${.CURDIR}; ${_MAKE} post-world
149 .endif
150         @echo
151         @echo "--------------------------------------------------------------"
152         @printf ">>> elf make world completed on `LC_ALL=C date`\n                       (started ${STARTTIME})\n"
153         @echo "--------------------------------------------------------------"
154
155 #
156 # kernel
157 #
158 # Short hand for `make buildkernel installkernel'
159 #
160 kernel: buildkernel installkernel
161
162 #
163 # Perform a few tests to determine if the installed tools are adequate
164 # for building the world.
165 #
166 upgrade_checks:
167         @if ! (cd ${.CURDIR}/tools/regression/usr.bin/make && \
168             PATH=${PATH} ${MAKE} 2>/dev/null); \
169         then \
170             (cd ${.CURDIR} && make make); \
171         fi
172
173 #
174 # Upgrade make(1) to the current version using the installed
175 # headers, libraries and tools.
176 #
177 MMAKEENV=       MAKEOBJDIRPREFIX=${MAKEPATH} \
178                 DESTDIR= \
179                 INSTALL="sh ${.CURDIR}/tools/install.sh"
180 MMAKE=          ${MMAKEENV} make \
181                 -D_UPGRADING \
182                 -DNOMAN -DNOSHARED \
183                 -DNO_CPU_CFLAGS -DNO_WERROR
184
185 make:
186         @echo
187         @echo "--------------------------------------------------------------"
188         @echo " Building an up-to-date make(1)"
189         @echo "--------------------------------------------------------------"
190         @cd ${.CURDIR}/usr.bin/make; \
191                 ${MMAKE} obj && \
192                 ${MMAKE} depend && \
193                 ${MMAKE} all && \
194                 ${MMAKE} install DESTDIR=${MAKEPATH} BINDIR=
195
196 #
197 # Define the upgrade targets. These are listed here in alphabetical
198 # order, but that's not important.
199 #
200 UPGRADE=        aout-to-elf aout-to-elf-build aout-to-elf-install \
201                 move-aout-libs
202
203 #
204 # Handle the upgrade targets, using the source relative mk files.
205 #
206
207 upgrade:        aout-to-elf
208
209 ${UPGRADE} : upgrade_checks
210         @cd ${.CURDIR}; \
211                 ${_MAKE} -f Makefile.upgrade -m ${.CURDIR}/share/mk ${.TARGET}
212
213 #
214 # universe
215 #
216 # Attempt to rebuild *everything* for all supported architectures,
217 # with reasonable chance of success, regardless of how old your
218 # existing system is.
219 #
220 i386_mach=      pc98
221 universe:
222         @echo "--------------------------------------------------------------"
223         @echo ">>> make universe started on ${STARTTIME}"
224         @echo "--------------------------------------------------------------"
225 .for arch in i386 sparc64 alpha ia64
226 .for mach in ${arch} ${${arch}_mach}
227         @echo ">> ${mach} started on `LC_ALL=C date`"
228         -cd ${.CURDIR} && ${MAKE} buildworld \
229             TARGET_ARCH=${arch} TARGET=${mach} \
230             __MAKE_CONF=/dev/null \
231             > _.${mach}.buildworld 2>&1
232         @echo ">> ${mach} buildworld completed on `LC_ALL=C date`"
233 .if exists(${.CURDIR}/sys/${mach}/conf/NOTES)
234         -cd ${.CURDIR}/sys/${mach}/conf && ${MAKE} LINT \
235             > ${.CURDIR}/_.${mach}.makeLINT 2>&1
236 .endif
237         cd ${.CURDIR} && ${MAKE} buildkernels TARGET_ARCH=${arch} TARGET=${mach}
238         @echo ">> ${mach} completed on `LC_ALL=C date`"
239 .endfor
240 .endfor
241         @echo "--------------------------------------------------------------"
242         @printf ">>> make universe completed on `LC_ALL=C date`\n                      (started ${STARTTIME})\n"
243         @echo "--------------------------------------------------------------"
244
245 KERNCONFS!=     cd ${.CURDIR}/sys/${TARGET}/conf && \
246                 find [A-Z]*[A-Z] -type f -maxdepth 0 ! -name NOTES
247
248 buildkernels:
249 .for kernel in ${KERNCONFS}
250         -cd ${.CURDIR} && ${MAKE} buildkernel \
251             KERNCONF=${kernel} \
252             __MAKE_CONF=/dev/null \
253             > _.${TARGET}.${kernel} 2>&1
254 .endfor