2 # $Id: Makefile,v 1.129 1997/06/08 14:03:23 jhay Exp $
4 # Make command line options:
5 # -DCLOBBER will remove /usr/include
6 # -DMAKE_EBONES to build eBones (KerberosIV)
7 # -DALLLANG to build documentation for all languages
8 # (where available -- see share/doc/Makefile)
10 # -DNOCLEANDIR run ${MAKE} clean, instead of ${MAKE} cleandir
11 # -DNOCLEAN do not clean at all
12 # -DNOCRYPT will prevent building of crypt versions
13 # -DNOLKM do not build loadable kernel modules
14 # -DNOOBJDIR do not run ``${MAKE} obj''
15 # -DNOPROFILE do not build profiled libraries
16 # -DNOSECURE do not go into secure subdir
17 # -DNOGAMES do not go into games subdir
18 # -DNOSHARE do not go into share subdir
19 # -DNOINFO do not make or install info files
20 # -DNOLIBC_R do not build libc_r.
21 # LOCAL_DIRS="list of dirs" to add additional dirs to the SUBDIR list
24 # The intended user-driven targets are:
25 # world - rebuild *everything*, including glue to help do upgrades.
26 # reinstall - use an existing (eg: NFS mounted) build to do an update.
27 # update - convenient way to update your source tree (eg: sup/cvs)
28 # most - build user commands, no libraries or include files
29 # installmost - install user commands, no libraries or include files
31 # Standard targets (not defined here) are documented in the makefiles in
32 # /usr/share/mk. These include:
33 # obj depend all install clean cleandepend cleanobj
35 .MAKEFLAGS:= ${.MAKEFLAGS} -m ${.CURDIR}/share/mk
37 # Put initial settings here.
40 # We must do share/info early so that installation of info `dir'
41 # entries works correctly. Do it first since it is less likely to
42 # grow dependencies on include and lib than vice versa.
43 .if exists(share/info)
47 # We must do include and lib early so that the perl *.ph generation
48 # works correctly as it uses the header files installed by this.
59 .if exists(games) && !defined(NOGAMES)
65 .if exists(eBones) && !defined(NOCRYPT) && defined(MAKE_EBONES)
74 .if exists(share) && !defined(NOSHARE)
86 .if exists(secure) && !defined(NOCRYPT) && !defined(NOSECURE)
89 .if exists(lkm) && !defined(NOLKM)
93 # etc must be last for "distribute" to work
94 .if exists(etc) && make(distribute)
98 # These are last, since it is nice to at least get the base system
99 # rebuilt before you do them.
100 .if defined(LOCAL_DIRS)
101 .for _DIR in ${LOCAL_DIRS}
102 .if exists(${_DIR}) & exists(${_DIR}/Makefile)
108 # Handle -DNOOBJDIR, -DNOCLEAN and -DNOCLEANDIR
109 .if defined(NOOBJDIR)
118 .if defined(NOCLEANDIR)
129 # While building tools for bootstrapping, we dont need to waste time on
130 # profiled libraries or man pages. This speeds things up somewhat.
132 MK_FLAGS= -DNOINFO -DNOMAN -DNOPROFILE
137 # Attempt to rebuild and reinstall *everything*, with reasonable chance of
138 # success, regardless of how old your existing system is.
140 # >> Beware, it overwrites the local build environment! <<
143 @echo "--------------------------------------------------------------"
144 @echo "make world started on `LC_TIME=C date`"
145 @echo "--------------------------------------------------------------"
146 .if target(pre-world)
147 @echo "--------------------------------------------------------------"
148 @echo " Making 'pre-world' target"
149 @echo "--------------------------------------------------------------"
150 cd ${.CURDIR} && ${MAKE} pre-world
153 @echo "--------------------------------------------------------------"
154 @echo " Making hierarchy"
155 @echo "--------------------------------------------------------------"
156 cd ${.CURDIR} && ${MAKE} hierarchy
158 @echo "--------------------------------------------------------------"
159 @echo " Cleaning up the source tree"
160 @echo "--------------------------------------------------------------"
162 @echo "Not cleaning anything! I sure hope you know what you are doing!"
164 cd ${.CURDIR} && ${MAKE} ${CLEANDIR}
167 .if !defined(NOOBJDIR)
168 @echo "--------------------------------------------------------------"
169 @echo " Rebuilding the obj tree"
170 @echo "--------------------------------------------------------------"
171 cd ${.CURDIR} && ${MAKE} obj
174 @echo "--------------------------------------------------------------"
175 @echo " Rebuilding bootstrap tools"
176 @echo "--------------------------------------------------------------"
177 cd ${.CURDIR} && ${MAKE} bootstrap
179 @echo "--------------------------------------------------------------"
180 @echo " Rebuilding tools necessary to build the include files"
181 @echo "--------------------------------------------------------------"
182 cd ${.CURDIR} && ${MAKE} include-tools
184 @echo "--------------------------------------------------------------"
185 @echo " Rebuilding /usr/include"
186 @echo "--------------------------------------------------------------"
187 cd ${.CURDIR} && ${MAKE} includes
189 @echo "--------------------------------------------------------------"
190 @echo " Rebuilding tools needed to build the libraries"
191 @echo "--------------------------------------------------------------"
192 cd ${.CURDIR} && ${MAKE} lib-tools
194 @echo "--------------------------------------------------------------"
195 @echo " Rebuilding /usr/lib"
196 @echo "--------------------------------------------------------------"
197 cd ${.CURDIR} && ${MAKE} libraries
199 @echo "--------------------------------------------------------------"
200 @echo " Rebuilding symorder, groff and zic(8)"
201 @echo "--------------------------------------------------------------"
202 cd ${.CURDIR} && ${MAKE} build-tools
204 @echo "--------------------------------------------------------------"
205 @echo " Rebuilding dependencies"
206 @echo "--------------------------------------------------------------"
207 cd ${.CURDIR} && ${MAKE} depend
209 @echo "--------------------------------------------------------------"
210 @echo " Building everything.."
211 @echo "--------------------------------------------------------------"
212 cd ${.CURDIR} && ${MAKE} all
214 @echo "--------------------------------------------------------------"
215 @echo " Installing everything.."
216 @echo "--------------------------------------------------------------"
217 cd ${.CURDIR} && ${MAKE} install
219 @echo "--------------------------------------------------------------"
220 @echo " Rebuilding man page indexes"
221 @echo "--------------------------------------------------------------"
222 cd ${.CURDIR}/share/man && ${MAKE} makedb
223 .if target(post-world)
225 @echo "--------------------------------------------------------------"
226 @echo " Making 'post-world' target"
227 @echo "--------------------------------------------------------------"
228 cd ${.CURDIR} && ${MAKE} post-world
231 @echo "--------------------------------------------------------------"
232 @echo "make world completed on `LC_TIME=C date`"
233 @echo "--------------------------------------------------------------"
238 # If you have a build server, you can NFS mount the source and obj directories
239 # and do a 'make reinstall' on the *client* to install new binaries from the
240 # most recent server build.
243 @echo "--------------------------------------------------------------"
244 @echo " Making hierarchy"
245 @echo "--------------------------------------------------------------"
246 cd ${.CURDIR} && ${MAKE} hierarchy
248 @echo "--------------------------------------------------------------"
249 @echo " Installing everything.."
250 @echo "--------------------------------------------------------------"
251 cd ${.CURDIR} && ${MAKE} install
253 @echo "--------------------------------------------------------------"
254 @echo " Rebuilding man page indexes"
255 @echo "--------------------------------------------------------------"
256 cd ${.CURDIR}/share/man && ${MAKE} makedb
262 # Update the source tree, by running sup and/or running cvs to update to the
266 .if defined(SUP_UPDATE)
267 @echo "--------------------------------------------------------------"
269 @echo "--------------------------------------------------------------"
270 @${SUP} ${SUPFLAGS} ${SUPFILE}
271 .if defined(SUPFILE1)
272 @${SUP} ${SUPFLAGS} ${SUPFILE1}
274 .if defined(SUPFILE2)
275 @${SUP} ${SUPFLAGS} ${SUPFILE2}
278 .if defined(CVS_UPDATE)
279 @echo "--------------------------------------------------------------"
280 @echo "Updating /usr/src from cvs repository" ${CVSROOT}
281 @echo "--------------------------------------------------------------"
282 cd ${.CURDIR} && cvs -q update -P -d
289 # Build most of the user binaries on the existing system libs and includes.
292 @echo "--------------------------------------------------------------"
293 @echo " Building programs only"
294 @echo "--------------------------------------------------------------"
295 cd ${.CURDIR}/bin && ${MAKE} ${.MAKEFLAGS} all
296 cd ${.CURDIR}/sbin && ${MAKE} ${.MAKEFLAGS} all
297 cd ${.CURDIR}/libexec && ${MAKE} ${.MAKEFLAGS} all
298 cd ${.CURDIR}/usr.bin && ${MAKE} ${.MAKEFLAGS} all
299 cd ${.CURDIR}/usr.sbin && ${MAKE} ${.MAKEFLAGS} all
300 cd ${.CURDIR}/gnu/libexec && ${MAKE} ${.MAKEFLAGS} all
301 cd ${.CURDIR}/gnu/usr.bin && ${MAKE} ${.MAKEFLAGS} all
302 cd ${.CURDIR}/gnu/usr.sbin && ${MAKE} ${.MAKEFLAGS} all
303 #.if defined(MAKE_EBONES) && !defined(NOCRYPT)
304 # cd ${.CURDIR}/eBones && ${MAKE} ${.MAKEFLAGS} most
306 #.if !defined(NOSECURE) && !defined(NOCRYPT)
307 # cd ${.CURDIR}/secure && ${MAKE} ${.MAKEFLAGS} most
313 # Install the binaries built by the 'most' target. This does not include
314 # libraries or include files.
317 @echo "--------------------------------------------------------------"
318 @echo " Installing programs only"
319 @echo "--------------------------------------------------------------"
320 cd ${.CURDIR}/bin && ${MAKE} ${.MAKEFLAGS} install
321 cd ${.CURDIR}/sbin && ${MAKE} ${.MAKEFLAGS} install
322 cd ${.CURDIR}/libexec && ${MAKE} ${.MAKEFLAGS} install
323 cd ${.CURDIR}/usr.bin && ${MAKE} ${.MAKEFLAGS} install
324 cd ${.CURDIR}/usr.sbin && ${MAKE} ${.MAKEFLAGS} install
325 cd ${.CURDIR}/gnu/libexec && ${MAKE} ${.MAKEFLAGS} install
326 cd ${.CURDIR}/gnu/usr.bin && ${MAKE} ${.MAKEFLAGS} install
327 cd ${.CURDIR}/gnu/usr.sbin && ${MAKE} ${.MAKEFLAGS} install
328 #.if defined(MAKE_EBONES) && !defined(NOCRYPT)
329 # cd ${.CURDIR}/eBones && ${MAKE} ${.MAKEFLAGS} installmost
331 #.if !defined(NOSECURE) && !defined(NOCRYPT)
332 # cd ${.CURDIR}/secure && ${MAKE} ${.MAKEFLAGS} installmost
336 # ------------------------------------------------------------------------
338 # From here onwards are utility targets used by the 'make world' and
339 # related targets. If your 'world' breaks, you may like to try to fix
340 # the problem and manually run the following targets to attempt to
341 # complete the build. Beware, this is *not* guaranteed to work, you
342 # need to have a pretty good grip on the current state of the system
343 # to attempt to manually finish it. If in doubt, 'make world' again.
347 # heirarchy - ensure that all the needed directories are present
350 cd ${.CURDIR}/etc && ${MAKE} distrib-dirs
353 # bootstrap - [re]build tools needed to run the actual build, this includes
354 # tools needed by 'make depend', as some tools are needed to generate source
355 # for the dependency information to be gathered from.
358 cd ${.CURDIR}/usr.bin/make && ${MAKE} depend && \
359 ${MAKE} ${MK_FLAGS} all install ${CLEANDIR} ${OBJDIR}
360 cd ${.CURDIR}/usr.bin/xinstall && ${MAKE} depend && \
361 ${MAKE} ${MK_FLAGS} all install ${CLEANDIR} ${OBJDIR}
362 cd ${.CURDIR}/usr.bin/lex && ${MAKE} bootstrap && ${MAKE} depend && \
363 ${MAKE} ${MK_FLAGS} -DNOLIB all install ${CLEANDIR} ${OBJDIR}
366 # include-tools - generally the same as 'bootstrap', except that it's for
367 # things that are specifically needed to generate include files.
369 # XXX should be merged with bootstrap, it's not worth keeeping them seperate
372 cd ${.CURDIR}/usr.bin/rpcgen && ${MAKE} depend && \
373 ${MAKE} ${MK_FLAGS} depend all install ${CLEANDIR} ${OBJDIR}
376 # includes - possibly generate and install the include files.
380 rm -rf ${DESTDIR}/usr/include/*
381 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.include.dist \
382 -p ${DESTDIR}/usr/include
384 cd ${.CURDIR}/include && ${MAKE} all install
385 cd ${.CURDIR}/gnu/include && ${MAKE} install
386 cd ${.CURDIR}/gnu/lib/libreadline && ${MAKE} beforeinstall
387 cd ${.CURDIR}/gnu/lib/libregex && ${MAKE} beforeinstall
388 cd ${.CURDIR}/gnu/lib/libstdc++ && ${MAKE} beforeinstall
389 cd ${.CURDIR}/gnu/lib/libg++ && ${MAKE} beforeinstall
390 cd ${.CURDIR}/gnu/lib/libdialog && ${MAKE} beforeinstall
391 cd ${.CURDIR}/gnu/lib/libmp && ${MAKE} beforeinstall
392 .if exists(eBones) && !defined(NOCRYPT) && defined(MAKE_EBONES)
393 cd ${.CURDIR}/eBones/include && ${MAKE} beforeinstall
394 cd ${.CURDIR}/eBones/lib/libkrb && ${MAKE} beforeinstall
395 cd ${.CURDIR}/eBones/lib/libkadm && ${MAKE} beforeinstall
397 cd ${.CURDIR}/lib/csu/i386 && ${MAKE} beforeinstall
398 cd ${.CURDIR}/lib/libalias && ${MAKE} beforeinstall
399 cd ${.CURDIR}/lib/libc && ${MAKE} beforeinstall
400 cd ${.CURDIR}/lib/libcurses && ${MAKE} beforeinstall
401 cd ${.CURDIR}/lib/libedit && ${MAKE} beforeinstall
402 cd ${.CURDIR}/lib/libftpio && ${MAKE} beforeinstall
403 cd ${.CURDIR}/lib/libmd && ${MAKE} beforeinstall
404 cd ${.CURDIR}/lib/libmytinfo && ${MAKE} beforeinstall
405 cd ${.CURDIR}/lib/libncurses && ${MAKE} beforeinstall
406 .if !defined(WANT_CSRG_LIBM)
407 cd ${.CURDIR}/lib/msun && ${MAKE} beforeinstall
409 cd ${.CURDIR}/lib/libpcap && ${MAKE} beforeinstall
410 cd ${.CURDIR}/lib/librpcsvc && ${MAKE} beforeinstall
411 cd ${.CURDIR}/lib/libskey && ${MAKE} beforeinstall
412 cd ${.CURDIR}/lib/libtcl && ${MAKE} beforeinstall
413 cd ${.CURDIR}/lib/libtermcap && ${MAKE} beforeinstall
414 cd ${.CURDIR}/lib/libcom_err && ${MAKE} beforeinstall
415 cd ${.CURDIR}/lib/libss && ${MAKE} beforeinstall
416 cd ${.CURDIR}/lib/libscsi && ${MAKE} beforeinstall
417 cd ${.CURDIR}/lib/libutil && ${MAKE} beforeinstall
418 cd ${.CURDIR}/lib/libz && ${MAKE} beforeinstall
421 # lib-tools - build tools to compile and install the libraries.
424 cd ${.CURDIR}/usr.bin/tsort && ${MAKE} depend && \
425 ${MAKE} ${MK_FLAGS} all install ${CLEANDIR} ${OBJDIR}
426 cd ${.CURDIR}/gnu/usr.bin/ld && ${MAKE} depend && \
427 ${MAKE} ${MK_FLAGS} all install ${CLEANDIR} ${OBJDIR}
428 cd ${.CURDIR}/gnu/usr.bin/as && ${MAKE} depend && \
429 ${MAKE} ${MK_FLAGS} all install ${CLEANDIR} ${OBJDIR}
430 cd ${.CURDIR}/usr.bin/ar && ${MAKE} depend && \
431 ${MAKE} ${MK_FLAGS} all install ${CLEANDIR} ${OBJDIR}
432 cd ${.CURDIR}/usr.bin/ranlib && ${MAKE} depend && \
433 ${MAKE} ${MK_FLAGS} all install ${CLEANDIR} ${OBJDIR}
434 cd ${.CURDIR}/usr.bin/nm && ${MAKE} depend && \
435 ${MAKE} ${MK_FLAGS} all install ${CLEANDIR} ${OBJDIR}
436 cd ${.CURDIR}/usr.bin/lex/lib && ${MAKE} depend && \
437 ${MAKE} ${MK_FLAGS} all install ${CLEANDIR} ${OBJDIR}
438 cd ${.CURDIR}/usr.bin/compile_et && ${MAKE} depend && \
439 ${MAKE} ${MK_FLAGS} all install ${CLEANDIR} ${OBJDIR} && \
440 rm -f /usr/sbin/compile_et
441 cd ${.CURDIR}/usr.bin/mk_cmds && ${MAKE} depend && \
442 ${MAKE} ${MK_FLAGS} all install ${CLEANDIR} ${OBJDIR}
443 cd ${.CURDIR}/usr.bin/uudecode && ${MAKE} depend && \
444 ${MAKE} ${MK_FLAGS} all install ${CLEANDIR} ${OBJDIR}
445 cd ${.CURDIR}/gnu/usr.bin/bison && ${MAKE} depend && \
446 ${MAKE} ${MK_FLAGS} all install ${CLEANDIR} ${OBJDIR}
447 cd ${.CURDIR}/gnu/usr.bin/gperf && ${MAKE} depend && \
448 ${MAKE} ${MK_FLAGS} all install ${CLEANDIR} ${OBJDIR}
449 cd ${.CURDIR}/gnu/usr.bin/cc && ${MAKE} depend && \
450 ${MAKE} ${MK_FLAGS} all install ${CLEANDIR} ${OBJDIR}
453 # libraries - build and install the libraries
456 .if exists(lib/csu/i386)
457 cd ${.CURDIR}/lib/csu/i386 && ${MAKE} depend && \
458 ${MAKE} ${MK_FLAGS} all install ${CLEANDIR} ${OBJDIR}
460 .if exists(lib/libcompat)
461 cd ${.CURDIR}/lib/libcompat && ${MAKE} depend && \
462 ${MAKE} ${MK_FLAGS} all install ${CLEANDIR} ${OBJDIR}
464 .if exists(lib/libncurses)
465 cd ${.CURDIR}/lib/libncurses && ${MAKE} depend && \
466 ${MAKE} ${MK_FLAGS} all install ${CLEANDIR} ${OBJDIR}
468 .if exists(lib/libtermcap)
469 cd ${.CURDIR}/lib/libtermcap && ${MAKE} depend && \
470 ${MAKE} ${MK_FLAGS} all install ${CLEANDIR} ${OBJDIR}
473 cd ${.CURDIR}/gnu/lib && ${MAKE} depend && \
474 ${MAKE} ${MK_FLAGS} all install ${CLEANDIR} ${OBJDIR}
476 .if exists(secure) && !defined(NOCRYPT) && !defined(NOSECURE)
477 cd ${.CURDIR}/secure/lib && ${MAKE} depend && \
478 ${MAKE} ${MK_FLAGS} all install ${CLEANDIR} ${OBJDIR}
481 cd ${.CURDIR}/lib && ${MAKE} depend && \
482 ${MAKE} ${MK_FLAGS} all install ${CLEANDIR} ${OBJDIR}
484 .if exists(usr.bin/lex/lib)
485 cd ${.CURDIR}/usr.bin/lex/lib && ${MAKE} depend && \
486 ${MAKE} ${MK_FLAGS} all install ${CLEANDIR} ${OBJDIR}
488 .if exists(eBones) && !defined(NOCRYPT) && defined(MAKE_EBONES)
489 cd ${.CURDIR}/eBones/lib && ${MAKE} depend && \
490 ${MAKE} ${MK_FLAGS} all install ${CLEANDIR} ${OBJDIR}
492 .if exists(usr.sbin/pcvt/keycap)
493 cd ${.CURDIR}/usr.sbin/pcvt/keycap && ${MAKE} depend && \
494 ${MAKE} ${MK_FLAGS} all install ${CLEANDIR} ${OBJDIR}
498 # build-tools - build and install any other tools needed to complete the
499 # compile and install.
504 gnu/usr.bin/texinfo \
509 cd ${.CURDIR}/$d && ${MAKE} depend && \
510 ${MAKE} ${MK_FLAGS} all install ${CLEANDIR} ${OBJDIR}
513 .include <bsd.subdir.mk>