]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - Makefile.upgrade
This commit was generated by cvs2svn to compensate for changes in r39297,
[FreeBSD/FreeBSD.git] / Makefile.upgrade
1 #
2 #       $Id: Makefile.upgrade,v 1.4 1998/09/05 08:10:44 jb Exp $
3 #
4 # This makefile contains rules for preforming upgrades that are outside
5 # the scope of the normal build world process.
6 #
7
8 #
9 # Build things relative to the user's preferred object directory,
10 # defaulting to /usr/obj if not defined.
11 #
12 MAKEOBJDIRPREFIX?=/usr/obj
13
14 #
15 # The installed operating system release gives us the hint as to whether
16 # we need to build a kernel too.
17 #
18 INSTALLEDVERSION!=uname -r
19
20 #
21 # Upgrade the installed make to the current version using the installed
22 # headers, libraries and build tools. This is required on installed versions
23 # prior to 2.2.5 in which the installed make doesn't support the -m argument.
24 #
25 make    :
26         @echo
27         @echo "--------------------------------------------------------------"
28         @echo " Upgrading the installed make"
29         @echo "--------------------------------------------------------------"
30         @cd ${.CURDIR}/usr.bin/make; \
31                 make obj && make depend && make all && make install
32
33 #
34 # Upgrade from aout to elf, doing an aout build first to ensure that there
35 # are up-to-date tools before building the initial elf world. The aout
36 # tools just built into the object directory tree and executed from there
37 # during the elf build. Then install the aout tools, build an aout kernel
38 # with them (in case the installed kernel is an older version), then 
39 # install the elf world.
40 #
41 aout-to-elf aout-to-elf-install :                               \
42                 ${MAKEOBJDIRPREFIX}/do_aout_buildworld          \
43                 ${MAKEOBJDIRPREFIX}/do_elf_buildworld           \
44                 ${MAKEOBJDIRPREFIX}/do_move_aout_libs           \
45                 ${MAKEOBJDIRPREFIX}/do_aout_installworld        \
46                 ${MAKEOBJDIRPREFIX}/do_aout_kernel              \
47                 ${MAKEOBJDIRPREFIX}/do_elf_installworld         \
48                 ${MAKEOBJDIRPREFIX}/do_set_objformat            \
49                 ${MAKEOBJDIRPREFIX}/do_install_kernel_reboot
50
51 #
52 # Just do the build parts of the transition build.
53 #
54 aout-to-elf-build :                                             \
55                 ${MAKEOBJDIRPREFIX}/do_aout_buildworld          \
56                 ${MAKEOBJDIRPREFIX}/do_elf_buildworld           
57
58 #
59 # The installed system may not have tools capable of building an elf
60 # aware world, so a complete aout buildworld is required to get a known
61 # set of tools.
62 #
63 ${MAKEOBJDIRPREFIX}/do_aout_buildworld :
64         @echo
65         @echo "--------------------------------------------------------------"
66         @echo " Doing an aout buildworld to get an up-to-date set of tools"
67         @echo "--------------------------------------------------------------"
68         @cd ${.CURDIR}; MAKEOBJDIRPREFIX=${MAKEOBJDIRPREFIX}/aout \
69                 OBJFORMAT=aout \
70                 make -f Makefile.inc1 -m ${.CURDIR}/share/mk buildworld
71         @touch ${MAKEOBJDIRPREFIX}/do_aout_buildworld
72
73 #
74 # Temporary path for initial elf build.
75 #
76 AOUTTMPPATH=    ${MAKEOBJDIRPREFIX}/aout${.CURDIR}/tmp/sbin:${MAKEOBJDIRPREFIX}/aout${.CURDIR}/tmp/bin:${MAKEOBJDIRPREFIX}/aout${.CURDIR}/tmp/usr/sbin:${MAKEOBJDIRPREFIX}/aout${.CURDIR}/tmp/usr/bin:${MAKEOBJDIRPREFIX}/aout${.CURDIR}/tmp/usr/games
77
78 #
79 # Use the aout tools from the aout buildworld to do an elf buildworld.
80 #
81 ${MAKEOBJDIRPREFIX}/do_elf_buildworld :
82         @echo
83         @echo "--------------------------------------------------------------"
84         @echo " Doing an elf buildworld using the aout tools in the aout"
85         @echo " obj tree."
86         @echo "--------------------------------------------------------------"
87         @cd ${.CURDIR}; MAKEOBJDIRPREFIX=${MAKEOBJDIRPREFIX}/elf \
88                 PATH=${AOUTTMPPATH} OBJFORMAT=elf NOTOOLS=1 \
89                 TOOLROOT=${MAKEOBJDIRPREFIX}/aout${.CURDIR}/tmp \
90                 make -f Makefile.inc1 -m ${.CURDIR}/share/mk buildworld
91         @touch ${MAKEOBJDIRPREFIX}/do_elf_buildworld
92
93 #
94 # ldconfig should list the directories that the system is currently using.
95 #
96 CUSTOM_LIBDIRS!=ldconfig -r | grep search | sed "s/search directories: //" | sed "s/:/ /g"
97
98 #
99 # These are the standard library directories that should end up containing
100 # just elf libraries.
101 #
102 LIBDIRS=/usr/lib /usr/lib/compat /usr/local/lib /usr/X11R6/lib
103
104 #
105 # Go through the list of library directories from ldconfig and add any
106 # directory that doesn't contain an aout path component to the list of
107 # library directories to search.
108 #
109 .for _lib in ${CUSTOM_LIBDIRS}
110 _lib1=${_lib:S/\/aout//}
111 .if ${_lib1} == ${_lib}
112 .if ${LIBDIRS:R:M${_lib:R}} == ""
113 LIBDIRS+=${_lib}
114 .endif
115 .endif
116 .endfor
117
118 #
119 # Go through the list of library directories and prepare a list of
120 # aout directories.
121 #
122 AOUTLIBDIRS=
123 .for _lib in ${LIBDIRS}
124 AOUTLIBDIRS+=${_lib}/aout
125 .endfor
126
127 #
128 # Move the aout libraries into an aout sub-directory of each elf library
129 # directory.
130 #
131 ${MAKEOBJDIRPREFIX}/do_move_aout_libs move-aout-libs :
132         @echo
133         @echo "--------------------------------------------------------------"
134         @echo " You are about to move all the installed a.out libraries into"
135         @echo " an aout sub-directory of each elf library directory. You can"
136         @echo " type Ctrl-C to abort now or press return to start the moving"
137         @echo " the libraries."
138         @echo "--------------------------------------------------------------"
139         @echo Directories to search: ${LIBDIRS}
140         @/bin/sh -c "read -p \"Return to continue or Ctrl-C to abort: \" _e"
141         @sh ${.CURDIR}/tools/tools/upgrade/move_aout_libs.sh ${LIBDIRS}
142         @ldconfig ${AOUTLIBDIRS}
143         @touch ${MAKEOBJDIRPREFIX}/do_move_aout_libs
144
145 #
146 # Before installing the aout world, allow for the possibility that the
147 # world about to be installed has some different syscalls to the installed
148 # kernel which will make shutting the system down problematic. We set aside
149 # copies of certain programs which match the running kernel.
150 #
151 # Install the aout world so that anything that isn't replaced by the
152 # elf world will be updated.
153 #
154 ${MAKEOBJDIRPREFIX}/do_aout_installworld :
155         @echo
156         @echo "--------------------------------------------------------------"
157         @echo " You are about to update the installed system (or the system"
158         @echo " that your DESTDIR points to). You can type Ctrl-C to abort"
159         @echo " now or press return to start the first phase of the update."
160         @echo "--------------------------------------------------------------"
161         @/bin/sh -c "read -p \"Return to continue or Ctrl-C to abort: \" _e"
162 .if     ${INSTALLEDVERSION} != "3.0-CURRENT"
163         @echo
164         @echo "--------------------------------------------------------------"
165         @echo " Saving a copy of programs required to shut the system down"
166         @echo "--------------------------------------------------------------"
167         @cp /bin/sh ${MAKEOBJDIRPREFIX}
168         @cp /sbin/reboot ${MAKEOBJDIRPREFIX}
169 .endif
170         @echo
171         @echo "--------------------------------------------------------------"
172         @echo " Doing an aout installworld using the aout tools in the aout"
173         @echo " obj tree."
174         @echo "--------------------------------------------------------------"
175         @cd ${.CURDIR}; MAKEOBJDIRPREFIX=${MAKEOBJDIRPREFIX}/aout \
176                 PATH=${AOUTTMPPATH} OBJFORMAT=aout NOTOOLS=1 \
177                 TOOLROOT=${MAKEOBJDIRPREFIX}/aout${.CURDIR}/tmp \
178                 make -f Makefile.inc1 -m ${.CURDIR}/share/mk installworld
179         @touch ${MAKEOBJDIRPREFIX}/do_aout_installworld
180
181 #
182 # The installed kernel may not match the world that is installed, so build
183 # a generic kernel, but don't install it. The user can decide if the kernel
184 # needs to be installed. Perhaps we should install it in the root
185 # directory as an obscure name just in case a reboot is required?
186 #
187 ${MAKEOBJDIRPREFIX}/do_aout_kernel :
188 .if     ${INSTALLEDVERSION} == "3.0-CURRENT"
189         @echo
190         @echo "--------------------------------------------------------------"
191         @echo " You are already running 3.0-CURRENT, so a kernel build"
192         @echo " is probably not required."
193         @echo "--------------------------------------------------------------"
194 .else
195         @echo
196         @echo "--------------------------------------------------------------"
197         @echo " Building a generic kernel using the new aout tools"
198         @echo "--------------------------------------------------------------"
199 .if     exists(${.CURDIR}/sys/compile/GENERICupgrade)
200         @rm -rf ${.CURDIR}/sys/compile/GENERICupgrade
201 .endif
202         @cd ${.CURDIR}/sys/${MACHINE}/conf; config GENERICupgrade
203         @-cd ${.CURDIR}/sys/compile/GENERICupgrade; \
204                 OBJFORMAT=aout make depend && make all
205         @cd ${.CURDIR}/sys/compile/GENERICupgrade; \
206                 OBJFORMAT=aout make depend && make all
207 .endif
208         @touch ${MAKEOBJDIRPREFIX}/do_aout_kernel
209
210 #
211 # Install the elf world overwriting just about all the previously installed
212 # aout world. Any aout things that need to be kept have already been
213 # installed in different places (typically in aout subdirectories).
214 #
215 ${MAKEOBJDIRPREFIX}/do_elf_installworld :
216         @echo
217         @echo "--------------------------------------------------------------"
218         @echo " You are about to update the installed system (or the system"
219         @echo " that your DESTDIR points to) with the elf versions of"
220         @echo " everything, replacing the aout versions. You can type Ctrl-C"
221         @echo " to abort now, leaving just the aout world installed, or"
222         @echo " press return to start the second phase of the update."
223         @echo "--------------------------------------------------------------"
224         @/bin/sh -c "read -p \"Return to continue or Ctrl-C to abort: \" _e"
225         @echo
226         @echo "--------------------------------------------------------------"
227         @echo " Doing an elf installworld using the aout tools in the aout"
228         @echo " obj tree."
229         @echo "--------------------------------------------------------------"
230         @cd ${.CURDIR}; MAKEOBJDIRPREFIX=${MAKEOBJDIRPREFIX}/elf \
231                 PATH=${AOUTTMPPATH} OBJFORMAT=elf NOTOOLS=1 \
232                 TOOLROOT=${MAKEOBJDIRPREFIX}/aout${.CURDIR}/tmp \
233                 make -f Makefile.inc1 -m ${.CURDIR}/share/mk installworld
234         @touch ${MAKEOBJDIRPREFIX}/do_elf_installworld
235
236 #
237 # Now that the elf world has been installed, we can set the default
238 # object format to elf.
239 #
240 ${MAKEOBJDIRPREFIX}/do_set_objformat    :
241         @echo
242         @echo "--------------------------------------------------------------"
243         @echo " Setting the default object format to elf"
244         @echo "--------------------------------------------------------------"
245         @echo "OBJFORMAT=elf" > ${DESTDIR}/etc/objformat
246         @touch ${MAKEOBJDIRPREFIX}/do_set_objformat
247
248 #
249 # If not already running a current kernel, install the GENERICupgrade kernel
250 # and reboot.
251 #
252 ${MAKEOBJDIRPREFIX}/do_install_kernel_reboot    :
253 .if     ${INSTALLEDVERSION} == "3.0-CURRENT"
254         @echo
255         @echo "--------------------------------------------------------------"
256         @echo " Your system has been updated to run elf by default!"
257         @echo
258         @echo " You should reboot your system now."
259         @echo "--------------------------------------------------------------"
260         @touch ${MAKEOBJDIRPREFIX}/do_install_kernel_reboot
261 .else
262         @echo
263         @echo "--------------------------------------------------------------"
264         @echo " Your system has been updated to run elf by default!"
265         @echo
266         @echo " Since you are running ${INSTALLEDVERSION}, the kernel must"
267         @echo " be installed before the system is rebooted. You can type"
268         @echo " Ctrl-C to abort the kernel installation (at your own risk),"
269         @echo " or press return for the kernel to be installed and the"
270         @echo " system rebooted."
271         @echo "--------------------------------------------------------------"
272         @${MAKEOBJDIRPREFIX}/sh -c "read -p \"Return to continue or Ctrl-C to abort: \" _e"
273         @echo
274         @echo "--------------------------------------------------------------"
275         @echo " Installing a new GENERICupgrade kernel"
276         @echo "--------------------------------------------------------------"
277         @cd ${.CURDIR}/sys/compile/GENERICupgrade; make install
278         @echo
279         @echo "--------------------------------------------------------------"
280         @echo " Rebooting......."
281         @echo "--------------------------------------------------------------"
282         @touch ${MAKEOBJDIRPREFIX}/do_install_kernel_reboot
283         @-${MAKEOBJDIRPREFIX}/reboot
284 .endif
285