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