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