date and time created 90/04/26 23:41:39 by mckusick
[unix-history] / usr / src / Makefile
index 6fb37f7..4d987c8 100644 (file)
@@ -1,25 +1,30 @@
 #
 #
-# Copyright (c) 1986 Regents of the University of California.
-# All rights reserved.  The Berkeley software License Agreement
-# specifies the terms and conditions for redistribution.
+# Copyright (c) 1986, 1988 Regents of the University of California.
+# All rights reserved.
 #
 #
-#      @(#)Makefile    4.16    (Berkeley)      %G%
+# Redistribution and use in source and binary forms are permitted
+# provided that the above copyright notice and this paragraph are
+# duplicated in all such forms and that any documentation,
+# advertising materials, and other materials related to such
+# distribution and use acknowledge that the software was developed
+# by the University of California, Berkeley.  The name of the
+# University may not be used to endorse or promote products derived
+# from this software without specific prior written permission.
+# THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
+# IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
+# WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
 #
 #
-# This makefile is designed to be run in one of three ways:
+#      @(#)Makefile    4.19 (Berkeley) %G%
 #
 #
-#      make build
-#      make installsrc
-# The `make build' will compile and install the libraries and the compiler
-# twice before building the rest of the sources.  The `make installsrc' will
-# then install the remaining binaries.  Only `make build' will clean out
-# the source tree as well as remake the dependencies.
+# This makefile is designed to be run in one of two ways:
 #
 #
-#      make libthenall
+#      make build
 #      make installsrc
 #      make installsrc
-# The `make libthenall' will compile and install the libraries, compile
-# and install the compiler and then compile everything else.  Note,
-# however, that the libraries will have been built with the old compiler.
-# The `make installsrc' will then install the remaining binaries.
+# This is the most rigorous way to rebuild the source tree.  `make build'
+# will clean the source tree, install the include files, remake the
+# dependencies, and then compile and install the libraries and the compiler
+# twice before building the rest of the sources.  The `make installsrc'
+# will then install the remaining binaries.
 #
 #      make all
 #      make install
 #
 #      make all
 #      make install
@@ -27,7 +32,7 @@
 # nothing.  The `make install' will then install everything.
 #
 # C library options: passed to libc makefile.
 # nothing.  The `make install' will then install everything.
 #
 # C library options: passed to libc makefile.
-# See lib/libc/Makefile for explanation.
+# See usr.lib/libc/Makefile for explanation.
 #
 # HOSTLOOKUP must be either named or hosttable.
 # DFLMON must be either mon.o or gmon.o.
 #
 # HOSTLOOKUP must be either named or hosttable.
 # DFLMON must be either mon.o or gmon.o.
@@ -35,8 +40,7 @@
 #
 DEFS=          -DLIBC_SCCS
 DFLMON=                mon.o
 #
 DEFS=          -DLIBC_SCCS
 DFLMON=                mon.o
-HOSTLOOKUP=    named
-LIBCDEFS=      HOSTLOOKUP=${HOSTLOOKUP} DFLMON=${DFLMON} DEFS="${DEFS}"
+LIBCDEFS=      DFLMON=${DFLMON} DEFS="${DEFS}"
 
 # global flags
 # SRC_MFLAGS are used on makes in command source directories,
 
 # global flags
 # SRC_MFLAGS are used on makes in command source directories,
@@ -47,88 +51,115 @@ DESTDIR=
 CFLAGS=                -O
 SRC_MFLAGS=    -k
 
 CFLAGS=                -O
 SRC_MFLAGS=    -k
 
-LIBDIR=        lib usr.lib
-# order is important, old and man must be #1 and #2
-SRCDIR=        old man bin etc games local new ucb usr.bin
-
-all: ${LIBDIR} ${SRCDIR}
+SRCLIB=        lib
+# order is important, old must be first, man must be last; contrib is
+# too big for the current file system
+# bin
+SRC=   old games libexec pgrm sbin share usr.bin usr.sbin local man
+ALL=   ${SRCLIB} ${SRC}
 
 
-libthenall: buildlib1 buildlib3 ${SRCDIR}
+all: ${ALL}
 
 
-build: clean depend buildlib1 buildlib2 buildlib3 ${SRCDIR}
+build: cleandir build1 ${SRC}
 
 
-lib: FRC
-       cd lib/libc; make ${MFLAGS} ${LIBCDEFS}
-       cd lib; make ${MFLAGS} pcc cpp c2
+${ALL}: FRC
+       @echo; echo +++ compiling $@
+       cd $@; make ${MFLAGS}
 
 
-usr.lib ${SRCDIR}: FRC
-       cd $@; make ${MFLAGS} ${SRC_MFLAGS}
-
-buildlib1: FRC
-       @echo installing /usr/include
+build1:
+       @echo +++ installing includes
        cd include; make ${MFLAGS} DESTDIR=${DESTDIR} install
        @echo
        cd include; make ${MFLAGS} DESTDIR=${DESTDIR} install
        @echo
-       @echo compiling libc.a
-       cd lib/libc; make ${MFLAGS} ${LIBCDEFS}
-       @echo installing /lib/libc.a
-       cd lib/libc; make ${MFLAGS} DESTDIR=${DESTDIR} install
+       @echo +++ building dependencies
+       @for i in ${ALL}; do \
+               echo; echo +++ dependencies for $$i; \
+               (cd $$i; make ${MFLAGS} depend); \
+       done
+       @echo +++ compiling C compiler
+       cd usr.bin/cpp; make ${MFLAGS}
+       cd usr.libexec/c2; make ${MFLAGS}
+       cd usr.libexec/pcc; make ${MFLAGS}
        @echo
        @echo
-       @echo compiling C compiler
-       cd lib; make ${MFLAGS} pcc cpp c2
-       @echo installing C compiler
-       cd lib/pcc; make ${MFLAGS} DESTDIR=${DESTDIR} install
-       cd lib/cpp; make ${MFLAGS} DESTDIR=${DESTDIR} install
-       cd lib/c2; make ${MFLAGS} DESTDIR=${DESTDIR} install
+       @echo +++ installing C compiler
+       cd usr.bin/cpp; make ${MFLAGS} install
+       cd usr.libexec/c2; make ${MFLAGS} install
+       cd usr.libexec/pcc; make ${MFLAGS} install
        @echo
        @echo
-
-buildlib2: FRC
-       cd lib; make ${MFLAGS} clean
-       @echo re-compiling libc.a
-       cd lib/libc; make ${MFLAGS} ${LIBCDEFS}
-       @echo re-installing /lib/libc.a
-       cd lib/libc; make ${MFLAGS} DESTDIR=${DESTDIR} install
+       @echo +++ compiling C library
+       cd usr.lib/libc; make ${MFLAGS} ${LIBCDEFS}
        @echo
        @echo
-       @echo re-compiling C compiler
-       cd lib; make ${MFLAGS} pcc cpp c2
-       @echo re-installing C compiler
-       cd lib/pcc; make ${MFLAGS} DESTDIR=${DESTDIR} install
-       cd lib/cpp; make ${MFLAGS} DESTDIR=${DESTDIR} install
-       cd lib/c2; make ${MFLAGS} DESTDIR=${DESTDIR} install
+       @echo +++ installing C library
+       cd usr.lib/libc; make ${MFLAGS} DESTDIR=${DESTDIR} install
        @echo
        @echo
-
-buildlib3: FRC
-       @echo compiling usr.lib
-       cd usr.lib; make ${MFLAGS} ${SRC_MFLAGS}
-       @echo installing /usr/lib
-       cd usr.lib; make ${MFLAGS} ${SRC_MFLAGS} DESTDIR=${DESTDIR} install
+       @echo +++ cleaning C compiler
+       cd usr.bin/cpp; make ${MFLAGS} clean
+       cd usr.libexec/c2; make ${MFLAGS} clean
+       cd usr.libexec/pcc; make ${MFLAGS} clean
+       @echo
+       @echo +++ re-compiling C compiler
+       cd usr.bin/cpp; make ${MFLAGS}
+       cd usr.libexec/c2; make ${MFLAGS}
+       cd usr.libexec/pcc; make ${MFLAGS}
+       @echo
+       @echo +++ re-installing C compiler
+       cd usr.bin/cpp; make ${MFLAGS} install
+       cd usr.libexec/c2; make ${MFLAGS} install
+       cd usr.libexec/pcc; make ${MFLAGS} install
+       @echo
+       @echo +++ cleaning C library
+       cd usr.lib/libc; make ${MFLAGS} clean
+       @echo
+       @echo +++ compiling all libraries
+       cd usr.lib; make ${MFLAGS} ${LIBCDEFS}
+       @echo
+       @echo +++ installing all libraries
+       cd usr.lib; make ${MFLAGS} DESTDIR=${DESTDIR} install
+       @echo
+       @echo +++ libraries done
        @echo
 
        @echo
 
-install: FRC
-       -for i in ${LIBDIR} ${SRCDIR}; do \
+installsrc: FRC
+       @for i in ${SRC}; do \
+               echo; \
+               echo +++ installing $$i; \
                (cd $$i; \
                (cd $$i; \
-               make ${MFLAGS} ${SRC_MFLAGS} DESTDIR=${DESTDIR} install); \
+                   make ${MFLAGS} ${SRC_MFLAGS} DESTDIR=${DESTDIR} install); \
        done
 
        done
 
-installsrc: FRC
-       -for i in ${SRCDIR}; do \
-               (cd $$i; \
-               make ${MFLAGS} ${SRC_MFLAGS} DESTDIR=${DESTDIR} install); \
+clean: FRC
+       @for i in ${ALL}; do \
+               echo; \
+               echo +++ cleaning $$i; \
+               (cd $$i; make ${SRC_MFLAGS} clean); \
+       done
+
+cleandir: FRC
+       @for i in include ${ALL}; do \
+               echo; echo '+++ cleaning (cleandir)' $$i; \
+               (cd $$i; make ${SRC_MFLAGS} cleandir); \
        done
 
 depend: FRC
        done
 
 depend: FRC
-       for i in ${LIBDIR} ${SRCDIR}; do \
-               (cd $$i; make ${MFLAGS} depend); \
+       @for i in ${ALL}; do \
+               echo; \
+               echo +++ doing dependencies for $$i; \
+               (cd $$i; make ${SRC_MFLAGS} depend); \
        done
 
        done
 
-tags: FRC
-       for i in include lib usr.lib; do \
-               (cd $$i; make ${MFLAGS} TAGSFILE=../tags tags); \
+install: FRC
+       @for i in ${ALL}; do \
+               echo; \
+               echo +++ installing $$i; \
+               (cd $$i; \
+                   make ${MFLAGS} ${SRC_MFLAGS} DESTDIR=${DESTDIR} install); \
        done
        done
-       sort -u +0 -1 -o tags tags
 
 
-clean: FRC
-       for i in ${LIBDIR} ${SRCDIR}; do \
-               (cd $$i; make -k ${MFLAGS} clean); \
+tags: FRC
+       @for i in include lib usr.lib; do \
+               echo; \
+               echo +++ making tags for $$i; \
+               (cd $$i; make ${SRC_MFLAGS} TAGSFILE=../tags tags); \
        done
        done
+       sort -u +0 -1 -o tags tags
 
 FRC:
 
 FRC: