Commit | Line | Data |
---|---|---|
4653d32f | 1 | # |
badb5799 KB |
2 | # Copyright (c) 1986, 1988 Regents of the University of California. |
3 | # All rights reserved. | |
4653d32f | 4 | # |
badb5799 KB |
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% | |
a54c9390 KB |
18 | # |
19 | # This makefile is designed to be run in one of three ways: | |
4653d32f | 20 | # |
d99a42dc MK |
21 | # make clean |
22 | # make depend | |
4653d32f MK |
23 | # make build |
24 | # make installsrc | |
d99a42dc MK |
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. | |
a54c9390 KB |
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 | |
d99a42dc | 29 | # then install the remaining binaries. |
a54c9390 KB |
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 | |
4653d32f | 39 | # make install |
a54c9390 KB |
40 | # The `make all' (the default) will compile everything, and install |
41 | # nothing. The `make install' will then install everything. | |
4653d32f MK |
42 | # |
43 | # C library options: passed to libc makefile. | |
44 | # See lib/libc/Makefile for explanation. | |
6588680f | 45 | # |
4653d32f MK |
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 | # | |
6588680f KB |
50 | DEFS= -DLIBC_SCCS |
51 | DFLMON= mon.o | |
52 | HOSTLOOKUP= named | |
53 | LIBCDEFS= HOSTLOOKUP=${HOSTLOOKUP} DFLMON=${DFLMON} DEFS="${DEFS}" | |
4653d32f MK |
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. | |
9c1744c1 KM |
59 | # |
60 | DESTDIR= | |
6588680f KB |
61 | CFLAGS= -O |
62 | SRC_MFLAGS= -k | |
9c1744c1 | 63 | |
6588680f KB |
64 | LIBDIR= lib usr.lib |
65 | # order is important, old and man must be #1 and #2 | |
d99a42dc | 66 | SRCDIR= old man bin usr.bin etc ucb new games local |
9c1744c1 | 67 | |
a54c9390 KB |
68 | all: ${LIBDIR} ${SRCDIR} |
69 | ||
d99a42dc | 70 | libthenall: buildlib1 buildlib3 src |
a54c9390 | 71 | |
d99a42dc MK |
72 | build: buildlib1 buildlib2 buildlib3 src |
73 | ||
74 | src: ${SRCDIR} | |
9c1744c1 | 75 | |
6588680f | 76 | lib: FRC |
4653d32f MK |
77 | cd lib/libc; make ${MFLAGS} ${LIBCDEFS} |
78 | cd lib; make ${MFLAGS} pcc cpp c2 | |
79 | ||
80 | usr.lib ${SRCDIR}: FRC | |
d99a42dc MK |
81 | @echo |
82 | @echo === compiling $@ | |
4653d32f MK |
83 | cd $@; make ${MFLAGS} ${SRC_MFLAGS} |
84 | ||
a54c9390 | 85 | buildlib1: FRC |
d99a42dc | 86 | @echo === installing /usr/include |
4653d32f MK |
87 | cd include; make ${MFLAGS} DESTDIR=${DESTDIR} install |
88 | @echo | |
d99a42dc | 89 | @echo === compiling libc.a |
4653d32f | 90 | cd lib/libc; make ${MFLAGS} ${LIBCDEFS} |
d99a42dc | 91 | @echo === installing /lib/libc.a |
4653d32f MK |
92 | cd lib/libc; make ${MFLAGS} DESTDIR=${DESTDIR} install |
93 | @echo | |
d99a42dc | 94 | @echo === compiling C compiler |
4653d32f | 95 | cd lib; make ${MFLAGS} pcc cpp c2 |
d99a42dc MK |
96 | @echo |
97 | @echo === installing C compiler | |
4653d32f MK |
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 | |
4653d32f | 101 | @echo |
a54c9390 KB |
102 | |
103 | buildlib2: FRC | |
d99a42dc | 104 | @echo === cleaning lib |
a54c9390 | 105 | cd lib; make ${MFLAGS} clean |
d99a42dc | 106 | @echo === re-compiling libc.a |
4653d32f | 107 | cd lib/libc; make ${MFLAGS} ${LIBCDEFS} |
d99a42dc | 108 | @echo === re-installing /lib/libc.a |
4653d32f MK |
109 | cd lib/libc; make ${MFLAGS} DESTDIR=${DESTDIR} install |
110 | @echo | |
d99a42dc | 111 | @echo === re-compiling C compiler |
4653d32f | 112 | cd lib; make ${MFLAGS} pcc cpp c2 |
d99a42dc | 113 | @echo === re-installing C compiler |
4653d32f MK |
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 | |
a54c9390 KB |
118 | |
119 | buildlib3: FRC | |
d99a42dc | 120 | @echo === compiling usr.lib |
4653d32f | 121 | cd usr.lib; make ${MFLAGS} ${SRC_MFLAGS} |
d99a42dc | 122 | @echo === installing /usr/lib |
4653d32f | 123 | cd usr.lib; make ${MFLAGS} ${SRC_MFLAGS} DESTDIR=${DESTDIR} install |
d99a42dc | 124 | @echo === done with libraries |
a54c9390 | 125 | @echo |
63d11f9b | 126 | |
6588680f | 127 | install: FRC |
d988052f | 128 | -for i in ${LIBDIR} ${SRCDIR}; do \ |
d99a42dc MK |
129 | echo; \ |
130 | echo === installing $$i; \ | |
01de33b5 | 131 | (cd $$i; \ |
4653d32f MK |
132 | make ${MFLAGS} ${SRC_MFLAGS} DESTDIR=${DESTDIR} install); \ |
133 | done | |
9c1744c1 | 134 | |
6588680f | 135 | installsrc: FRC |
f9091df4 | 136 | -for i in ${SRCDIR}; do \ |
d99a42dc MK |
137 | echo; \ |
138 | echo === installing $$i; \ | |
4653d32f MK |
139 | (cd $$i; \ |
140 | make ${MFLAGS} ${SRC_MFLAGS} DESTDIR=${DESTDIR} install); \ | |
141 | done | |
f9091df4 | 142 | |
6588680f KB |
143 | depend: FRC |
144 | for i in ${LIBDIR} ${SRCDIR}; do \ | |
d99a42dc MK |
145 | echo; \ |
146 | echo === doing dependencies for $$i; \ | |
6588680f KB |
147 | (cd $$i; make ${MFLAGS} depend); \ |
148 | done | |
149 | ||
150 | tags: FRC | |
74d5a2b2 | 151 | for i in include lib usr.lib; do \ |
d99a42dc MK |
152 | echo; \ |
153 | echo === making tags for $$i; \ | |
74d5a2b2 SL |
154 | (cd $$i; make ${MFLAGS} TAGSFILE=../tags tags); \ |
155 | done | |
156 | sort -u +0 -1 -o tags tags | |
157 | ||
6588680f KB |
158 | clean: FRC |
159 | for i in ${LIBDIR} ${SRCDIR}; do \ | |
d99a42dc MK |
160 | echo; \ |
161 | echo === cleaning $$i; \ | |
6588680f KB |
162 | (cd $$i; make -k ${MFLAGS} clean); \ |
163 | done | |
164 | ||
165 | FRC: |