/dev/stdin has to be copied, but isn't a "-" on the command line
[unix-history] / usr / src / Makefile
... / ...
CommitLineData
1#
2# Copyright (c) 1986, 1988 Regents of the University of California.
3# All rights reserved.
4#
5# Redistribution and use in source and binary forms are permitted
6# provided that the above copyright notice and this paragraph are
7# duplicated in all such forms and that any documentation,
8# advertising materials, and other materials related to such
9# distribution and use acknowledge that the software was developed
10# by the University of California, Berkeley. The name of the
11# University may not be used to endorse or promote products derived
12# from this software without specific prior written permission.
13# THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
14# IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
15# WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
16#
17# @(#)Makefile 4.19 (Berkeley) %G%
18#
19# This makefile is designed to be run in one of two ways:
20#
21# make build
22# make installsrc
23# This is the most rigorous way to rebuild the source tree. `make build'
24# will clean the source tree, install the include files, remake the
25# dependencies, and then compile and install the libraries and the compiler
26# twice before building the rest of the sources. The `make installsrc'
27# will then install the remaining binaries.
28#
29# make all
30# make install
31# The `make all' (the default) will compile everything, and install
32# nothing. The `make install' will then install everything.
33#
34# C library options: passed to libc makefile.
35# See usr.lib/libc/Makefile for explanation.
36#
37# HOSTLOOKUP must be either named or hosttable.
38# DFLMON must be either mon.o or gmon.o.
39# DEFS may include -DLIBC_SCCS, -DSYSLIBC_SCCS, both, or neither.
40#
41DEFS= -DLIBC_SCCS
42DFLMON= mon.o
43LIBCDEFS= DFLMON=${DFLMON} DEFS="${DEFS}"
44
45# global flags
46# SRC_MFLAGS are used on makes in command source directories,
47# but not in library or compiler directories that will be installed
48# for use in compiling everything else.
49#
50DESTDIR=
51CFLAGS= -O
52SRC_MFLAGS= -k
53
54SRCLIB= lib
55# order is important, old must be first, man must be last; contrib is
56# too big for the current file system
57# bin
58SRC= old games libexec pgrm sbin share usr.bin usr.sbin local man
59ALL= ${SRCLIB} ${SRC}
60
61all: ${ALL}
62
63build: cleandir build1 ${SRC}
64
65${ALL}: FRC
66 @echo; echo +++ compiling $@
67 cd $@; make ${MFLAGS}
68
69build1:
70 @echo +++ installing includes
71 cd include; make ${MFLAGS} DESTDIR=${DESTDIR} install
72 @echo
73 @echo +++ building dependencies
74 @for i in ${ALL}; do \
75 echo; echo +++ dependencies for $$i; \
76 (cd $$i; make ${MFLAGS} depend); \
77 done
78 @echo +++ compiling C compiler
79 cd usr.bin/cpp; make ${MFLAGS}
80 cd usr.libexec/c2; make ${MFLAGS}
81 cd usr.libexec/pcc; make ${MFLAGS}
82 @echo
83 @echo +++ installing C compiler
84 cd usr.bin/cpp; make ${MFLAGS} install
85 cd usr.libexec/c2; make ${MFLAGS} install
86 cd usr.libexec/pcc; make ${MFLAGS} install
87 @echo
88 @echo +++ compiling C library
89 cd usr.lib/libc; make ${MFLAGS} ${LIBCDEFS}
90 @echo
91 @echo +++ installing C library
92 cd usr.lib/libc; make ${MFLAGS} DESTDIR=${DESTDIR} install
93 @echo
94 @echo +++ cleaning C compiler
95 cd usr.bin/cpp; make ${MFLAGS} clean
96 cd usr.libexec/c2; make ${MFLAGS} clean
97 cd usr.libexec/pcc; make ${MFLAGS} clean
98 @echo
99 @echo +++ re-compiling C compiler
100 cd usr.bin/cpp; make ${MFLAGS}
101 cd usr.libexec/c2; make ${MFLAGS}
102 cd usr.libexec/pcc; make ${MFLAGS}
103 @echo
104 @echo +++ re-installing C compiler
105 cd usr.bin/cpp; make ${MFLAGS} install
106 cd usr.libexec/c2; make ${MFLAGS} install
107 cd usr.libexec/pcc; make ${MFLAGS} install
108 @echo
109 @echo +++ cleaning C library
110 cd usr.lib/libc; make ${MFLAGS} clean
111 @echo
112 @echo +++ compiling all libraries
113 cd usr.lib; make ${MFLAGS} ${LIBCDEFS}
114 @echo
115 @echo +++ installing all libraries
116 cd usr.lib; make ${MFLAGS} DESTDIR=${DESTDIR} install
117 @echo
118 @echo +++ libraries done
119 @echo
120
121installsrc: FRC
122 @for i in ${SRC}; do \
123 echo; \
124 echo +++ installing $$i; \
125 (cd $$i; \
126 make ${MFLAGS} ${SRC_MFLAGS} DESTDIR=${DESTDIR} install); \
127 done
128
129clean: FRC
130 @for i in ${ALL}; do \
131 echo; \
132 echo +++ cleaning $$i; \
133 (cd $$i; make ${SRC_MFLAGS} clean); \
134 done
135
136cleandir: FRC
137 @for i in include ${ALL}; do \
138 echo; echo '+++ cleaning (cleandir)' $$i; \
139 (cd $$i; make ${SRC_MFLAGS} cleandir); \
140 done
141
142depend: FRC
143 @for i in ${ALL}; do \
144 echo; \
145 echo +++ doing dependencies for $$i; \
146 (cd $$i; make ${SRC_MFLAGS} depend); \
147 done
148
149install: FRC
150 @for i in ${ALL}; do \
151 echo; \
152 echo +++ installing $$i; \
153 (cd $$i; \
154 make ${MFLAGS} ${SRC_MFLAGS} DESTDIR=${DESTDIR} install); \
155 done
156
157tags: FRC
158 @for i in include lib usr.lib; do \
159 echo; \
160 echo +++ making tags for $$i; \
161 (cd $$i; make ${SRC_MFLAGS} TAGSFILE=../tags tags); \
162 done
163 sort -u +0 -1 -o tags tags
164
165FRC: