minor rearrangements
[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#
474f2102 6# @(#)Makefile 4.16 (Berkeley) %G%
a54c9390
KB
7#
8# This makefile is designed to be run in one of three ways:
4653d32f 9#
4653d32f
MK
10# make build
11# make installsrc
a54c9390
KB
12# The `make build' will compile and install the libraries and the compiler
13# twice before building the rest of the sources. The `make installsrc' will
14# then install the remaining binaries.
15#
16# make libthenall
17# make installsrc
18# The `make libthenall' will compile and install the libraries, compile
19# and install the compiler and then compile everything else. Note,
20# however, that the libraries will have been built with the old compiler.
21# The `make installsrc' will then install the remaining binaries.
22#
23# make all
4653d32f 24# make install
a54c9390
KB
25# The `make all' (the default) will compile everything, and install
26# nothing. The `make install' will then install everything.
4653d32f
MK
27#
28# C library options: passed to libc makefile.
29# See lib/libc/Makefile for explanation.
30# HOSTLOOKUP must be either named or hosttable.
31# DFLMON must be either mon.o or gmon.o.
32# DEFS may include -DLIBC_SCCS, -DSYSLIBC_SCCS, both, or neither.
33#
34HOSTLOOKUP=named
35DFLMON=mon.o
36DEFS= -DLIBC_SCCS
5ee850e3
KB
37MACHINE=tahoe
38LIBCDEFS= MACHINE=${MACHINE} HOSTLOOKUP=${HOSTLOOKUP} DFLMON=${DFLMON} DEFS="${DEFS}"
4653d32f
MK
39
40# global flags
41# SRC_MFLAGS are used on makes in command source directories,
42# but not in library or compiler directories that will be installed
43# for use in compiling everything else.
9c1744c1
KM
44#
45DESTDIR=
46CFLAGS= -O
4653d32f 47SRC_MFLAGS = -k
9c1744c1
KM
48
49# Programs that live in subdirectories, and have makefiles of their own.
50#
63d11f9b 51LIBDIR= lib usr.lib
ea9dfc18 52SRCDIR= bin usr.bin etc ucb new games local old
9c1744c1 53
a54c9390
KB
54all: ${LIBDIR} ${SRCDIR}
55
56libthenall: buildlib1 buildlib3 ${SRCDIR}
57
58build: buildlib1 buildlib2 buildlib3 ${SRCDIR}
9c1744c1 59
4653d32f
MK
60lib: FRC
61 cd lib/libc; make ${MFLAGS} ${LIBCDEFS}
62 cd lib; make ${MFLAGS} pcc cpp c2
63
64usr.lib ${SRCDIR}: FRC
65 cd $@; make ${MFLAGS} ${SRC_MFLAGS}
66
a54c9390 67buildlib1: FRC
d988052f 68 @echo installing /usr/include
4653d32f
MK
69 cd include; make ${MFLAGS} DESTDIR=${DESTDIR} install
70 @echo
71 @echo compiling libc.a
72 cd lib/libc; make ${MFLAGS} ${LIBCDEFS}
73 @echo installing /lib/libc.a
74 cd lib/libc; make ${MFLAGS} DESTDIR=${DESTDIR} install
75 @echo
76 @echo compiling C compiler
77 cd lib; make ${MFLAGS} pcc cpp c2
78 @echo installing C compiler
79 cd lib/pcc; make ${MFLAGS} DESTDIR=${DESTDIR} install
80 cd lib/cpp; make ${MFLAGS} DESTDIR=${DESTDIR} install
81 cd lib/c2; make ${MFLAGS} DESTDIR=${DESTDIR} install
4653d32f 82 @echo
a54c9390
KB
83
84buildlib2: FRC
85 cd lib; make ${MFLAGS} clean
4653d32f
MK
86 @echo re-compiling libc.a
87 cd lib/libc; make ${MFLAGS} ${LIBCDEFS}
88 @echo re-installing /lib/libc.a
89 cd lib/libc; make ${MFLAGS} DESTDIR=${DESTDIR} install
90 @echo
91 @echo re-compiling C compiler
92 cd lib; make ${MFLAGS} pcc cpp c2
93 @echo re-installing C compiler
94 cd lib/pcc; make ${MFLAGS} DESTDIR=${DESTDIR} install
95 cd lib/cpp; make ${MFLAGS} DESTDIR=${DESTDIR} install
96 cd lib/c2; make ${MFLAGS} DESTDIR=${DESTDIR} install
97 @echo
a54c9390
KB
98
99buildlib3: FRC
4653d32f
MK
100 @echo compiling usr.lib
101 cd usr.lib; make ${MFLAGS} ${SRC_MFLAGS}
d988052f 102 @echo installing /usr/lib
4653d32f 103 cd usr.lib; make ${MFLAGS} ${SRC_MFLAGS} DESTDIR=${DESTDIR} install
a54c9390 104 @echo
63d11f9b 105
b9fe0661
SL
106FRC:
107
9c1744c1 108install:
d988052f 109 -for i in ${LIBDIR} ${SRCDIR}; do \
01de33b5 110 (cd $$i; \
4653d32f
MK
111 make ${MFLAGS} ${SRC_MFLAGS} DESTDIR=${DESTDIR} install); \
112 done
9c1744c1 113
f9091df4
KM
114installsrc:
115 -for i in ${SRCDIR}; do \
4653d32f
MK
116 (cd $$i; \
117 make ${MFLAGS} ${SRC_MFLAGS} DESTDIR=${DESTDIR} install); \
118 done
f9091df4 119
74d5a2b2
SL
120tags:
121 for i in include lib usr.lib; do \
122 (cd $$i; make ${MFLAGS} TAGSFILE=../tags tags); \
123 done
124 sort -u +0 -1 -o tags tags
125
9c1744c1
KM
126clean:
127 rm -f a.out core *.s *.o
4653d32f 128 for i in ${LIBDIR} ${SRCDIR}; do (cd $$i; make -k ${MFLAGS} clean); done