| 1 | # |
| 2 | # Copyright (c) 1986 Regents of the University of California. |
| 3 | # All rights reserved. The Berkeley software License Agreement |
| 4 | # specifies the terms and conditions for redistribution. |
| 5 | # |
| 6 | # @(#)Makefile 4.13 (Berkeley) %G% |
| 7 | # |
| 8 | # This makefile is designed to be run as: |
| 9 | # make build |
| 10 | # make installsrc |
| 11 | # The `make build' will compile and install the libraries |
| 12 | # before building the rest of the sources. The `make installsrc' |
| 13 | # will then install the remaining binaries. |
| 14 | # |
| 15 | # It can also be run in the more conventional way: |
| 16 | # make |
| 17 | # make install |
| 18 | # The `make' will compile everything without installing anything. |
| 19 | # The `make install' will then install everything. Note however |
| 20 | # that all the binaries will have been loaded with the old libraries. |
| 21 | # |
| 22 | # C library options: passed to libc makefile. |
| 23 | # See lib/libc/Makefile for explanation. |
| 24 | # HOSTLOOKUP must be either named or hosttable. |
| 25 | # DFLMON must be either mon.o or gmon.o. |
| 26 | # DEFS may include -DLIBC_SCCS, -DSYSLIBC_SCCS, both, or neither. |
| 27 | # |
| 28 | HOSTLOOKUP=named |
| 29 | DFLMON=mon.o |
| 30 | DEFS= -DLIBC_SCCS |
| 31 | LIBCDEFS= HOSTLOOKUP=${HOSTLOOKUP} DFLMON=${DFLMON} DEFS="${DEFS}" |
| 32 | |
| 33 | # global flags |
| 34 | # SRC_MFLAGS are used on makes in command source directories, |
| 35 | # but not in library or compiler directories that will be installed |
| 36 | # for use in compiling everything else. |
| 37 | # |
| 38 | DESTDIR= |
| 39 | CFLAGS= -O |
| 40 | SRC_MFLAGS = -k |
| 41 | |
| 42 | # Programs that live in subdirectories, and have makefiles of their own. |
| 43 | # |
| 44 | LIBDIR= lib usr.lib |
| 45 | SRCDIR= bin usr.bin etc ucb new games local old |
| 46 | |
| 47 | all: ${LIBDIR} ${SRCDIR} |
| 48 | |
| 49 | lib: FRC |
| 50 | cd lib/libc; make ${MFLAGS} ${LIBCDEFS} |
| 51 | cd lib; make ${MFLAGS} pcc cpp c2 |
| 52 | |
| 53 | usr.lib ${SRCDIR}: FRC |
| 54 | cd $@; make ${MFLAGS} ${SRC_MFLAGS} |
| 55 | |
| 56 | build: buildlib ${SRCDIR} |
| 57 | |
| 58 | buildlib: FRC |
| 59 | @echo installing /usr/include |
| 60 | cd include; make ${MFLAGS} DESTDIR=${DESTDIR} install |
| 61 | @echo |
| 62 | @echo compiling libc.a |
| 63 | cd lib/libc; make ${MFLAGS} ${LIBCDEFS} |
| 64 | @echo installing /lib/libc.a |
| 65 | cd lib/libc; make ${MFLAGS} DESTDIR=${DESTDIR} install |
| 66 | @echo |
| 67 | @echo compiling C compiler |
| 68 | cd lib; make ${MFLAGS} pcc cpp c2 |
| 69 | @echo installing C compiler |
| 70 | cd lib/pcc; make ${MFLAGS} DESTDIR=${DESTDIR} install |
| 71 | cd lib/cpp; make ${MFLAGS} DESTDIR=${DESTDIR} install |
| 72 | cd lib/c2; make ${MFLAGS} DESTDIR=${DESTDIR} install |
| 73 | cd lib; make ${MFLAGS} clean |
| 74 | @echo |
| 75 | @echo re-compiling libc.a |
| 76 | cd lib/libc; make ${MFLAGS} ${LIBCDEFS} |
| 77 | @echo re-installing /lib/libc.a |
| 78 | cd lib/libc; make ${MFLAGS} DESTDIR=${DESTDIR} install |
| 79 | @echo |
| 80 | @echo re-compiling C compiler |
| 81 | cd lib; make ${MFLAGS} pcc cpp c2 |
| 82 | @echo re-installing C compiler |
| 83 | cd lib/pcc; make ${MFLAGS} DESTDIR=${DESTDIR} install |
| 84 | cd lib/cpp; make ${MFLAGS} DESTDIR=${DESTDIR} install |
| 85 | cd lib/c2; make ${MFLAGS} DESTDIR=${DESTDIR} install |
| 86 | @echo |
| 87 | @echo compiling usr.lib |
| 88 | cd usr.lib; make ${MFLAGS} ${SRC_MFLAGS} |
| 89 | @echo installing /usr/lib |
| 90 | cd usr.lib; make ${MFLAGS} ${SRC_MFLAGS} DESTDIR=${DESTDIR} install |
| 91 | |
| 92 | FRC: |
| 93 | |
| 94 | install: |
| 95 | -for i in ${LIBDIR} ${SRCDIR}; do \ |
| 96 | (cd $$i; \ |
| 97 | make ${MFLAGS} ${SRC_MFLAGS} DESTDIR=${DESTDIR} install); \ |
| 98 | done |
| 99 | |
| 100 | installsrc: |
| 101 | -for i in ${SRCDIR}; do \ |
| 102 | (cd $$i; \ |
| 103 | make ${MFLAGS} ${SRC_MFLAGS} DESTDIR=${DESTDIR} install); \ |
| 104 | done |
| 105 | |
| 106 | tags: |
| 107 | for i in include lib usr.lib; do \ |
| 108 | (cd $$i; make ${MFLAGS} TAGSFILE=../tags tags); \ |
| 109 | done |
| 110 | sort -u +0 -1 -o tags tags |
| 111 | |
| 112 | clean: |
| 113 | rm -f a.out core *.s *.o |
| 114 | for i in ${LIBDIR} ${SRCDIR}; do (cd $$i; make -k ${MFLAGS} clean); done |