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