]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - Makefile.upgrade
This commit was generated by cvs2svn to compensate for changes in r43829,
[FreeBSD/FreeBSD.git] / Makefile.upgrade
1 #
2 #       $Id: Makefile.upgrade,v 1.12 1999/01/27 08:49:53 jkh 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!=sh ${.CURDIR}/tools/tools/upgrade/getosreldate.sh
19 INSTALLEDNAME!=uname -r
20
21 #
22 # Upgrade the installed make to the current version using the installed
23 # headers, libraries and build tools. This is required on installed versions
24 # prior to 2.2.5 in which the installed make doesn't support the -m argument.
25 #
26 make    :
27         @echo
28         @echo "--------------------------------------------------------------"
29         @echo " Upgrading the installed make"
30         @echo "--------------------------------------------------------------"
31         @cd ${.CURDIR}/usr.bin/make; \
32                 make obj && make depend && make all && make install
33
34 #
35 # Upgrade from aout to elf, doing an aout build first to ensure that there
36 # are up-to-date tools before building the initial elf world. The aout
37 # tools just built into the object directory tree and executed from there
38 # during the elf build. Then install the aout tools, build an aout kernel
39 # with them (in case the installed kernel is an older version), then 
40 # install the elf world.
41 #
42 aout-to-elf aout-to-elf-install :       /var/db/update.cfg      \
43                 ${MAKEOBJDIRPREFIX}/do_aout_buildworld          \
44                 ${MAKEOBJDIRPREFIX}/do_elf_buildworld           \
45                 ${MAKEOBJDIRPREFIX}/do_move_aout_libs           \
46                 ${MAKEOBJDIRPREFIX}/do_aout_installworld        \
47                 ${MAKEOBJDIRPREFIX}/do_elf_installworld         \
48                 ${MAKEOBJDIRPREFIX}/do_elf_kernel               \
49                 ${MAKEOBJDIRPREFIX}/do_set_objformat            \
50                 ${MAKEOBJDIRPREFIX}/do_reboot
51
52 # front-load all the information we're going to need.
53 /var/db/update.cfg:
54         @if [ -f ${.CURDIR}/tools/tools/upgrade/doupgrade.sh ]; then \
55             env MACHINE=${MACHINE} CURDIR=${.CURDIR} sh ${.CURDIR}/tools/tools/upgrade/doupgrade.sh 1 /var/db/update.cfg; \
56         else \
57             echo "Your source tree must not be fully populated; unable to find upgrade script"; echo "in ${.CURDIR}/tools/tools/upgrade/doupgrade.sh."; exit 1; \
58         fi
59
60 #
61 # Just do the build parts of the transition build.
62 #
63 aout-to-elf-build :                                             \
64                 ${MAKEOBJDIRPREFIX}/do_aout_buildworld          \
65                 ${MAKEOBJDIRPREFIX}/do_elf_buildworld           
66
67 #
68 # The installed system may not have tools capable of building an elf
69 # aware world, so a complete aout buildworld is required to get a known
70 # set of tools.
71 #
72 ${MAKEOBJDIRPREFIX}/do_aout_buildworld :
73         @echo
74         @echo "--------------------------------------------------------------"
75         @echo " Doing an aout buildworld to get an up-to-date set of tools"
76         @echo "--------------------------------------------------------------"
77         @cd ${.CURDIR}; MAKEOBJDIRPREFIX=${MAKEOBJDIRPREFIX}/aout \
78                 OBJFORMAT=aout REALLY_WANT_DEPRECIATED_AOUT=yes \
79                 make -f Makefile.inc1 -m ${.CURDIR}/share/mk buildworld
80         @touch ${MAKEOBJDIRPREFIX}/do_aout_buildworld
81
82 #
83 # Temporary path for initial elf build.
84 #
85 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
86
87 #
88 # Use the aout tools from the aout buildworld to do an elf buildworld.
89 #
90 ${MAKEOBJDIRPREFIX}/do_elf_buildworld :
91         @echo
92         @echo "--------------------------------------------------------------"
93         @echo " Doing an elf buildworld using the aout tools in the aout"
94         @echo " obj tree."
95         @echo "--------------------------------------------------------------"
96         @cd ${.CURDIR}; MAKEOBJDIRPREFIX=${MAKEOBJDIRPREFIX}/elf \
97                 PATH=${AOUTTMPPATH} OBJFORMAT=elf NOTOOLS=1 \
98                 TOOLROOT=${MAKEOBJDIRPREFIX}/aout${.CURDIR}/tmp \
99                 make -f Makefile.inc1 -m ${.CURDIR}/share/mk buildworld
100         @touch ${MAKEOBJDIRPREFIX}/do_elf_buildworld
101
102 #
103 # ldconfig should list the directories that the system is currently using.
104 #
105 CUSTOM_LIBDIRS!=ldconfig -r | grep search | sed "s/search directories: //" | sed "s/:/ /g"
106
107 #
108 # These are the standard library directories that should end up containing
109 # just elf libraries.
110 #
111 LIBDIRS=/usr/lib /usr/lib/compat /usr/local/lib /usr/X11R6/lib
112
113 #
114 # Go through the list of library directories from ldconfig and add any
115 # directory that doesn't contain an aout path component to the list of
116 # library directories to search.
117 #
118 .for _lib in ${CUSTOM_LIBDIRS}
119 _lib1=${_lib:S/\/aout//}
120 .if ${_lib1} == ${_lib}
121 .if ${LIBDIRS:R:M${_lib:R}} == ""
122 LIBDIRS+=${_lib}
123 .endif
124 .endif
125 .endfor
126
127 #
128 # Go through the list of library directories and prepare a list of
129 # aout directories.
130 #
131 AOUTLIBDIRS=
132 .for _lib in ${LIBDIRS}
133 AOUTLIBDIRS+=${_lib}/aout
134 .endfor
135
136 #
137 # Move the aout libraries into an aout sub-directory of each elf library
138 # directory.
139 #
140 ${MAKEOBJDIRPREFIX}/do_move_aout_libs move-aout-libs :
141 .if !defined(NOCONFIRM)
142         @echo
143         @echo "--------------------------------------------------------------"
144         @echo " You are about to move all the installed a.out libraries into"
145         @echo " an aout sub-directory of each elf library directory. You can"
146         @echo " type Ctrl-C to abort now or press return to start the moving"
147         @echo " the libraries."
148         @echo "--------------------------------------------------------------"
149         @echo Directories to search: ${LIBDIRS}
150         @/bin/sh -c "read -p \"Return to continue or Ctrl-C to abort: \" _e"
151         @sh ${.CURDIR}/tools/tools/upgrade/move_aout_libs.sh ${LIBDIRS}
152 .else
153         @NOCONFIRM=1 sh ${.CURDIR}/tools/tools/upgrade/move_aout_libs.sh ${LIBDIRS}
154 .endif
155         @ldconfig ${AOUTLIBDIRS}
156         @touch ${MAKEOBJDIRPREFIX}/do_move_aout_libs
157
158 #
159 # Before installing the aout world, allow for the possibility that the
160 # world about to be installed has some different syscalls to the installed
161 # kernel which will make shutting the system down problematic. We set aside
162 # copies of certain programs which match the running kernel.
163 #
164 # Install the aout world so that anything that isn't replaced by the
165 # elf world will be updated.
166 #
167 ${MAKEOBJDIRPREFIX}/do_aout_installworld :
168 .if     ${INSTALLEDVERSION} < 300003
169         @echo
170         @echo "--------------------------------------------------------------"
171         @echo " Saving a copy of programs required to shut the system down"
172         @echo "--------------------------------------------------------------"
173         @cp /bin/sh ${MAKEOBJDIRPREFIX}
174         @cp /sbin/reboot ${MAKEOBJDIRPREFIX}
175 .endif
176         @touch ${MAKEOBJDIRPREFIX}/do_aout_installworld
177
178 #
179 # Build and install a new kernel, as well as the boot blocks necessary to
180 # boot it.
181 #
182 ${MAKEOBJDIRPREFIX}/do_elf_kernel :
183         @if [ -f /var/db/update.cfg -a -f ${.CURDIR}/tools/tools/upgrade/doupgrade.sh ]; then \
184              env MACHINE=${MACHINE} CURDIR=${.CURDIR} sh ${.CURDIR}/tools/tools/upgrade/doupgrade.sh 2 /var/db/update.cfg; \
185         fi
186         @touch ${MAKEOBJDIRPREFIX}/do_elf_kernel
187         @rm -f /var/db/update.cfg
188
189 #
190 # Install the elf world overwriting just about all the previously installed
191 # aout world. Any aout things that need to be kept have already been
192 # installed in different places (typically in aout subdirectories).
193 #
194 ${MAKEOBJDIRPREFIX}/do_elf_installworld :
195 .if !defined(NOCONFIRM)
196         @echo
197         @echo "--------------------------------------------------------------"
198         @echo " You are about to update the installed system (or the system"
199         @echo " that your DESTDIR points to) with the elf versions of"
200         @echo " everything, replacing the aout versions. You can type Ctrl-C"
201         @echo " to abort now, leaving just the aout world installed, or"
202         @echo " press return to start the second phase of the update."
203         @echo "--------------------------------------------------------------"
204         @/bin/sh -c "read -p \"Return to continue or Ctrl-C to abort: \" _e"
205 .endif
206         @echo
207         @echo "--------------------------------------------------------------"
208         @echo " Doing an elf installworld using the aout tools in the aout"
209         @echo " obj tree."
210         @echo "--------------------------------------------------------------"
211         @cd ${.CURDIR}; MAKEOBJDIRPREFIX=${MAKEOBJDIRPREFIX}/elf \
212                 PATH=${AOUTTMPPATH} OBJFORMAT=elf NOTOOLS=1 \
213                 TOOLROOT=${MAKEOBJDIRPREFIX}/aout${.CURDIR}/tmp \
214                 make -f Makefile.inc1 -m ${.CURDIR}/share/mk installworld
215         @if [ ! -f /etc/pam.conf ]; then cp ${.CURDIR}/etc/pam.conf /etc; fi
216         @if [ ! -f /etc/auth.conf ]; then cp ${.CURDIR}/etc/auth.conf /etc; fi
217         @if [ ! -f /etc/login.conf ]; then cp ${.CURDIR}/etc/login.conf /etc; fi
218         @touch ${MAKEOBJDIRPREFIX}/do_elf_installworld
219
220 #
221 # Now that the elf world has been installed, we can set the default
222 # object format to elf.
223 #
224 ${MAKEOBJDIRPREFIX}/do_set_objformat    :
225         @echo
226         @echo "--------------------------------------------------------------"
227         @echo " Setting the default object format to elf"
228         @echo "--------------------------------------------------------------"
229         @echo "OBJFORMAT=elf" > ${DESTDIR}/etc/objformat
230         @touch ${MAKEOBJDIRPREFIX}/do_set_objformat
231
232 #
233 # Time to reboot!
234 ${MAKEOBJDIRPREFIX}/do_reboot   :
235 .if !defined(NOCONFIRM)
236         @echo
237         @echo "--------------------------------------------------------------"
238         @echo " Your system has now been fully updated to elf!"
239         @echo
240         @echo " It's now time to reboot from your new ELF kernel."
241         @echo " You can type Ctrl-C to abort this (at your own risk)"
242         @echo " or press return to reboot the system."
243         @echo "--------------------------------------------------------------"
244         @${MAKEOBJDIRPREFIX}/sh -c "read -p \"Return to continue or Ctrl-C to abort: \" _e"
245 .endif
246         @echo " Rebooting......."
247         @echo "--------------------------------------------------------------"
248         @touch ${MAKEOBJDIRPREFIX}/do_reboot
249         @-${MAKEOBJDIRPREFIX}/reboot