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