]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - Makefile
Bmake bits for Gcc 3.1.
[FreeBSD/FreeBSD.git] / Makefile
1 #
2 # $FreeBSD$
3 #
4 # The user-driven targets are:
5 #
6 # buildworld          - Rebuild *everything*, including glue to help do
7 #                       upgrades.
8 # installworld        - Install everything built by "buildworld".
9 # world               - buildworld + installworld.
10 # buildkernel         - Rebuild the kernel and the kernel-modules.
11 # installkernel       - Install the kernel and the kernel-modules.
12 # reinstallkernel     - Reinstall the kernel and the kernel-modules.
13 # kernel              - buildkernel + installkernel.
14 # update              - Convenient way to update your source tree (cvs).
15 # upgrade             - Upgrade a.out (2.2.x/3.0) system to the new ELF way
16 # most                - Build user commands, no libraries or include files.
17 # installmost         - Install user commands, no libraries or include files.
18 # aout-to-elf         - Upgrade an system from a.out to elf format (see below).
19 # aout-to-elf-build   - Build everything required to upgrade a system from
20 #                       a.out to elf format (see below).
21 # aout-to-elf-install - Install everything built by aout-to-elf-build (see
22 #                       below).
23 # move-aout-libs      - Move the a.out libraries into an aout sub-directory
24 #                       of each elf library sub-directory.
25 #
26 # This makefile is simple by design. The FreeBSD make automatically reads
27 # the /usr/share/mk/sys.mk unless the -m argument is specified on the 
28 # command line. By keeping this makefile simple, it doesn't matter too
29 # much how different the installed mk files are from those in the source
30 # tree. This makefile executes a child make process, forcing it to use
31 # the mk files from the source tree which are supposed to DTRT.
32 #
33 # The user-driven targets (as listed above) are implemented in Makefile.inc1.
34 #
35 # If you want to build your system from source be sure that /usr/obj has
36 # at least 400MB of diskspace available.
37 #
38 # For individuals wanting to build from the sources currently on their
39 # system, the simple instructions are:
40 #
41 # 1.  `cd /usr/src'  (or to the directory containing your source tree).
42 # 2.  `make world'
43 #
44 # For individuals wanting to upgrade their sources (even if only a
45 # delta of a few days):
46 #
47 # 1.  `cd /usr/src'       (or to the directory containing your source tree).
48 # 2.  `make buildworld'
49 # 3.  `make buildkernel KERNCONF=YOUR_KERNEL_HERE'     (default is GENERIC).
50 # 4.  `make installkernel KERNCONF=YOUR_KERNEL_HERE'   (default is GENERIC).
51 # 5.  `reboot'        (in single user mode: boot -s from the loader prompt).
52 # 6.  `mergemaster -p'
53 # 7.  `make installworld'
54 # 8.  `mergemaster'
55 # 9.  `reboot'
56 #
57 # See src/UPDATING `COMMON ITEMS' for more complete information.
58 #
59 # If -DWANT_AOUT is specified, a `make world' with OBJFORMAT=elf will
60 # update the legacy support for aout. This includes all libraries, ld.so
61 # and boot objects. This part of build should be regarded as
62 # deprecated and you should _not_ expect to be able to do this past the
63 # release of 4.0. You have exactly one major release to move entirely
64 # to elf.
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 # At the end of the upgrade procedure, /etc/objformat is created or
86 # updated to contain OBJFORMAT=elf. From then on, you're elf by default.
87 #
88 # ----------------------------------------------------------------------------
89 #
90 #
91 # Define the user-driven targets. These are listed here in alphabetical
92 # order, but that's not important.
93 #
94 TGTS=   all all-man buildkernel buildworld checkdpadd clean \
95         cleandepend cleandir depend distribute distributeworld everything \
96         hierarchy includes install installcheck installkernel \
97         reinstallkernel installmost installworld libraries lint maninstall \
98         mk most obj objlink regress rerelease tags update
99
100 .ORDER: buildworld installworld
101 .ORDER: buildworld distributeworld
102 .ORDER: buildkernel installkernel
103 .ORDER: buildkernel reinstallkernel
104
105 PATH=   /sbin:/bin:/usr/sbin:/usr/bin
106 MAKE=   PATH=${PATH} make -m ${.CURDIR}/share/mk -f Makefile.inc1
107
108 #
109 # Handle the user-driven targets, using the source relative mk files.
110 #
111 ${TGTS}: upgrade_checks
112         @cd ${.CURDIR}; \
113                 ${MAKE} ${.TARGET}
114
115 # Set a reasonable default
116 .MAIN:  all
117
118 STARTTIME!= LC_ALL=C date
119 #
120 # world
121 #
122 # Attempt to rebuild and reinstall *everything*, with reasonable chance of
123 # success, regardless of how old your existing system is.
124 #
125 world: upgrade_checks
126         @echo "--------------------------------------------------------------"
127         @echo ">>> ${OBJFORMAT} make world started on ${STARTTIME}"
128         @echo "--------------------------------------------------------------"
129 .if target(pre-world)
130         @echo
131         @echo "--------------------------------------------------------------"
132         @echo ">>> Making 'pre-world' target"
133         @echo "--------------------------------------------------------------"
134         @cd ${.CURDIR}; ${MAKE} pre-world
135 .endif
136         @cd ${.CURDIR}; ${MAKE} buildworld
137         @cd ${.CURDIR}; ${MAKE} -B installworld
138 .if target(post-world)
139         @echo
140         @echo "--------------------------------------------------------------"
141         @echo ">>> Making 'post-world' target"
142         @echo "--------------------------------------------------------------"
143         @cd ${.CURDIR}; ${MAKE} post-world
144 .endif
145         @echo
146         @echo "--------------------------------------------------------------"
147         @printf ">>> ${OBJFORMAT} make world completed on `LC_ALL=C date`\n                        (started ${STARTTIME})\n"
148         @echo "--------------------------------------------------------------"
149
150 #
151 # kernel
152 #
153 # Short hand for `make buildkernel installkernel'
154 #
155 kernel: buildkernel installkernel
156
157 #
158 # Perform a few tests to determine if the installed tools are adequate
159 # for building the world. These are for older systems (prior to 2.2.5).
160 #
161 # From 2.2.5 onwards, the installed tools will pass these upgrade tests,
162 # so the normal make world is capable of doing what is required to update
163 # the system to current.
164 #
165 upgrade_checks:
166         @cd ${.CURDIR}; \
167                 if ! make -m ${.CURDIR}/share/mk test > /dev/null 2>&1; then \
168                         make make; \
169                 fi
170         @cd ${.CURDIR}; \
171                 if make -V .CURDIR:C/.// 2>&1 >/dev/null | \
172                     grep -q "Unknown modifier 'C'"; then \
173                         make make; \
174                 fi
175
176 #
177 # A simple test target used as part of the test to see if make supports
178 # the -m argument.
179 #
180 test:
181
182 #
183 # Upgrade the installed make to the current version using the installed
184 # headers, libraries and build tools. This is required on installed versions
185 # prior to 2.2.5 in which the installed make doesn't support the -m argument.
186 #
187 make:
188         @echo
189         @echo "--------------------------------------------------------------"
190         @echo " Upgrading the installed make"
191         @echo "--------------------------------------------------------------"
192         @cd ${.CURDIR}/usr.bin/make; \
193                 make obj && make depend && make all && make install
194
195 #
196 # Define the upgrade targets. These are listed here in alphabetical
197 # order, but that's not important.
198 #
199 UPGRADE=        aout-to-elf aout-to-elf-build aout-to-elf-install \
200                 move-aout-libs
201
202 #
203 # Handle the upgrade targets, using the source relative mk files.
204 #
205
206 upgrade:        aout-to-elf
207
208 ${UPGRADE} : upgrade_checks
209         @cd ${.CURDIR}; \
210                 ${MAKE} -f Makefile.upgrade -m ${.CURDIR}/share/mk ${.TARGET}