]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - Makefile
This commit was generated by cvs2svn to compensate for changes in r118611,
[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
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
80
81 PATH=   /sbin:/bin:/usr/sbin:/usr/bin
82 MAKEOBJDIRPREFIX?=      /usr/obj
83 MAKEPATH=       ${MAKEOBJDIRPREFIX}${.CURDIR}/make.${MACHINE}
84 BINMAKE= \
85         `if [ -x ${MAKEPATH}/make ]; then echo ${MAKEPATH}/make; else echo ${MAKE}; fi` \
86         -m ${.CURDIR}/share/mk
87 _MAKE=  PATH=${PATH} ${BINMAKE} -f Makefile.inc1
88
89 #
90 # Handle the user-driven targets, using the source relative mk files.
91 #
92 ${TGTS} ${BITGTS}: upgrade_checks
93         @cd ${.CURDIR}; \
94                 ${_MAKE} ${.TARGET}
95
96 # Set a reasonable default
97 .MAIN:  all
98
99 STARTTIME!= LC_ALL=C date
100 #
101 # world
102 #
103 # Attempt to rebuild and reinstall *everything*, with reasonable chance of
104 # success, regardless of how old your existing system is.
105 #
106 world: upgrade_checks
107         @echo "--------------------------------------------------------------"
108         @echo ">>> make world started on ${STARTTIME}"
109         @echo "--------------------------------------------------------------"
110 .if target(pre-world)
111         @echo
112         @echo "--------------------------------------------------------------"
113         @echo ">>> Making 'pre-world' target"
114         @echo "--------------------------------------------------------------"
115         @cd ${.CURDIR}; ${_MAKE} pre-world
116 .endif
117         @cd ${.CURDIR}; ${_MAKE} buildworld
118         @cd ${.CURDIR}; ${_MAKE} -B installworld
119 .if target(post-world)
120         @echo
121         @echo "--------------------------------------------------------------"
122         @echo ">>> Making 'post-world' target"
123         @echo "--------------------------------------------------------------"
124         @cd ${.CURDIR}; ${_MAKE} post-world
125 .endif
126         @echo
127         @echo "--------------------------------------------------------------"
128         @echo ">>> make world completed on `LC_ALL=C date`"
129         @echo "                   (started ${STARTTIME})"
130         @echo "--------------------------------------------------------------"
131
132 #
133 # kernel
134 #
135 # Short hand for `make buildkernel installkernel'
136 #
137 kernel: buildkernel installkernel
138
139 #
140 # Perform a few tests to determine if the installed tools are adequate
141 # for building the world.
142 #
143 upgrade_checks:
144         @if ! (cd ${.CURDIR}/tools/regression/usr.bin/make && \
145             PATH=${PATH} ${BINMAKE} >/dev/null 2>&1); \
146         then \
147             (cd ${.CURDIR} && make make); \
148         fi
149
150 #
151 # Upgrade make(1) to the current version using the installed
152 # headers, libraries and tools.
153 #
154 MMAKEENV=       MAKEOBJDIRPREFIX=${MAKEPATH} \
155                 DESTDIR= \
156                 INSTALL="sh ${.CURDIR}/tools/install.sh"
157 MMAKE=          ${MMAKEENV} make \
158                 -D_UPGRADING \
159                 -DNOMAN -DNOSHARED \
160                 -DNO_CPU_CFLAGS -DNO_WERROR
161
162 make:
163         @echo
164         @echo "--------------------------------------------------------------"
165         @echo ">>> Building an up-to-date make(1)"
166         @echo "--------------------------------------------------------------"
167         @cd ${.CURDIR}/usr.bin/make; \
168                 ${MMAKE} obj && \
169                 ${MMAKE} depend && \
170                 ${MMAKE} all && \
171                 ${MMAKE} install DESTDIR=${MAKEPATH} BINDIR=
172
173 #
174 # universe
175 #
176 # Attempt to rebuild *everything* for all supported architectures,
177 # with reasonable chance of success, regardless of how old your
178 # existing system is.
179 #
180 i386_mach=      pc98
181 universe:
182         @echo "--------------------------------------------------------------"
183         @echo ">>> make universe started on ${STARTTIME}"
184         @echo "--------------------------------------------------------------"
185 .for arch in i386 sparc64 alpha ia64
186 .for mach in ${arch} ${${arch}_mach}
187         @echo ">> ${mach} started on `LC_ALL=C date`"
188         -cd ${.CURDIR} && ${MAKE} buildworld \
189             TARGET_ARCH=${arch} TARGET=${mach} \
190             __MAKE_CONF=/dev/null \
191             > _.${mach}.buildworld 2>&1
192         @echo ">> ${mach} buildworld completed on `LC_ALL=C date`"
193 .if exists(${.CURDIR}/sys/${mach}/conf/NOTES)
194         -cd ${.CURDIR}/sys/${mach}/conf && ${MAKE} LINT \
195             > ${.CURDIR}/_.${mach}.makeLINT 2>&1
196 .endif
197         cd ${.CURDIR} && ${MAKE} buildkernels TARGET_ARCH=${arch} TARGET=${mach}
198         @echo ">> ${mach} completed on `LC_ALL=C date`"
199 .endfor
200 .endfor
201         @echo "--------------------------------------------------------------"
202         @echo ">>> make universe completed on `LC_ALL=C date`"
203         @echo "                      (started ${STARTTIME})"
204         @echo "--------------------------------------------------------------"
205
206 KERNCONFS!=     cd ${.CURDIR}/sys/${TARGET}/conf && \
207                 find [A-Z]*[A-Z] -type f -maxdepth 0 ! -name NOTES
208
209 buildkernels:
210 .for kernel in ${KERNCONFS}
211         -cd ${.CURDIR} && ${MAKE} buildkernel \
212             KERNCONF=${kernel} \
213             __MAKE_CONF=/dev/null \
214             > _.${TARGET}.${kernel} 2>&1
215 .endfor