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