Makefile revision 18714
1# 2# $Id: Makefile,v 1.104 1996/10/04 08:48:27 peter Exp $ 3# 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) 9# 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 19# 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'. 28 29 30# Put initial settings here. 31SUBDIR= 32 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. 35.if exists(include) 36SUBDIR+= include 37.endif 38.if exists(lib) 39SUBDIR+= lib 40.endif 41 42.if exists(bin) 43SUBDIR+= bin 44.endif 45.if exists(games) && !defined(NOGAMES) 46SUBDIR+= games 47.endif 48.if exists(gnu) 49SUBDIR+= gnu 50.endif 51.if exists(eBones) && !defined(NOCRYPT) && defined(MAKE_EBONES) 52SUBDIR+= eBones 53.endif 54.if exists(libexec) 55SUBDIR+= libexec 56.endif 57.if exists(sbin) 58SUBDIR+= sbin 59.endif 60.if exists(share) 61SUBDIR+= share 62.endif 63.if exists(sys) 64SUBDIR+= sys 65.endif 66.if exists(usr.bin) 67SUBDIR+= usr.bin 68.endif 69.if exists(usr.sbin) 70SUBDIR+= usr.sbin 71.endif 72.if exists(secure) && !defined(NOCRYPT) && !defined(NOSECURE) 73SUBDIR+= secure 74.endif 75.if exists(lkm) && !defined(NOLKM) 76SUBDIR+= lkm 77.endif 78 79# etc must be last for "distribute" to work 80.if exists(etc) && make(distribute) 81SUBDIR+= etc 82.endif 83 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) 87SUBDIR+= local 88.endif 89.if defined(MAKE_PORTS) & exists(ports) & exists(ports/Makefile) 90SUBDIR+= ports 91.endif 92 93# Handle -DNOOBJDIR, -DNOCLEAN and -DNOCLEANDIR 94.if defined(NOOBJDIR) 95OBJDIR= 96.else 97OBJDIR= obj 98.endif 99 100.if defined(NOCLEAN) 101CLEANDIR= 102.else 103.if defined(NOCLEANDIR) 104CLEANDIR= clean 105.else 106CLEANDIR= cleandir 107.endif 108.endif 109 110SUP?= sup 111SUPFLAGS?= -v 112 113# 114# While building tools for bootstrapping, we dont need to waste time on 115# profiled libraries or man pages. This speeds things up somewhat. 116# 117MK_FLAGS= -DNOMAN -DNOPROFILE 118 119# 120# world 121# 122# Attempt to rebuild and reinstall *everything*, with reasonable chance of 123# success, regardless of how old your existing system is. 124# 125# >> Beware, it overwrites the local build environment! << 126# 127world: 128 @echo "--------------------------------------------------------------" 129 @echo "make world started on `LC_TIME= date`" 130 @echo "--------------------------------------------------------------" 131.if target(pre-world) 132 @echo "--------------------------------------------------------------" 133 @echo " Making 'pre-world' target" 134 @echo "--------------------------------------------------------------" 135 cd ${.CURDIR} && ${MAKE} pre-world 136 @echo 137.endif 138 @echo "--------------------------------------------------------------" 139 @echo " Making hierarchy" 140 @echo "--------------------------------------------------------------" 141 cd ${.CURDIR} && ${MAKE} hierarchy 142 @echo 143 @echo "--------------------------------------------------------------" 144 @echo " Rebuilding /usr/share/mk" 145 @echo "--------------------------------------------------------------" 146 cd ${.CURDIR} && ${MAKE} mk 147 @echo 148 @echo "--------------------------------------------------------------" 149 @echo " Cleaning up the source tree" 150 @echo "--------------------------------------------------------------" 151.if defined(NOCLEAN) 152 @echo "Not cleaning anything! I sure hope you know what you are doing!" 153.else 154 cd ${.CURDIR} && ${MAKE} ${CLEANDIR} 155.endif 156 @echo 157.if !defined(NOOBJDIR) 158 @echo "--------------------------------------------------------------" 159 @echo " Rebuilding the obj tree" 160 @echo "--------------------------------------------------------------" 161 cd ${.CURDIR} && ${MAKE} obj 162 @echo 163.endif 164 @echo "--------------------------------------------------------------" 165 @echo " Rebuilding bootstrap tools" 166 @echo "--------------------------------------------------------------" 167 cd ${.CURDIR} && ${MAKE} bootstrap 168 @echo 169 @echo "--------------------------------------------------------------" 170 @echo " Rebuilding tools necessary to build the include files" 171 @echo "--------------------------------------------------------------" 172 cd ${.CURDIR} && ${MAKE} include-tools 173 @echo 174 @echo "--------------------------------------------------------------" 175 @echo " Rebuilding /usr/include" 176 @echo "--------------------------------------------------------------" 177 cd ${.CURDIR} && ${MAKE} includes 178 @echo 179 @echo "--------------------------------------------------------------" 180 @echo " Rebuilding tools needed to build the libraries" 181 @echo "--------------------------------------------------------------" 182 cd ${.CURDIR} && ${MAKE} lib-tools 183 @echo 184 @echo "--------------------------------------------------------------" 185 @echo " Rebuilding /usr/lib" 186 @echo "--------------------------------------------------------------" 187 cd ${.CURDIR} && ${MAKE} libraries 188 @echo 189 @echo "--------------------------------------------------------------" 190 @echo " Rebuilding sgml tools, symorder, groff and zic(8)" 191 @echo "--------------------------------------------------------------" 192 cd ${.CURDIR} && ${MAKE} build-tools 193 @echo 194 @echo "--------------------------------------------------------------" 195 @echo " Rebuilding dependencies" 196 @echo "--------------------------------------------------------------" 197 cd ${.CURDIR} && ${MAKE} depend 198 @echo 199 @echo "--------------------------------------------------------------" 200 @echo " Building everything.." 201 @echo "--------------------------------------------------------------" 202 cd ${.CURDIR} && ${MAKE} all 203 @echo 204 @echo "--------------------------------------------------------------" 205 @echo " Installing everything.." 206 @echo "--------------------------------------------------------------" 207 cd ${.CURDIR} && ${MAKE} install 208 @echo 209 @echo "--------------------------------------------------------------" 210 @echo " Rebuilding man page indexes" 211 @echo "--------------------------------------------------------------" 212 cd ${.CURDIR}/share/man && ${MAKE} makedb 213.if target(post-world) 214 @echo 215 @echo "--------------------------------------------------------------" 216 @echo " Making 'post-world' target" 217 @echo "--------------------------------------------------------------" 218 cd ${.CURDIR} && ${MAKE} post-world 219.endif 220 @echo 221 @echo "--------------------------------------------------------------" 222 @echo "make world completed on `LC_TIME= date`" 223 @echo "--------------------------------------------------------------" 224 225# 226# reinstall 227# 228# If you have a build server, you can NFS mount the source and obj directories 229# and do a 'make reinstall' on the *client* to install new binaries from the 230# most recent server build. 231# 232reinstall: 233 @echo "--------------------------------------------------------------" 234 @echo " Making hierarchy" 235 @echo "--------------------------------------------------------------" 236 cd ${.CURDIR} && ${MAKE} hierarchy 237 @echo 238 @echo "--------------------------------------------------------------" 239 @echo " Rebuilding /usr/share/mk" 240 @echo "--------------------------------------------------------------" 241 cd ${.CURDIR} && ${MAKE} mk 242 @echo 243 @echo "--------------------------------------------------------------" 244 @echo " Rebuilding /usr/include" 245 @echo "--------------------------------------------------------------" 246 cd ${.CURDIR} && ${MAKE} includes 247 @echo 248 @echo "--------------------------------------------------------------" 249 @echo " Rebuilding dependencies" 250 @echo "--------------------------------------------------------------" 251 cd ${.CURDIR} && ${MAKE} depend 252 @echo 253 @echo "--------------------------------------------------------------" 254 @echo " Building everything.." 255 @echo "--------------------------------------------------------------" 256 cd ${.CURDIR} && ${MAKE} all 257 @echo 258 @echo "--------------------------------------------------------------" 259 @echo " Installing everything.." 260 @echo "--------------------------------------------------------------" 261 cd ${.CURDIR} && ${MAKE} install 262 @echo 263 @echo "--------------------------------------------------------------" 264 @echo " Rebuilding man page indexes" 265 @echo "--------------------------------------------------------------" 266 cd ${.CURDIR}/share/man && ${MAKE} makedb 267 268 269# 270# update 271# 272# Update the source tree, by running sup and/or running cvs to update to the 273# latest copy. 274# 275update: 276.if defined(SUP_UPDATE) 277 @echo "--------------------------------------------------------------" 278 @echo "Running sup" 279 @echo "--------------------------------------------------------------" 280 @${SUP} ${SUPFLAGS} ${SUPFILE} 281.if defined(SUPFILE1) 282 @${SUP} ${SUPFLAGS} ${SUPFILE1} 283.endif 284.if defined(SUPFILE2) 285 @${SUP} ${SUPFLAGS} ${SUPFILE2} 286.endif 287.endif 288.if defined(CVS_UPDATE) 289 @echo "--------------------------------------------------------------" 290 @echo "Updating /usr/src from cvs repository" ${CVSROOT} 291 @echo "--------------------------------------------------------------" 292 cd ${.CURDIR} && cvs -q update -P -d 293.endif 294 295 296# 297# most 298# 299# Build most of the user binaries on the existing system libs and includes. 300# 301most: 302 @echo "--------------------------------------------------------------" 303 @echo " Building programs only" 304 @echo "--------------------------------------------------------------" 305 cd ${.CURDIR}/bin && ${MAKE} ${.MAKEFLAGS} all 306 cd ${.CURDIR}/sbin && ${MAKE} ${.MAKEFLAGS} all 307 cd ${.CURDIR}/libexec && ${MAKE} ${.MAKEFLAGS} all 308 cd ${.CURDIR}/usr.bin && ${MAKE} ${.MAKEFLAGS} all 309 cd ${.CURDIR}/usr.sbin && ${MAKE} ${.MAKEFLAGS} all 310 cd ${.CURDIR}/gnu/libexec && ${MAKE} ${.MAKEFLAGS} all 311 cd ${.CURDIR}/gnu/usr.bin && ${MAKE} ${.MAKEFLAGS} all 312 cd ${.CURDIR}/gnu/usr.sbin && ${MAKE} ${.MAKEFLAGS} all 313#.if defined(MAKE_EBONES) && !defined(NOCRYPT) 314# cd ${.CURDIR}/eBones && ${MAKE} ${.MAKEFLAGS} most 315#.endif 316#.if !defined(NOSECURE) && !defined(NOCRYPT) 317# cd ${.CURDIR}/secure && ${MAKE} ${.MAKEFLAGS} most 318#.endif 319 320# 321# installmost 322# 323# Install the binaries built by the 'most' target. This does not include 324# libraries or include files. 325# 326installmost: 327 @echo "--------------------------------------------------------------" 328 @echo " Installing programs only" 329 @echo "--------------------------------------------------------------" 330 cd ${.CURDIR}/bin && ${MAKE} ${.MAKEFLAGS} install 331 cd ${.CURDIR}/sbin && ${MAKE} ${.MAKEFLAGS} install 332 cd ${.CURDIR}/libexec && ${MAKE} ${.MAKEFLAGS} install 333 cd ${.CURDIR}/usr.bin && ${MAKE} ${.MAKEFLAGS} install 334 cd ${.CURDIR}/usr.sbin && ${MAKE} ${.MAKEFLAGS} install 335 cd ${.CURDIR}/gnu/libexec && ${MAKE} ${.MAKEFLAGS} install 336 cd ${.CURDIR}/gnu/usr.bin && ${MAKE} ${.MAKEFLAGS} install 337 cd ${.CURDIR}/gnu/usr.sbin && ${MAKE} ${.MAKEFLAGS} install 338#.if defined(MAKE_EBONES) && !defined(NOCRYPT) 339# cd ${.CURDIR}/eBones && ${MAKE} ${.MAKEFLAGS} installmost 340#.endif 341#.if !defined(NOSECURE) && !defined(NOCRYPT) 342# cd ${.CURDIR}/secure && ${MAKE} ${.MAKEFLAGS} installmost 343#.endif 344 345# 346# ------------------------------------------------------------------------ 347# 348# From here onwards are utility targets used by the 'make world' and 349# related targets. If your 'world' breaks, you may like to try to fix 350# the problem and manually run the following targets to attempt to 351# complete the build. Beware, this is *not* guaranteed to work, you 352# need to have a pretty good grip on the current state of the system 353# to attempt to manually finish it. If in doubt, 'make world' again. 354# 355 356# 357# heirarchy - ensure that all the needed directories are present 358# 359hierarchy: 360 cd ${.CURDIR}/etc && ${MAKE} distrib-dirs 361 362# 363# mk - update the /usr/share/mk makefiles. 364# 365mk: 366 cd ${.CURDIR}/share/mk && ${MAKE} install 367 368# 369# bootstrap - [re]build tools needed to run the actual build, this includes 370# tools needed by 'make depend', as some tools are needed to generate source 371# for the dependency information to be gathered from. 372# 373bootstrap: 374 cd ${.CURDIR}/usr.bin/make && ${MAKE} depend && \ 375 ${MAKE} ${MK_FLAGS} all install ${CLEANDIR} ${OBJDIR} 376 cd ${.CURDIR}/usr.bin/xinstall && ${MAKE} depend && \ 377 ${MAKE} ${MK_FLAGS} all install ${CLEANDIR} ${OBJDIR} 378 cd ${.CURDIR}/usr.bin/lex && ${MAKE} bootstrap && ${MAKE} depend && \ 379 ${MAKE} ${MK_FLAGS} -DNOLIB all install ${CLEANDIR} ${OBJDIR} 380 381# 382# include-tools - generally the same as 'bootstrap', except that it's for 383# things that are specifically needed to generate include files. 384# 385# XXX should be merged with bootstrap, it's not worth keeeping them seperate 386# 387include-tools: 388 cd ${.CURDIR}/usr.bin/rpcgen && ${MAKE} depend && \ 389 ${MAKE} ${MK_FLAGS} depend all install ${CLEANDIR} ${OBJDIR} 390 391# 392# includes - possibly generate and install the include files. 393# 394includes: 395.if defined(CLOBBER) 396 rm -rf ${DESTDIR}/usr/include/* 397 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.include.dist \ 398 -p ${DESTDIR}/usr/include 399.endif 400 cd ${.CURDIR}/include/rpcsvc && ${MAKE} all 401 cd ${.CURDIR}/include && ${MAKE} install 402 cd ${.CURDIR}/gnu/include && ${MAKE} install 403 cd ${.CURDIR}/gnu/lib/libreadline && ${MAKE} beforeinstall 404 cd ${.CURDIR}/gnu/lib/libregex && ${MAKE} beforeinstall 405 cd ${.CURDIR}/gnu/lib/libstdc++ && ${MAKE} beforeinstall 406 cd ${.CURDIR}/gnu/lib/libg++ && ${MAKE} beforeinstall 407 cd ${.CURDIR}/gnu/lib/libdialog && ${MAKE} beforeinstall 408.if exists(eBones) && !defined(NOCRYPT) && defined(MAKE_EBONES) 409 cd ${.CURDIR}/eBones/include && ${MAKE} beforeinstall 410 cd ${.CURDIR}/eBones/lib/libkrb && ${MAKE} beforeinstall 411 cd ${.CURDIR}/eBones/lib/libkadm && ${MAKE} beforeinstall 412.endif 413 cd ${.CURDIR}/lib/libc && ${MAKE} beforeinstall 414 cd ${.CURDIR}/lib/libcurses && ${MAKE} beforeinstall 415 cd ${.CURDIR}/lib/libedit && ${MAKE} beforeinstall 416 cd ${.CURDIR}/lib/libftpio && ${MAKE} beforeinstall 417 cd ${.CURDIR}/lib/libmd && ${MAKE} beforeinstall 418 cd ${.CURDIR}/lib/libmytinfo && ${MAKE} beforeinstall 419 cd ${.CURDIR}/lib/libncurses && ${MAKE} beforeinstall 420.if !defined(WANT_CSRG_LIBM) 421 cd ${.CURDIR}/lib/msun && ${MAKE} beforeinstall 422.endif 423 cd ${.CURDIR}/lib/libpcap && ${MAKE} beforeinstall 424 cd ${.CURDIR}/lib/librpcsvc && ${MAKE} beforeinstall 425 cd ${.CURDIR}/lib/libskey && ${MAKE} beforeinstall 426 cd ${.CURDIR}/lib/libtcl && ${MAKE} beforeinstall 427 cd ${.CURDIR}/lib/libtermcap && ${MAKE} beforeinstall 428 cd ${.CURDIR}/lib/libcom_err && ${MAKE} beforeinstall 429 cd ${.CURDIR}/lib/libss && ${MAKE} beforeinstall 430 cd ${.CURDIR}/lib/libscsi && ${MAKE} beforeinstall 431 cd ${.CURDIR}/lib/libutil && ${MAKE} beforeinstall 432 433# 434# lib-tools - build tools to compile and install the libraries. 435# 436lib-tools: 437 cd ${.CURDIR}/usr.bin/tsort && ${MAKE} depend && \ 438 ${MAKE} ${MK_FLAGS} all install ${CLEANDIR} ${OBJDIR} 439 cd ${.CURDIR}/gnu/usr.bin/ld && ${MAKE} depend && \ 440 ${MAKE} ${MK_FLAGS} all install ${CLEANDIR} ${OBJDIR} 441 cd ${.CURDIR}/gnu/usr.bin/as && ${MAKE} depend && \ 442 ${MAKE} ${MK_FLAGS} all install ${CLEANDIR} ${OBJDIR} 443 cd ${.CURDIR}/usr.bin/ar && ${MAKE} depend && \ 444 ${MAKE} ${MK_FLAGS} all install ${CLEANDIR} ${OBJDIR} 445 cd ${.CURDIR}/usr.bin/ranlib && ${MAKE} depend && \ 446 ${MAKE} ${MK_FLAGS} all install ${CLEANDIR} ${OBJDIR} 447 cd ${.CURDIR}/usr.bin/nm && ${MAKE} depend && \ 448 ${MAKE} ${MK_FLAGS} all install ${CLEANDIR} ${OBJDIR} 449 cd ${.CURDIR}/usr.bin/lex/lib && ${MAKE} depend && \ 450 ${MAKE} ${MK_FLAGS} all install ${CLEANDIR} ${OBJDIR} 451 cd ${.CURDIR}/usr.bin/compile_et && ${MAKE} depend && \ 452 ${MAKE} ${MK_FLAGS} all install ${CLEANDIR} ${OBJDIR} && \ 453 rm -f /usr/sbin/compile_et 454 cd ${.CURDIR}/usr.bin/mk_cmds && ${MAKE} depend && \ 455 ${MAKE} ${MK_FLAGS} all install ${CLEANDIR} ${OBJDIR} 456 cd ${.CURDIR}/gnu/usr.bin/bison && ${MAKE} depend && \ 457 ${MAKE} ${MK_FLAGS} all install ${CLEANDIR} ${OBJDIR} 458 cd ${.CURDIR}/gnu/usr.bin/gperf && ${MAKE} depend && \ 459 ${MAKE} ${MK_FLAGS} all install ${CLEANDIR} ${OBJDIR} 460 cd ${.CURDIR}/gnu/usr.bin/cc && ${MAKE} depend && \ 461 ${MAKE} ${MK_FLAGS} all install ${CLEANDIR} ${OBJDIR} 462 463# 464# libraries - build and install the libraries 465# 466libraries: 467.if exists(lib/libcompat) 468 cd ${.CURDIR}/lib/libcompat && ${MAKE} depend && \ 469 ${MAKE} ${MK_FLAGS} all install ${CLEANDIR} ${OBJDIR} 470.endif 471.if exists(lib/libncurses) 472 cd ${.CURDIR}/lib/libncurses && ${MAKE} depend && \ 473 ${MAKE} ${MK_FLAGS} all install ${CLEANDIR} ${OBJDIR} 474.endif 475.if exists(lib/libtermcap) 476 cd ${.CURDIR}/lib/libtermcap && ${MAKE} depend && \ 477 ${MAKE} ${MK_FLAGS} all install ${CLEANDIR} ${OBJDIR} 478.endif 479.if exists(lib) 480 cd ${.CURDIR}/lib/csu/i386 && ${MAKE} depend && \ 481 ${MAKE} ${MK_FLAGS} all install ${CLEANDIR} ${OBJDIR} 482.endif 483.if exists(gnu) 484 cd ${.CURDIR}/gnu/lib && ${MAKE} depend && \ 485 ${MAKE} ${MK_FLAGS} all install ${CLEANDIR} ${OBJDIR} 486.endif 487.if exists(secure) && !defined(NOCRYPT) && !defined(NOSECURE) 488 cd ${.CURDIR}/secure/lib && ${MAKE} depend && \ 489 ${MAKE} ${MK_FLAGS} all install ${CLEANDIR} ${OBJDIR} 490.endif 491.if exists(lib) 492 cd ${.CURDIR}/lib && ${MAKE} depend && \ 493 ${MAKE} ${MK_FLAGS} all install ${CLEANDIR} ${OBJDIR} 494.endif 495.if exists(usr.bin/lex/lib) 496 cd ${.CURDIR}/usr.bin/lex/lib && ${MAKE} depend && \ 497 ${MAKE} ${MK_FLAGS} all install ${CLEANDIR} ${OBJDIR} 498.endif 499.if exists(eBones) && !defined(NOCRYPT) && defined(MAKE_EBONES) 500 cd ${.CURDIR}/eBones/lib && ${MAKE} depend && \ 501 ${MAKE} ${MK_FLAGS} all install ${CLEANDIR} ${OBJDIR} 502.endif 503.if exists(usr.sbin/pcvt/keycap) 504 cd ${.CURDIR}/usr.sbin/pcvt/keycap && ${MAKE} depend && \ 505 ${MAKE} ${MK_FLAGS} all install ${CLEANDIR} ${OBJDIR} 506.endif 507 508# 509# build-tools - build and install any other tools needed to complete the 510# compile and install. 511# 512build-tools: 513 cd ${.CURDIR}/usr.bin/symorder && ${MAKE} depend && \ 514 ${MAKE} ${MK_FLAGS} all install ${CLEANDIR} ${OBJDIR} 515 cd ${.CURDIR}/usr.bin/sgmls && ${MAKE} depend && \ 516 ${MAKE} ${MK_FLAGS} all install ${CLEANDIR} ${OBJDIR} 517 cd ${.CURDIR}/usr.bin/sgmlfmt && ${MAKE} depend && \ 518 ${MAKE} ${MK_FLAGS} all install ${CLEANDIR} ${OBJDIR} 519 cd ${.CURDIR}/share/sgml && ${MAKE} depend && \ 520 ${MAKE} ${MK_FLAGS} all install ${CLEANDIR} ${OBJDIR} 521 cd ${.CURDIR}/usr.sbin/zic && ${MAKE} depend && \ 522 ${MAKE} ${MK_FLAGS} all install ${CLEANDIR} ${OBJDIR} 523 cd ${.CURDIR}/gnu/usr.bin/groff && ${MAKE} depend && \ 524 ${MAKE} ${MK_FLAGS} all install ${CLEANDIR} ${OBJDIR} 525 526.include <bsd.subdir.mk> 527