Makefile revision 2302
1#
2#	$Id: Makefile,v 1.12 1994/08/25 14:45:46 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	@echo " XXX Not yet ready in 2.0.0"
102	cd ${.CURDIR}/etc &&			${MAKE} distrib-dirs
103
104update:
105.if defined(SUP_UPDATE)
106	@echo "--------------------------------------------------------------"
107	@echo "Running sup"
108	@echo "--------------------------------------------------------------"
109	@sup -v ${SUPFILE}
110.endif
111.if defined(CVS_UPDATE)
112	@echo "--------------------------------------------------------------"
113	@echo "Updating /usr/src from cvs repository" ${CVSROOT}
114	@echo "--------------------------------------------------------------"
115	cd ${.CURDIR} &&  cvs update -P -d
116.endif
117
118cleandist:
119.if !defined(NOCLEANDIR)
120	@echo "--------------------------------------------------------------"
121	@echo " Cleaning up the source tree, and rebuilding the obj tree"
122	@echo "--------------------------------------------------------------"
123	@echo
124	here=`pwd`; dest=/usr/obj`echo $$here | sed 's,^/usr/src,,'`; \
125	if test -d /usr/obj -a ! -d $$dest; then \
126		mkdir -p $$dest; \
127	else \
128		true; \
129	fi; \
130	cd $$dest && rm -rf ${SUBDIR}
131	find . -name obj | xargs rm -rf
132.if defined(MAKE_LOCAL) & exists(local) & exists(local/Makefile)
133	# The cd is done as local may well be a symbolic link
134	-cd local && find . -name obj | xargs rm -rf
135.endif
136.if defined(MAKE_PORTS) & exists(ports) & exists(ports/Makefile)
137	# The cd is done as local may well be a symbolic link
138	-cd ports && find . -name obj | xargs rm -rf
139.endif
140	${MAKE} cleandir
141	${MAKE} obj
142.endif
143
144mk:
145	@echo "--------------------------------------------------------------"
146	@echo " Rebuilding ${DESTDIR}/usr/share/mk"
147	@echo "--------------------------------------------------------------"
148	cd ${.CURDIR}/share/mk &&		${MAKE} install
149
150includes:
151	@echo "--------------------------------------------------------------"
152	@echo " Rebuilding ${DESTDIR}/usr/include"
153	@echo "--------------------------------------------------------------"
154	@echo
155.if defined(CLOBBER)
156	rm -rf ${DESTDIR}/usr/include
157	mkdir ${DESTDIR}/usr/include
158	chown ${BINOWN}.${BINGRP} ${DESTDIR}/usr/include
159	chmod 755 ${DESTDIR}/usr/include
160.endif
161	cd ${.CURDIR}/include &&		${MAKE} install
162#XXX	cd ${.CURDIR}/gnu/lib/libg++ &&		${MAKE} beforeinstall
163#XXX	cd ${.CURDIR}/gnu/usr.bin/cc/libobjc &&	${MAKE} beforeinstall
164.if !defined(NOCRYPT) && !defined(NOKERBEROS)
165	cd ${.CURDIR}/kerberosIV/include &&	${MAKE} install
166.endif
167	cd ${.CURDIR}/lib/libc &&		${MAKE} beforeinstall
168	cd ${.CURDIR}/lib/libcurses &&		${MAKE} beforeinstall
169	cd ${.CURDIR}/lib/libedit &&		${MAKE} beforeinstall
170	cd ${.CURDIR}/lib/librpcsvc &&		${MAKE} beforeinstall
171
172libraries:
173	@echo "--------------------------------------------------------------"
174	@echo " Rebuilding ${DESTDIR}/usr/lib"
175	@echo "--------------------------------------------------------------"
176	@echo
177.if defined(CLOBBER)
178	find ${DESTDIR}/usr/lib \! -name '*.s[ao].*' -a \! -type d | \
179		xargs rm -rf
180.endif
181	# 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
182#XXX	cd ${.CURDIR}/gnu/lib/libg++ && \
183#XXX		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
184	cd ${.CURDIR}/gnu/lib/libmalloc && \
185		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
186	cd ${.CURDIR}/gnu/lib/libreadline && \
187		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
188	cd ${.CURDIR}/gnu/lib/libregex && \
189		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
190	cd ${.CURDIR}/gnu/usr.bin/cc/libgcc && \
191		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
192.if exists(secure) && !defined(NOCRYPT) && !defined(NOSECURE)
193	cd ${.CURDIR}/secure/lib && \
194		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
195.endif
196.if exists(lib)
197	cd ${.CURDIR}/lib && \
198		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
199.endif
200	# You need the lex lib before you can build kerberosIV
201#XXX	# We don't have lex in the 2.0 tree yet!
202#XXX	cd ${.CURDIR}/usr.bin/lex/lib && \
203#XXX		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
204.if !defined(NOCRYPT) && !defined(NOKERBEROS)
205	cd ${.CURDIR}/kerberosIV/acl && \
206		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
207	cd ${.CURDIR}/kerberosIV/des && \
208		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
209	cd ${.CURDIR}/kerberosIV/kdb && \
210		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
211	cd ${.CURDIR}/kerberosIV/krb && \
212		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
213.endif
214
215tools:
216	@echo "--------------------------------------------------------------"
217	@echo " Rebuilding ${DESTDIR} Compiler and Make"
218	@echo "--------------------------------------------------------------"
219	@echo
220	cd ${.CURDIR}/gnu/usr.bin/cc && \
221		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
222	cd ${.CURDIR}/usr.bin/make && \
223		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
224
225.include <bsd.subdir.mk>
226