Makefile revision 2468
1229675Sadrian#
2229675Sadrian#	$Id: Makefile,v 1.14 1994/08/26 20:44:12 paul Exp $
3229675Sadrian#
4229675Sadrian# Make command line options:
5229675Sadrian#	-DCLOBBER will remove /usr/include and MOST of /usr/lib 
6229675Sadrian#	-DMAKE_LOCAL to add ./local to the SUBDIR list
7229675Sadrian#	-DMAKE_PORTS to add ./ports to the SUBDIR list
8239887Sadrian#	-DNOCLEANDIR run ${MAKE} clean, instead of ${MAKE} cleandir
9289763Sbdrewery#	-DNOCRYPT will prevent building of crypt versions
10229675Sadrian# XXX2	-DNOKERBEROS do not build Kerberos
11229675Sadrian#	-DNOOBJDIR do not run ``${MAKE} obj''
12229675Sadrian#	-DNOPROFILE do not build profiled libraries
13229675Sadrian#	-DNOSECURE do not go into secure subdir
14229675Sadrian#
15239887Sadrian# XXX2	Mandatory, and Kerberos will not build sucessfully yet
16239887Sadrian
17292164Sadrian# Put initial settings here.
18229675SadrianNOKERBEROS=	yes
19239887SadrianSUBDIR=
20239887Sadrian
21229675Sadrian.if exists(bin)
22229675SadrianSUBDIR+= bin
23229675Sadrian.endif
24229675Sadrian.if exists(contrib)
25229675SadrianSUBDIR+= contrib
26229675Sadrian.endif
27229675Sadrian.if exists(etc)
28229675SadrianSUBDIR+= etc
29229675Sadrian.endif
30229675Sadrian.if exists(games)
31229675SadrianSUBDIR+= games
32229675Sadrian.endif
33229675Sadrian.if exists(gnu)
34229675SadrianSUBDIR+= gnu
35229675Sadrian.endif
36229675Sadrian.if exists(include)
37229675SadrianSUBDIR+= include
38229675Sadrian.endif
39229675Sadrian.if exists(lib)
40229675SadrianSUBDIR+= lib
41229675Sadrian.endif
42239887Sadrian.if exists(kerberosIV) && !defined(NOCRYPT) && !defined(NOKERBEROS)
43229675SadrianSUBDIR+= kerberosIV
44229675Sadrian.endif
45239887Sadrian.if exists(libexec)
46239887SadrianSUBDIR+= libexec
47229675Sadrian.endif
48229675Sadrian.if exists(sbin)
49229675SadrianSUBDIR+= sbin
50229675Sadrian.endif
51229675Sadrian.if exists(secure) && !defined(NOCRYPT) && !defined(NOSECURE)
52229675SadrianSUBDIR+= secure
53229675Sadrian.endif
54229675Sadrian.if exists(share)
55229675SadrianSUBDIR+= share
56239887Sadrian.endif
57229675Sadrian.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 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	cd ${.CURDIR}/gnu/lib && \
181		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
182	cd ${.CURDIR}/gnu/usr.bin/cc/libgcc && \
183		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
184.if exists(secure) && !defined(NOCRYPT) && !defined(NOSECURE)
185	cd ${.CURDIR}/secure/lib && \
186		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
187.endif
188.if exists(lib)
189	cd ${.CURDIR}/lib && \
190		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
191.endif
192	cd ${.CURDIR}/usr.bin/lex/lib && \
193		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
194.if !defined(NOCRYPT) && !defined(NOKERBEROS)
195	cd ${.CURDIR}/kerberosIV/acl && \
196		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
197	cd ${.CURDIR}/kerberosIV/des && \
198		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
199	cd ${.CURDIR}/kerberosIV/kdb && \
200		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
201	cd ${.CURDIR}/kerberosIV/krb && \
202		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
203.endif
204
205tools:
206	@echo "--------------------------------------------------------------"
207	@echo " Rebuilding ${DESTDIR} Compiler and Make"
208	@echo "--------------------------------------------------------------"
209	@echo
210	cd ${.CURDIR}/gnu/usr.bin/cc && \
211		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
212	cd ${.CURDIR}/usr.bin/make && \
213		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
214
215.include <bsd.subdir.mk>
216