Makefile revision 2303
1#
2#	$Id: Makefile,v 1.13 1994/08/26 20:16:58 paul Exp $
3#
4# Make command line options:
5#	-DCLOBBER will remove /usr/include and MOST of /usr/lib 
6#	-DMAKE_LOCAL to add ./local to the SUBDIR list
7#	-DMAKE_PORTS to add ./ports to the SUBDIR list
8#	-DNOCLEANDIR run ${MAKE} clean, instead of ${MAKE} cleandir
9#	-DNOCRYPT will prevent building of crypt versions
10# XXX2	-DNOKERBEROS do not build Kerberos
11#	-DNOOBJDIR do not run ``${MAKE} obj''
12#	-DNOPROFILE do not build profiled libraries
13#	-DNOSECURE do not go into secure subdir
14#
15# XXX2	Mandatory, and Kerberos will not build sucessfully yet
16
17# Put initial settings here.
18NOKERBEROS=	yes
19SUBDIR=
20
21.if exists(bin)
22SUBDIR+= bin
23.endif
24.if exists(contrib)
25SUBDIR+= contrib
26.endif
27.if exists(etc)
28SUBDIR+= etc
29.endif
30.if exists(games)
31SUBDIR+= games
32.endif
33.if exists(gnu)
34SUBDIR+= gnu
35.endif
36.if exists(include)
37SUBDIR+= include
38.endif
39.if exists(lib)
40SUBDIR+= lib
41.endif
42.if exists(kerberosIV) && !defined(NOCRYPT) && !defined(NOKERBEROS)
43SUBDIR+= kerberosIV
44.endif
45.if exists(libexec)
46SUBDIR+= libexec
47.endif
48.if exists(sbin)
49SUBDIR+= sbin
50.endif
51.if exists(secure) && !defined(NOCRYPT) && !defined(NOSECURE)
52SUBDIR+= secure
53.endif
54.if exists(share)
55SUBDIR+= share
56.endif
57.if exists(sys)
58SUBDIR+= sys
59.endif
60.if exists(usr.bin)
61SUBDIR+= usr.bin
62.endif
63.if exists(usr.sbin)
64SUBDIR+= usr.sbin
65.endif
66
67# These are last, since it is nice to at least get the base system
68# rebuilt before you do them.
69.if defined(MAKE_LOCAL) & exists(local) & exists(local/Makefile)
70SUBDIR+= local
71.endif
72.if defined(MAKE_PORTS) & exists(ports) & exists(ports/Makefile)
73SUBDIR+= ports
74.endif
75
76# Handle the -DNOOBJDIR and -DNOCLEANDIR
77.if defined(NOOBJDIR)
78OBJDIR=
79.else
80OBJDIR=		obj
81.endif
82.if defined(NOCLEANDIR)
83CLEANDIR=	clean
84.else 
85CLEANDIR=	cleandir
86.endif
87
88world:	directories update cleandist mk includes libraries tools
89	@echo "--------------------------------------------------------------"
90	@echo " Rebuilding ${DESTDIR} The whole thing"
91	@echo "--------------------------------------------------------------"
92	@echo
93	${MAKE} depend all install
94	cd ${.CURDIR}/share/man &&		${MAKE} makedb
95
96
97directories:
98	@echo "--------------------------------------------------------------"
99	@echo " Making directories"
100	@echo "--------------------------------------------------------------"
101	cd ${.CURDIR}/etc &&			${MAKE} distrib-dirs
102
103update:
104.if defined(SUP_UPDATE)
105	@echo "--------------------------------------------------------------"
106	@echo "Running sup"
107	@echo "--------------------------------------------------------------"
108	@sup -v ${SUPFILE}
109.endif
110.if defined(CVS_UPDATE)
111	@echo "--------------------------------------------------------------"
112	@echo "Updating /usr/src from cvs repository" ${CVSROOT}
113	@echo "--------------------------------------------------------------"
114	cd ${.CURDIR} &&  cvs update -P -d
115.endif
116
117cleandist:
118.if !defined(NOCLEANDIR)
119	@echo "--------------------------------------------------------------"
120	@echo " Cleaning up the source tree, and rebuilding the obj tree"
121	@echo "--------------------------------------------------------------"
122	@echo
123	here=`pwd`; dest=/usr/obj`echo $$here | sed 's,^/usr/src,,'`; \
124	if test -d /usr/obj -a ! -d $$dest; then \
125		mkdir -p $$dest; \
126	else \
127		true; \
128	fi; \
129	cd $$dest && rm -rf ${SUBDIR}
130	find . -name obj | xargs rm -rf
131.if defined(MAKE_LOCAL) & exists(local) & exists(local/Makefile)
132	# The cd is done as local may well be a symbolic link
133	-cd local && find . -name obj | xargs rm -rf
134.endif
135.if defined(MAKE_PORTS) & exists(ports) & exists(ports/Makefile)
136	# The cd is done as local may well be a symbolic link
137	-cd ports && find . -name obj | xargs rm -rf
138.endif
139	${MAKE} cleandir
140	${MAKE} obj
141.endif
142
143mk:
144	@echo "--------------------------------------------------------------"
145	@echo " Rebuilding ${DESTDIR}/usr/share/mk"
146	@echo "--------------------------------------------------------------"
147	cd ${.CURDIR}/share/mk &&		${MAKE} install
148
149includes:
150	@echo "--------------------------------------------------------------"
151	@echo " Rebuilding ${DESTDIR}/usr/include"
152	@echo "--------------------------------------------------------------"
153	@echo
154.if defined(CLOBBER)
155	rm -rf ${DESTDIR}/usr/include
156	mkdir ${DESTDIR}/usr/include
157	chown ${BINOWN}.${BINGRP} ${DESTDIR}/usr/include
158	chmod 755 ${DESTDIR}/usr/include
159.endif
160	cd ${.CURDIR}/include &&		${MAKE} install
161#XXX	cd ${.CURDIR}/gnu/lib/libg++ &&		${MAKE} beforeinstall
162#XXX	cd ${.CURDIR}/gnu/usr.bin/cc/libobjc &&	${MAKE} beforeinstall
163.if !defined(NOCRYPT) && !defined(NOKERBEROS)
164	cd ${.CURDIR}/kerberosIV/include &&	${MAKE} install
165.endif
166	cd ${.CURDIR}/lib/libc &&		${MAKE} beforeinstall
167	cd ${.CURDIR}/lib/libcurses &&		${MAKE} beforeinstall
168	cd ${.CURDIR}/lib/libedit &&		${MAKE} beforeinstall
169	cd ${.CURDIR}/lib/librpcsvc &&		${MAKE} beforeinstall
170
171libraries:
172	@echo "--------------------------------------------------------------"
173	@echo " Rebuilding ${DESTDIR}/usr/lib"
174	@echo "--------------------------------------------------------------"
175	@echo
176.if defined(CLOBBER)
177	find ${DESTDIR}/usr/lib \! -name '*.s[ao].*' -a \! -type d | \
178		xargs rm -rf
179.endif
180	# XXX The whole GNU block should be doable in one command, as soon		# as libg++ works on FreeBSD 2.0 I will try that out
181#XXX	cd ${.CURDIR}/gnu/lib/libg++ && \
182#XXX		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
183	cd ${.CURDIR}/gnu/lib/libmalloc && \
184		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
185	cd ${.CURDIR}/gnu/lib/libreadline && \
186		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
187	cd ${.CURDIR}/gnu/lib/libregex && \
188		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
189	cd ${.CURDIR}/gnu/usr.bin/cc/libgcc && \
190		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
191.if exists(secure) && !defined(NOCRYPT) && !defined(NOSECURE)
192	cd ${.CURDIR}/secure/lib && \
193		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
194.endif
195.if exists(lib)
196	cd ${.CURDIR}/lib && \
197		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
198.endif
199	# You need the lex lib before you can build kerberosIV
200#XXX	# We don't have lex in the 2.0 tree yet!
201#XXX	cd ${.CURDIR}/usr.bin/lex/lib && \
202#XXX		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
203.if !defined(NOCRYPT) && !defined(NOKERBEROS)
204	cd ${.CURDIR}/kerberosIV/acl && \
205		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
206	cd ${.CURDIR}/kerberosIV/des && \
207		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
208	cd ${.CURDIR}/kerberosIV/kdb && \
209		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
210	cd ${.CURDIR}/kerberosIV/krb && \
211		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
212.endif
213
214tools:
215	@echo "--------------------------------------------------------------"
216	@echo " Rebuilding ${DESTDIR} Compiler and Make"
217	@echo "--------------------------------------------------------------"
218	@echo
219	cd ${.CURDIR}/gnu/usr.bin/cc && \
220		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
221	cd ${.CURDIR}/usr.bin/make && \
222		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
223
224.include <bsd.subdir.mk>
225