2 # $Id: Makefile,v 1.98 1996/08/25 05:17:49 jkh Exp $
4 # Make command line options:
5 # -DCLOBBER will remove /usr/include
6 # -DMAKE_LOCAL to add ./local to the SUBDIR list
7 # -DMAKE_PORTS to add ./ports to the SUBDIR list
8 # -DMAKE_EBONES to build eBones (KerberosIV)
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
20 # The intended user-driven targets are:
21 # world - rebuild *everything*, including glue to help do upgrades.
22 # reinstall - use an existing (eg: NFS mounted) build to do an update.
23 # update - convenient way to update your source tree (eg: sup/cvs)
24 # most - build user commands, no libraries or include files
25 # installmost - install user commands, no libraries or include files
26 # all - run through SUBDIR and build everything. This is an implicit
27 # rule, not particularly useful for everybody. Use 'world'.
30 # Put initial settings here.
33 # We must do include and lib first so that the perl *.ph generation
34 # works correctly as it uses the header files installed by this.
45 .if exists(games) && !defined(NOGAMES)
51 .if exists(eBones) && !defined(NOCRYPT) && defined(MAKE_EBONES)
72 .if exists(secure) && !defined(NOCRYPT) && !defined(NOSECURE)
75 .if exists(lkm) && !defined(NOLKM)
79 # etc must be last for "distribute" to work
80 .if exists(etc) && make(distribute)
84 # These are last, since it is nice to at least get the base system
85 # rebuilt before you do them.
86 .if defined(MAKE_LOCAL) & exists(local) & exists(local/Makefile)
89 .if defined(MAKE_PORTS) & exists(ports) & exists(ports/Makefile)
93 # Handle -DNOOBJDIR, -DNOCLEAN and -DNOCLEANDIR
103 .if defined(NOCLEANDIR)
111 # While building tools for bootstrapping, we dont need to waste time on
112 # profiled libraries or man pages. This speeds things up somewhat.
114 MK_FLAGS= -DNOMAN -DNOPROFILE
119 # Attempt to rebuild and reinstall *everything*, with reasonable chance of
120 # success, regardless of how old your existing system is.
122 # >> Beware, it overwrites the local build environment! <<
125 .if target(pre-world)
126 @echo "--------------------------------------------------------------"
127 @echo " Making 'pre-world' target"
128 @echo "--------------------------------------------------------------"
129 cd ${.CURDIR} && ${MAKE} pre-world
132 @echo "--------------------------------------------------------------"
133 @echo " Making hierarchy"
134 @echo "--------------------------------------------------------------"
135 cd ${.CURDIR} && ${MAKE} hierarchy
137 @echo "--------------------------------------------------------------"
138 @echo " Rebuilding /usr/share/mk"
139 @echo "--------------------------------------------------------------"
140 cd ${.CURDIR} && ${MAKE} mk
142 @echo "--------------------------------------------------------------"
143 @echo " Cleaning up the source tree"
144 @echo "--------------------------------------------------------------"
146 @echo "Not cleaning anything! I sure hope you know what you are doing!"
148 cd ${.CURDIR} && ${MAKE} ${CLEANDIR}
151 .if !defined(NOOBJDIR)
152 @echo "--------------------------------------------------------------"
153 @echo " Rebuilding the obj tree"
154 @echo "--------------------------------------------------------------"
155 cd ${.CURDIR} && ${MAKE} obj
158 @echo "--------------------------------------------------------------"
159 @echo " Rebuilding bootstrap tools"
160 @echo "--------------------------------------------------------------"
161 cd ${.CURDIR} && ${MAKE} bootstrap
163 @echo "--------------------------------------------------------------"
164 @echo " Rebuilding tools necessary to build the include files"
165 @echo "--------------------------------------------------------------"
166 cd ${.CURDIR} && ${MAKE} include-tools
168 @echo "--------------------------------------------------------------"
169 @echo " Rebuilding /usr/include"
170 @echo "--------------------------------------------------------------"
171 cd ${.CURDIR} && ${MAKE} includes
173 @echo "--------------------------------------------------------------"
174 @echo " Rebuilding tools needed to build the libraries"
175 @echo "--------------------------------------------------------------"
176 cd ${.CURDIR} && ${MAKE} lib-tools
178 @echo "--------------------------------------------------------------"
179 @echo " Rebuilding /usr/lib"
180 @echo "--------------------------------------------------------------"
181 cd ${.CURDIR} && ${MAKE} libraries
183 @echo "--------------------------------------------------------------"
184 @echo " Rebuilding C compiler, make, symorder, sgmlfmt and zic(8)"
185 @echo "--------------------------------------------------------------"
186 cd ${.CURDIR} && ${MAKE} build-tools
188 @echo "--------------------------------------------------------------"
189 @echo " Rebuilding dependencies"
190 @echo "--------------------------------------------------------------"
191 cd ${.CURDIR} && ${MAKE} depend
193 @echo "--------------------------------------------------------------"
194 @echo " Building everything.."
195 @echo "--------------------------------------------------------------"
196 cd ${.CURDIR} && ${MAKE} all
198 @echo "--------------------------------------------------------------"
199 @echo " Installing everything.."
200 @echo "--------------------------------------------------------------"
201 cd ${.CURDIR} && ${MAKE} install
203 @echo "--------------------------------------------------------------"
204 @echo " Rebuilding man page indexes"
205 @echo "--------------------------------------------------------------"
206 cd ${.CURDIR}/share/man && ${MAKE} makedb
207 .if target(post-world)
209 @echo "--------------------------------------------------------------"
210 @echo " Making 'post-world' target"
211 @echo "--------------------------------------------------------------"
212 cd ${.CURDIR} && ${MAKE} post-world
215 @echo "--------------------------------------------------------------"
216 @echo "make world completed on `date`"
217 @echo "--------------------------------------------------------------"
222 # If you have a build server, you can NFS mount the source and obj directories
223 # and do a 'make reinstall' on the *client* to install new binaries from the
224 # most recent server build.
227 @echo "--------------------------------------------------------------"
228 @echo " Making hierarchy"
229 @echo "--------------------------------------------------------------"
230 cd ${.CURDIR} && ${MAKE} hierarchy
232 @echo "--------------------------------------------------------------"
233 @echo " Rebuilding /usr/share/mk"
234 @echo "--------------------------------------------------------------"
235 cd ${.CURDIR} && ${MAKE} mk
237 @echo "--------------------------------------------------------------"
238 @echo " Rebuilding /usr/include"
239 @echo "--------------------------------------------------------------"
240 cd ${.CURDIR} && ${MAKE} includes
242 @echo "--------------------------------------------------------------"
243 @echo " Rebuilding dependencies"
244 @echo "--------------------------------------------------------------"
245 cd ${.CURDIR} && ${MAKE} depend
247 @echo "--------------------------------------------------------------"
248 @echo " Building everything.."
249 @echo "--------------------------------------------------------------"
250 cd ${.CURDIR} && ${MAKE} all
252 @echo "--------------------------------------------------------------"
253 @echo " Installing everything.."
254 @echo "--------------------------------------------------------------"
255 cd ${.CURDIR} && ${MAKE} install
257 @echo "--------------------------------------------------------------"
258 @echo " Rebuilding man page indexes"
259 @echo "--------------------------------------------------------------"
260 cd ${.CURDIR}/share/man && ${MAKE} makedb
266 # Update the source tree, by running sup and/or running cvs to update to the
270 .if defined(SUP_UPDATE)
271 @echo "--------------------------------------------------------------"
273 @echo "--------------------------------------------------------------"
275 .if defined(SUPFILE1)
278 .if defined(SUPFILE2)
282 .if defined(CVS_UPDATE)
283 @echo "--------------------------------------------------------------"
284 @echo "Updating /usr/src from cvs repository" ${CVSROOT}
285 @echo "--------------------------------------------------------------"
286 cd ${.CURDIR} && cvs -q update -P -d
293 # Build most of the user binaries on the existing system libs and includes.
296 @echo "--------------------------------------------------------------"
297 @echo " Building programs only"
298 @echo "--------------------------------------------------------------"
299 cd ${.CURDIR}/bin && ${MAKE} ${.MAKEFLAGS} all
300 cd ${.CURDIR}/sbin && ${MAKE} ${.MAKEFLAGS} all
301 cd ${.CURDIR}/libexec && ${MAKE} ${.MAKEFLAGS} all
302 cd ${.CURDIR}/usr.bin && ${MAKE} ${.MAKEFLAGS} all
303 cd ${.CURDIR}/usr.sbin && ${MAKE} ${.MAKEFLAGS} all
304 cd ${.CURDIR}/gnu/libexec && ${MAKE} ${.MAKEFLAGS} all
305 cd ${.CURDIR}/gnu/usr.bin && ${MAKE} ${.MAKEFLAGS} all
306 cd ${.CURDIR}/gnu/usr.sbin && ${MAKE} ${.MAKEFLAGS} all
307 #.if defined(MAKE_EBONES) && !defined(NOCRYPT)
308 # cd ${.CURDIR}/eBones && ${MAKE} ${.MAKEFLAGS} most
310 #.if !defined(NOSECURE) && !defined(NOCRYPT)
311 # cd ${.CURDIR}/secure && ${MAKE} ${.MAKEFLAGS} most
317 # Install the binaries built by the 'most' target. This does not include
318 # libraries or include files.
321 @echo "--------------------------------------------------------------"
322 @echo " Installing programs only"
323 @echo "--------------------------------------------------------------"
324 cd ${.CURDIR}/bin && ${MAKE} ${.MAKEFLAGS} install
325 cd ${.CURDIR}/sbin && ${MAKE} ${.MAKEFLAGS} install
326 cd ${.CURDIR}/libexec && ${MAKE} ${.MAKEFLAGS} install
327 cd ${.CURDIR}/usr.bin && ${MAKE} ${.MAKEFLAGS} install
328 cd ${.CURDIR}/usr.sbin && ${MAKE} ${.MAKEFLAGS} install
329 cd ${.CURDIR}/gnu/libexec && ${MAKE} ${.MAKEFLAGS} install
330 cd ${.CURDIR}/gnu/usr.bin && ${MAKE} ${.MAKEFLAGS} install
331 cd ${.CURDIR}/gnu/usr.sbin && ${MAKE} ${.MAKEFLAGS} install
332 #.if defined(MAKE_EBONES) && !defined(NOCRYPT)
333 # cd ${.CURDIR}/eBones && ${MAKE} ${.MAKEFLAGS} installmost
335 #.if !defined(NOSECURE) && !defined(NOCRYPT)
336 # cd ${.CURDIR}/secure && ${MAKE} ${.MAKEFLAGS} installmost
340 # ------------------------------------------------------------------------
342 # From here onwards are utility targets used by the 'make world' and
343 # related targets. If your 'world' breaks, you may like to try to fix
344 # the problem and manually run the following targets to attempt to
345 # complete the build. Beware, this is *not* guaranteed to work, you
346 # need to have a pretty good grip on the current state of the system
347 # to attempt to manually finish it. If in doubt, 'make world' again.
351 # heirarchy - ensure that all the needed directories are present
354 cd ${.CURDIR}/etc && ${MAKE} distrib-dirs
357 # mk - update the /usr/share/mk makefiles.
360 cd ${.CURDIR}/share/mk && ${MAKE} install
363 # bootstrap - [re]build tools needed to run the actual build, this includes
364 # tools needed by 'make depend', as some tools are needed to generate source
365 # for the dependency information to be gathered from.
368 cd ${.CURDIR}/usr.bin/make && ${MAKE} depend && \
369 ${MAKE} ${MK_FLAGS} all install ${CLEANDIR} ${OBJDIR}
370 cd ${.CURDIR}/usr.bin/xinstall && ${MAKE} depend && \
371 ${MAKE} ${MK_FLAGS} all install ${CLEANDIR} ${OBJDIR}
372 cd ${.CURDIR}/usr.bin/lex && ${MAKE} bootstrap && ${MAKE} depend && \
373 ${MAKE} ${MK_FLAGS} -DNOLIB all install ${CLEANDIR} ${OBJDIR}
376 # include-tools - generally the same as 'bootstrap', except that it's for
377 # things that are specifically needed to generate include files.
379 # XXX should be merged with bootstrap, it's not worth keeeping them seperate
382 cd ${.CURDIR}/usr.bin/rpcgen && ${MAKE} depend && \
383 ${MAKE} ${MK_FLAGS} depend all install ${CLEANDIR} ${OBJDIR}
386 # includes - possibly generate and install the include files.
390 rm -rf ${DESTDIR}/usr/include/*
391 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.include.dist \
392 -p ${DESTDIR}/usr/include
394 cd ${.CURDIR}/include/rpcsvc && ${MAKE} all
395 cd ${.CURDIR}/include && ${MAKE} install
396 cd ${.CURDIR}/gnu/include && ${MAKE} install
397 cd ${.CURDIR}/gnu/lib/libreadline && ${MAKE} beforeinstall
398 cd ${.CURDIR}/gnu/lib/libregex && ${MAKE} beforeinstall
399 cd ${.CURDIR}/gnu/lib/libg++ && ${MAKE} beforeinstall
400 cd ${.CURDIR}/gnu/lib/libdialog && ${MAKE} beforeinstall
401 .if exists(eBones) && !defined(NOCRYPT) && defined(MAKE_EBONES)
402 cd ${.CURDIR}/eBones/include && ${MAKE} beforeinstall
403 cd ${.CURDIR}/eBones/lib/libkrb && ${MAKE} beforeinstall
404 cd ${.CURDIR}/eBones/lib/libkadm && ${MAKE} beforeinstall
406 cd ${.CURDIR}/lib/libc && ${MAKE} beforeinstall
407 cd ${.CURDIR}/lib/libcurses && ${MAKE} beforeinstall
408 cd ${.CURDIR}/lib/libedit && ${MAKE} beforeinstall
409 cd ${.CURDIR}/lib/libftpio && ${MAKE} beforeinstall
410 cd ${.CURDIR}/lib/libmd && ${MAKE} beforeinstall
411 cd ${.CURDIR}/lib/libmytinfo && ${MAKE} beforeinstall
412 cd ${.CURDIR}/lib/libncurses && ${MAKE} beforeinstall
413 .if !defined(WANT_CSRG_LIBM)
414 cd ${.CURDIR}/lib/msun && ${MAKE} beforeinstall
416 cd ${.CURDIR}/lib/libpcap && ${MAKE} beforeinstall
417 cd ${.CURDIR}/lib/librpcsvc && ${MAKE} beforeinstall
418 cd ${.CURDIR}/lib/libskey && ${MAKE} beforeinstall
419 cd ${.CURDIR}/lib/libtcl && ${MAKE} beforeinstall
420 cd ${.CURDIR}/lib/libtermcap && ${MAKE} beforeinstall
421 cd ${.CURDIR}/lib/libcom_err && ${MAKE} beforeinstall
422 cd ${.CURDIR}/lib/libss && ${MAKE} beforeinstall
423 cd ${.CURDIR}/lib/libscsi && ${MAKE} beforeinstall
424 cd ${.CURDIR}/lib/libutil && ${MAKE} beforeinstall
427 # lib-tools - build tools to compile and install the libraries.
430 cd ${.CURDIR}/usr.bin/tsort && ${MAKE} depend && \
431 ${MAKE} ${MK_FLAGS} all install ${CLEANDIR} ${OBJDIR}
432 cd ${.CURDIR}/gnu/usr.bin/ld && ${MAKE} depend && \
433 ${MAKE} ${MK_FLAGS} all install ${CLEANDIR} ${OBJDIR}
434 cd ${.CURDIR}/usr.bin/ar && ${MAKE} depend && \
435 ${MAKE} ${MK_FLAGS} all install ${CLEANDIR} ${OBJDIR}
436 cd ${.CURDIR}/usr.bin/ranlib && ${MAKE} depend && \
437 ${MAKE} ${MK_FLAGS} all install ${CLEANDIR} ${OBJDIR}
438 cd ${.CURDIR}/usr.bin/nm && ${MAKE} depend && \
439 ${MAKE} ${MK_FLAGS} all install ${CLEANDIR} ${OBJDIR}
440 cd ${.CURDIR}/usr.bin/lex/lib && ${MAKE} depend && \
441 ${MAKE} ${MK_FLAGS} all install ${CLEANDIR} ${OBJDIR}
442 cd ${.CURDIR}/usr.bin/compile_et && ${MAKE} depend && \
443 ${MAKE} ${MK_FLAGS} all install ${CLEANDIR} ${OBJDIR} && \
444 rm -f /usr/sbin/compile_et
445 cd ${.CURDIR}/usr.bin/mk_cmds && ${MAKE} depend && \
446 ${MAKE} ${MK_FLAGS} all install ${CLEANDIR} ${OBJDIR}
449 # libraries - build and install the libraries
452 .if exists(lib/libcompat)
453 cd ${.CURDIR}/lib/libcompat && ${MAKE} depend && \
454 ${MAKE} ${MK_FLAGS} all install ${CLEANDIR} ${OBJDIR}
456 .if exists(lib/libncurses)
457 cd ${.CURDIR}/lib/libncurses && ${MAKE} depend && \
458 ${MAKE} ${MK_FLAGS} all install ${CLEANDIR} ${OBJDIR}
460 .if exists(lib/libtermcap)
461 cd ${.CURDIR}/lib/libtermcap && ${MAKE} depend && \
462 ${MAKE} ${MK_FLAGS} all install ${CLEANDIR} ${OBJDIR}
465 cd ${.CURDIR}/lib/csu/i386 && ${MAKE} depend && \
466 ${MAKE} ${MK_FLAGS} all install ${CLEANDIR} ${OBJDIR}
469 cd ${.CURDIR}/gnu/lib && ${MAKE} depend && \
470 ${MAKE} ${MK_FLAGS} all install ${CLEANDIR} ${OBJDIR}
471 cd ${.CURDIR}/gnu/usr.bin/cc/libgcc && ${MAKE} depend && \
472 ${MAKE} ${MK_FLAGS} all install ${CLEANDIR} ${OBJDIR}
474 .if exists(secure) && !defined(NOCRYPT) && !defined(NOSECURE)
475 cd ${.CURDIR}/secure/lib && ${MAKE} depend && \
476 ${MAKE} ${MK_FLAGS} all install ${CLEANDIR} ${OBJDIR}
479 cd ${.CURDIR}/lib && ${MAKE} depend && \
480 ${MAKE} ${MK_FLAGS} all install ${CLEANDIR} ${OBJDIR}
482 .if exists(usr.bin/lex/lib)
483 cd ${.CURDIR}/usr.bin/lex/lib && ${MAKE} depend && \
484 ${MAKE} ${MK_FLAGS} all install ${CLEANDIR} ${OBJDIR}
486 .if exists(eBones) && !defined(NOCRYPT) && defined(MAKE_EBONES)
487 cd ${.CURDIR}/eBones/lib && ${MAKE} depend && \
488 ${MAKE} ${MK_FLAGS} all install ${CLEANDIR} ${OBJDIR}
490 .if exists(usr.sbin/pcvt/keycap)
491 cd ${.CURDIR}/usr.sbin/pcvt/keycap && ${MAKE} depend && \
492 ${MAKE} ${MK_FLAGS} all install ${CLEANDIR} ${OBJDIR}
496 # build-tools - build and install any other tools needed to complete the
497 # compile and install.
500 cd ${.CURDIR}/gnu/usr.bin/cc && ${MAKE} depend && \
501 ${MAKE} ${MK_FLAGS} all install ${CLEANDIR} ${OBJDIR}
502 cd ${.CURDIR}/usr.bin/symorder && ${MAKE} depend && \
503 ${MAKE} ${MK_FLAGS} all install ${CLEANDIR} ${OBJDIR}
504 cd ${.CURDIR}/usr.bin/sgmlfmt && ${MAKE} depend && \
505 ${MAKE} ${MK_FLAGS} all install ${CLEANDIR} ${OBJDIR}
506 cd ${.CURDIR}/share/sgml && ${MAKE} depend && \
507 ${MAKE} ${MK_FLAGS} all install ${CLEANDIR} ${OBJDIR}
508 cd ${.CURDIR}/usr.sbin/zic && ${MAKE} depend && \
509 ${MAKE} ${MK_FLAGS} all install ${CLEANDIR} ${OBJDIR}
511 .include <bsd.subdir.mk>