install approved copyright notice
[unix-history] / usr / src / Makefile
CommitLineData
4653d32f
MK
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#
d99a42dc 6# @(#)Makefile 4.17 (Berkeley) %G%
a54c9390
KB
7#
8# This makefile is designed to be run in one of three ways:
4653d32f 9#
d99a42dc
MK
10# make clean
11# make depend
4653d32f
MK
12# make build
13# make installsrc
d99a42dc
MK
14# This is the most rigorous way to rebuild the source tree.
15# The first two steps will clean the source tree and remake the dependencies.
a54c9390
KB
16# The `make build' will compile and install the libraries and the compiler
17# twice before building the rest of the sources. The `make installsrc' will
d99a42dc 18# then install the remaining binaries.
a54c9390
KB
19#
20# make libthenall
21# make installsrc
22# The `make libthenall' will compile and install the libraries, compile
23# and install the compiler and then compile everything else. Note,
24# however, that the libraries will have been built with the old compiler.
25# The `make installsrc' will then install the remaining binaries.
26#
27# make all
4653d32f 28# make install
a54c9390
KB
29# The `make all' (the default) will compile everything, and install
30# nothing. The `make install' will then install everything.
4653d32f
MK
31#
32# C library options: passed to libc makefile.
33# See lib/libc/Makefile for explanation.
6588680f 34#
4653d32f
MK
35# HOSTLOOKUP must be either named or hosttable.
36# DFLMON must be either mon.o or gmon.o.
37# DEFS may include -DLIBC_SCCS, -DSYSLIBC_SCCS, both, or neither.
38#
6588680f
KB
39DEFS= -DLIBC_SCCS
40DFLMON= mon.o
41HOSTLOOKUP= named
42LIBCDEFS= HOSTLOOKUP=${HOSTLOOKUP} DFLMON=${DFLMON} DEFS="${DEFS}"
4653d32f
MK
43
44# global flags
45# SRC_MFLAGS are used on makes in command source directories,
46# but not in library or compiler directories that will be installed
47# for use in compiling everything else.
9c1744c1
KM
48#
49DESTDIR=
6588680f
KB
50CFLAGS= -O
51SRC_MFLAGS= -k
9c1744c1 52
6588680f
KB
53LIBDIR= lib usr.lib
54# order is important, old and man must be #1 and #2
d99a42dc 55SRCDIR= old man bin usr.bin etc ucb new games local
9c1744c1 56
a54c9390
KB
57all: ${LIBDIR} ${SRCDIR}
58
d99a42dc 59libthenall: buildlib1 buildlib3 src
a54c9390 60
d99a42dc
MK
61build: buildlib1 buildlib2 buildlib3 src
62
63src: ${SRCDIR}
9c1744c1 64
6588680f 65lib: FRC
4653d32f
MK
66 cd lib/libc; make ${MFLAGS} ${LIBCDEFS}
67 cd lib; make ${MFLAGS} pcc cpp c2
68
69usr.lib ${SRCDIR}: FRC
d99a42dc
MK
70 @echo
71 @echo === compiling $@
4653d32f
MK
72 cd $@; make ${MFLAGS} ${SRC_MFLAGS}
73
a54c9390 74buildlib1: FRC
d99a42dc 75 @echo === installing /usr/include
4653d32f
MK
76 cd include; make ${MFLAGS} DESTDIR=${DESTDIR} install
77 @echo
d99a42dc 78 @echo === compiling libc.a
4653d32f 79 cd lib/libc; make ${MFLAGS} ${LIBCDEFS}
d99a42dc 80 @echo === installing /lib/libc.a
4653d32f
MK
81 cd lib/libc; make ${MFLAGS} DESTDIR=${DESTDIR} install
82 @echo
d99a42dc 83 @echo === compiling C compiler
4653d32f 84 cd lib; make ${MFLAGS} pcc cpp c2
d99a42dc
MK
85 @echo
86 @echo === installing C compiler
4653d32f
MK
87 cd lib/pcc; make ${MFLAGS} DESTDIR=${DESTDIR} install
88 cd lib/cpp; make ${MFLAGS} DESTDIR=${DESTDIR} install
89 cd lib/c2; make ${MFLAGS} DESTDIR=${DESTDIR} install
4653d32f 90 @echo
a54c9390
KB
91
92buildlib2: FRC
d99a42dc 93 @echo === cleaning lib
a54c9390 94 cd lib; make ${MFLAGS} clean
d99a42dc 95 @echo === re-compiling libc.a
4653d32f 96 cd lib/libc; make ${MFLAGS} ${LIBCDEFS}
d99a42dc 97 @echo === re-installing /lib/libc.a
4653d32f
MK
98 cd lib/libc; make ${MFLAGS} DESTDIR=${DESTDIR} install
99 @echo
d99a42dc 100 @echo === re-compiling C compiler
4653d32f 101 cd lib; make ${MFLAGS} pcc cpp c2
d99a42dc 102 @echo === re-installing C compiler
4653d32f
MK
103 cd lib/pcc; make ${MFLAGS} DESTDIR=${DESTDIR} install
104 cd lib/cpp; make ${MFLAGS} DESTDIR=${DESTDIR} install
105 cd lib/c2; make ${MFLAGS} DESTDIR=${DESTDIR} install
106 @echo
a54c9390
KB
107
108buildlib3: FRC
d99a42dc 109 @echo === compiling usr.lib
4653d32f 110 cd usr.lib; make ${MFLAGS} ${SRC_MFLAGS}
d99a42dc 111 @echo === installing /usr/lib
4653d32f 112 cd usr.lib; make ${MFLAGS} ${SRC_MFLAGS} DESTDIR=${DESTDIR} install
d99a42dc 113 @echo === done with libraries
a54c9390 114 @echo
63d11f9b 115
6588680f 116install: FRC
d988052f 117 -for i in ${LIBDIR} ${SRCDIR}; do \
d99a42dc
MK
118 echo; \
119 echo === installing $$i; \
01de33b5 120 (cd $$i; \
4653d32f
MK
121 make ${MFLAGS} ${SRC_MFLAGS} DESTDIR=${DESTDIR} install); \
122 done
9c1744c1 123
6588680f 124installsrc: FRC
f9091df4 125 -for i in ${SRCDIR}; do \
d99a42dc
MK
126 echo; \
127 echo === installing $$i; \
4653d32f
MK
128 (cd $$i; \
129 make ${MFLAGS} ${SRC_MFLAGS} DESTDIR=${DESTDIR} install); \
130 done
f9091df4 131
6588680f
KB
132depend: FRC
133 for i in ${LIBDIR} ${SRCDIR}; do \
d99a42dc
MK
134 echo; \
135 echo === doing dependencies for $$i; \
6588680f
KB
136 (cd $$i; make ${MFLAGS} depend); \
137 done
138
139tags: FRC
74d5a2b2 140 for i in include lib usr.lib; do \
d99a42dc
MK
141 echo; \
142 echo === making tags for $$i; \
74d5a2b2
SL
143 (cd $$i; make ${MFLAGS} TAGSFILE=../tags tags); \
144 done
145 sort -u +0 -1 -o tags tags
146
6588680f
KB
147clean: FRC
148 for i in ${LIBDIR} ${SRCDIR}; do \
d99a42dc
MK
149 echo; \
150 echo === cleaning $$i; \
6588680f
KB
151 (cd $$i; make -k ${MFLAGS} clean); \
152 done
153
154FRC: