>From BETA_1_1 branch
[unix-history] / Makefile
index c7a1c02..4be883c 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -1,9 +1,59 @@
 #      @(#)Makefile    5.1.1.2 (Berkeley) 5/9/91
 #
 #      @(#)Makefile    5.1.1.2 (Berkeley) 5/9/91
 #
-#      $Id$
+#      $Id: Makefile,v 1.44 1994/03/06 08:40:31 ache Exp $
 #
 
 #
 
-SUBDIR=        bin contrib games gnu include lib libexec sbin share usr.bin usr.sbin
+SUBDIR=
+.if exists(bin)
+SUBDIR+= bin
+.endif
+.if exists(contrib)
+SUBDIR+= contrib
+.endif
+.if exists(games)
+SUBDIR+= games
+.endif
+.if exists(gnu)
+SUBDIR+= gnu
+.endif
+.if exists(include)
+SUBDIR+= include
+.endif
+.if exists(lib)
+SUBDIR+= lib
+.endif
+
+# This contains both libraries and includes, which stuff below depends
+# upon.
+.if exists(kerberosIV) && !defined(NOCRYPT)
+SUBDIR+= kerberosIV
+.endif
+
+.if exists(libexec)
+SUBDIR+= libexec
+.endif
+.if exists(sbin)
+SUBDIR+= sbin
+.endif
+.if exists(share)
+SUBDIR+= share
+.endif
+.if exists(usr.bin)
+SUBDIR+= usr.bin
+.endif
+.if exists(usr.sbin)
+SUBDIR+= usr.sbin
+.endif
+
+# This is for people who want to have src/ports, src/local built
+# automatically.  
+.if defined(MAKE_LOCAL) & exists(local) & exists(local/Makefile)
+SUBDIR+= local
+.endif
+.if defined(MAKE_PORTS) & exists(ports) & exists(ports/Makefile)
+SUBDIR+= ports
+.endif
+
 
 # Special cases: etc sys
 # Not ported: kerberosIV
 
 # Special cases: etc sys
 # Not ported: kerberosIV
@@ -17,13 +67,24 @@ CLEANDIR=
 CLEANDIR=      cleandir
 .endif
 
 CLEANDIR=      cleandir
 .endif
 
-world: cleandist mk includes libraries tools mdec
+# Where is the c-compier source.  Change this, and gnu/usr.bin/Makefile if you
+# want to use another cc (gcc-2.5.8 for instance)
+CCDIR=         ${.CURDIR}/gnu/usr.bin/cc
+#CCDIR=                ${.CURDIR}/gnu/usr.bin/cc25
+
+world: directories cleandist mk includes libraries tools mdec
        @echo "--------------------------------------------------------------"
        @echo " Rebuilding ${DESTDIR} The whole thing"
        @echo "--------------------------------------------------------------"
        @echo
        make depend all install
        @echo "--------------------------------------------------------------"
        @echo " Rebuilding ${DESTDIR} The whole thing"
        @echo "--------------------------------------------------------------"
        @echo
        make depend all install
-       cd usr.sbin/sendmail/src;       make install
+       cd ${.CURDIR}/share/man;                make makedb
+
+directories:
+       @echo "--------------------------------------------------------------"
+       @echo " Making directories"
+       @echo "--------------------------------------------------------------"
+       cd ${.CURDIR}/etc;                      make distrib-dirs
 
 cleandist:
 .if !defined(NOCLEANDIR)
 
 cleandist:
 .if !defined(NOCLEANDIR)
@@ -31,8 +92,22 @@ cleandist:
        @echo " Cleaning up the source tree, and rebuilding the obj tree"
        @echo "--------------------------------------------------------------"
        @echo
        @echo " Cleaning up the source tree, and rebuilding the obj tree"
        @echo "--------------------------------------------------------------"
        @echo
-       cd /usr/obj; rm -rf ${SUBDIR}
+       here=`pwd`; dest=/usr/obj`echo $$here | sed 's,^/usr/src,,'`; \
+       if test -d /usr/obj -a ! -d $$dest; then \
+               mkdir -p $$dest; \
+       else \
+               true; \
+       fi; \
+       cd $$dest; rm -rf ${SUBDIR}
        find . -name obj | xargs -n30 rm -rf
        find . -name obj | xargs -n30 rm -rf
+.if defined(MAKE_LOCAL) & exists(local) & exists(local/Makefile)
+       # The cd is done as local may well be a symbolic link
+       -cd local ; find . -name obj | xargs -n30 rm -rf
+.endif
+.if defined(MAKE_PORTS) & exists(ports) & exists(ports/Makefile)
+       # The cd is done as local may well be a symbolic link
+       -cd ports ; find . -name obj | xargs -n30 rm -rf
+.endif
        make cleandir
        make obj
 .endif
        make cleandir
        make obj
 .endif
@@ -41,52 +116,101 @@ mk:
        @echo "--------------------------------------------------------------"
        @echo " Rebuilding ${DESTDIR}/usr/share/mk"
        @echo "--------------------------------------------------------------"
        @echo "--------------------------------------------------------------"
        @echo " Rebuilding ${DESTDIR}/usr/share/mk"
        @echo "--------------------------------------------------------------"
+.if defined(CLOBBER)
        # DONT DO THIS!! rm -rf ${DESTDIR}/usr/share/mk
        # DONT DO THIS!! mkdir ${DESTDIR}/usr/share/mk
        # DONT DO THIS!! rm -rf ${DESTDIR}/usr/share/mk
        # DONT DO THIS!! mkdir ${DESTDIR}/usr/share/mk
-       chown ${BINOWN}.${BINGRP} ${DESTDIR}/usr/share/mk
-       chmod 755 ${DESTDIR}/usr/share/mk
-       cd share/mk;                    make install;
+       # DONT DO THIS!! chown ${BINOWN}.${BINGRP} ${DESTDIR}/usr/share/mk
+       # DONT DO THIS!! chmod 755 ${DESTDIR}/usr/share/mk
+.endif
+       cd ${.CURDIR}/share/mk;                 make install;
 
 includes:
 
 includes:
-       #
-       # setenv SHARED=copies if you wish the include files to be copies
-       #
        @echo "--------------------------------------------------------------"
        @echo " Rebuilding ${DESTDIR}/usr/include"
        @echo "--------------------------------------------------------------"
        @echo
        @echo "--------------------------------------------------------------"
        @echo " Rebuilding ${DESTDIR}/usr/include"
        @echo "--------------------------------------------------------------"
        @echo
+.if defined(CLOBBER)
        rm -rf ${DESTDIR}/usr/include
        mkdir ${DESTDIR}/usr/include
        chown ${BINOWN}.${BINGRP} ${DESTDIR}/usr/include
        chmod 755 ${DESTDIR}/usr/include
        rm -rf ${DESTDIR}/usr/include
        mkdir ${DESTDIR}/usr/include
        chown ${BINOWN}.${BINGRP} ${DESTDIR}/usr/include
        chmod 755 ${DESTDIR}/usr/include
-       cd include;                     make install
-       cd gnu/libg++;                  make beforeinstall
-       cd gnu/libregex;                make beforeinstall
-       cd lib/libcurses;               make beforeinstall
-       cd lib/librpc/rpc;              make beforeinstall
+.endif
+       cd ${.CURDIR}/include;                  make install
+       cd ${CCDIR}/libobjc;                    make beforeinstall
+       cd ${.CURDIR}/gnu/lib/libg++;           make beforeinstall
+       cd ${.CURDIR}/lib/libcurses;            make beforeinstall
+       cd ${.CURDIR}/lib/libc;                 make beforeinstall
+.if !defined(NOCRYPT) && exists(${.CURDIR}/kerberosIV)
+       cd ${.CURDIR}/kerberosIV/include;       make install
+.endif
+
+# You MUST run this the first time you get the new sources to boot strap
+# the shared library tools onto you system.  This target should only
+# need to be run once on a system.
+
+bootstrapld:   directories cleandist mk includes
+       @echo "--------------------------------------------------------------"
+       @echo " Building new shlib compiler tools"
+       @echo "--------------------------------------------------------------"
+       # These tools need to be built very early due to a.out.h changes:
+       # It is possible that ar is needed
+       cd ${.CURDIR}/usr.bin/mkdep;    make -DNOPIC depend all install ${CLEANDIR} obj
+       cd ${.CURDIR}/usr.bin/nm;       make -DNOPIC depend all install ${CLEANDIR} obj
+       cd ${.CURDIR}/usr.bin/ranlib;   make -DNOPIC depend all install ${CLEANDIR} obj
+       cd ${.CURDIR}/usr.bin/strip;    make -DNOPIC depend all install ${CLEANDIR} obj
+       cd ${.CURDIR}/gnu/usr.bin/ld;   make -DNOPIC depend all install ${CLEANDIR} obj
+       cd ${.CURDIR}/gnu/usr.bin/as;   make depend all install ${CLEANDIR} obj
+       cd ${CCDIR};                    make -DNOPIC depend all install ${CLEANDIR} obj
+       cd ${CCDIR}/libgcc;             make all install ${CLEANDIR} obj
+       cd ${.CURDIR}/lib/csu.i386;     make depend all install ${CLEANDIR} obj
+       cd ${.CURDIR}/lib/libc;         make depend all install ${CLEANDIR} obj
+       cd ${.CURDIR}/gnu/usr.bin/ld/rtld;      make depend all install ${CLEANDIR} obj
+
+# You MUST run this the first time you get the new sources to boot strap
+# the *pwd.db databases onto you system.  This target should only
+# need to be run once on a system.
+
+bootstrappwd:
+       cd ${.CURDIR}/lib/libc; make all
+       cd ${.CURDIR}/usr.sbin/pwd_mkdb; make all install ${CLEANDIR}
+       cp /etc/master.passwd /etc/mp.t; pwd_mkdb /etc/mp.t
+       cp ${.CURDIR}/lib/libc/obj/libc* /usr/lib
+       cd ${.CURDIR}/lib/libc; make install ${CLEANDIR}
+       cd ${.CURDIR}/usr.bin/passwd; make all install ${CLEANDIR}
+       cd ${.CURDIR}/bin; make all install ${CLEANDIR}
+       cd ${.CURDIR}/sbin; make all install ${CLEANDIR}
+       @echo "--------------------------------------------------------------"
+       @echo " Do reboot now because all daemons needs restart"
+       @echo "--------------------------------------------------------------"
 
 libraries:
 
 libraries:
-       # setenv NOPROFILED if you do not want profiled libraries
+       # setenv NOPROFILE if you do not want profiled libraries
        @echo "--------------------------------------------------------------"
        @echo " Rebuilding ${DESTDIR}/usr/lib"
        @echo "--------------------------------------------------------------"
        @echo
        @echo "--------------------------------------------------------------"
        @echo " Rebuilding ${DESTDIR}/usr/lib"
        @echo "--------------------------------------------------------------"
        @echo
-       rm -rf ${DESTDIR}/usr/lib
-       mkdir ${DESTDIR}/usr/lib
-       chown -R bin.bin ${DESTDIR}/usr/lib
-       chmod 755 ${DESTDIR}/usr/lib
-       cd lib;                         make depend all install ${CLEANDIR} obj
-       cd gnu/gcc2/libgcc;             make depend all install ${CLEANDIR} obj
-       cd usr.bin/lex;                 make depend all install ${CLEANDIR} obj
-       cd gnu/libregex;                make depend all install ${CLEANDIR} obj
+.if defined(CLOBBER)
+       find ${DESTDIR}/usr/lib \! -name '*.s[ao].*' -a \! -type d | xargs -n30 rm -rf
+.endif
+       cd ${.CURDIR}/lib;                      make depend all install ${CLEANDIR} obj
+       cd ${CCDIR}/libgcc;                     make depend all install ${CLEANDIR} obj
+       cd ${.CURDIR}/gnu/lib/libg++;           make depend all install ${CLEANDIR} obj
+       cd ${.CURDIR}/gnu/lib/libregex;         make depend all install ${CLEANDIR} obj
+       cd ${.CURDIR}/gnu/lib/libmalloc;        make depend all install ${CLEANDIR} obj
+       cd ${.CURDIR}/usr.bin/lex;      make depend all install ${CLEANDIR} obj
+.if exists(${.CURDIR}/kerberosIV) && !defined(NOCRYPT)
+       cd ${.CURDIR}/kerberosIV/des;   make depend all install ${CLEANDIR} obj
+       cd ${.CURDIR}/kerberosIV/krb;   make depend all install ${CLEANDIR} obj
+       cd ${.CURDIR}/kerberosIV/kdb;   make depend all install ${CLEANDIR} obj
+.endif
 
 tools:
        @echo "--------------------------------------------------------------"
        @echo " Rebuilding ${DESTDIR} Compiler and Make"
        @echo "--------------------------------------------------------------"
        @echo
 
 tools:
        @echo "--------------------------------------------------------------"
        @echo " Rebuilding ${DESTDIR} Compiler and Make"
        @echo "--------------------------------------------------------------"
        @echo
-       cd gnu/gcc2;                    make depend all install ${CLEANDIR} obj
-       cd usr.bin/make;                make depend all install ${CLEANDIR} obj
+       cd ${CCDIR};                    make depend all install ${CLEANDIR} obj
+       cd ${.CURDIR}/usr.bin/make;     make depend all install ${CLEANDIR} obj
 
 mdec:
        @echo "--------------------------------------------------------------"
 
 mdec:
        @echo "--------------------------------------------------------------"
@@ -94,7 +218,7 @@ mdec:
        @echo "--------------------------------------------------------------"
        @echo
 .if ${MACHINE} == "i386"
        @echo "--------------------------------------------------------------"
        @echo
 .if ${MACHINE} == "i386"
-       cd sys/i386/boot;       make depend all install ${CLEANDIR}
+       cd ${.CURDIR}/sys/i386/boot;    make depend all install ${CLEANDIR}
 .if defined (DESTDIR)
        cd /usr/mdec; find . | cpio -pdamuv ${DESTDIR}/usr/mdec
 .endif
 .if defined (DESTDIR)
        cd /usr/mdec; find . | cpio -pdamuv ${DESTDIR}/usr/mdec
 .endif