Makefile revision 3197
148112Sn_hibma#
248112Sn_hibma#	$Id: Makefile,v 1.21 1994/09/23 09:00:35 rgrimes Exp $
348112Sn_hibma#
448112Sn_hibma# Make command line options:
548112Sn_hibma#	-DCLOBBER will remove /usr/include and MOST of /usr/lib 
648112Sn_hibma#	-DMAKE_LOCAL to add ./local to the SUBDIR list
748112Sn_hibma#	-DMAKE_PORTS to add ./ports to the SUBDIR list
848112Sn_hibma# XXX1	-DMAKE_KERBEROS to build KerberosIV
948112Sn_hibma#	-DMAKE_EBONES to build eBones (KerberosIV)
1048112Sn_hibma#
1148112Sn_hibma#	-DNOCLEANDIR run ${MAKE} clean, instead of ${MAKE} cleandir
1248112Sn_hibma#	-DNOCRYPT will prevent building of crypt versions
1348112Sn_hibma#	-DNOLKM do not build loadable kernel modules
1448112Sn_hibma#	-DNOOBJDIR do not run ``${MAKE} obj''
1548112Sn_hibma#	-DNOPROFILE do not build profiled libraries
1648112Sn_hibma#	-DNOSECURE do not go into secure subdir
1748112Sn_hibma#
1848112Sn_hibma#
1948112Sn_hibma# XXX1	The kerberos IV off the 4.4-Lite tape (src/kerberosIV)
2048112Sn_hibma#	will not build successfully yet.  MAKE_KERBEROS should not be
2148112Sn_hibma#	defined.
2248112Sn_hibma
2348112Sn_hibma# Put initial settings here.
2448112Sn_hibmaSUBDIR=
2548112Sn_hibma
2648112Sn_hibma.if exists(bin)
2748112Sn_hibmaSUBDIR+= bin
2848112Sn_hibma.endif
2950476Speter.if exists(contrib)
3048112Sn_hibmaSUBDIR+= contrib
31306535Sjhb.endif
3249831Smpp.if exists(etc)
3379538Sru# XXX until etc vs release conversion is done
3448112Sn_hibma# SUBDIR+= etc
3548112Sn_hibma.endif
3648112Sn_hibma.if exists(games)
3748112Sn_hibmaSUBDIR+= games
3848112Sn_hibma.endif
3948112Sn_hibma.if exists(gnu)
4084306SruSUBDIR+= gnu
4184306Sru.endif
4248112Sn_hibma.if exists(include)
4348112Sn_hibmaSUBDIR+= include
4448112Sn_hibma.endif
4548112Sn_hibma.if exists(lib)
4648112Sn_hibmaSUBDIR+= lib
4748112Sn_hibma.endif
4848112Sn_hibma.if exists(kerberosIV) && !defined(NOCRYPT) && defined(MAKE_KERBEROS)
49121380ShmpSUBDIR+= kerberosIV
50121380Shmp.endif
5148112Sn_hibma.if exists(eBones) && !defined(NOCRYPT) && defined(MAKE_EBONES)
52306535SjhbSUBDIR+= eBones
53306535Sjhb.endif
5448112Sn_hibma.if exists(libexec)
55306535SjhbSUBDIR+= libexec
56306535Sjhb.endif
57306535Sjhb.if exists(sbin)
5870466SruSUBDIR+= sbin
59108257Sru.endif
6070466Sru.if exists(share)
61108257SruSUBDIR+= share
62306535Sjhb.endif
63306535Sjhb.if exists(sys)
6448112Sn_hibmaSUBDIR+= sys
6548112Sn_hibma.endif
6648112Sn_hibma.if exists(usr.bin)
67121414ShmpSUBDIR+= usr.bin
6848112Sn_hibma.endif
69.if exists(usr.sbin)
70SUBDIR+= usr.sbin
71.endif
72.if exists(secure) && !defined(NOCRYPT) && !defined(NOSECURE)
73SUBDIR+= secure
74.endif
75.if exists(lkm) && !defined(NOLKM)
76SUBDIR+= lkm
77.endif
78
79# These are last, since it is nice to at least get the base system
80# rebuilt before you do them.
81.if defined(MAKE_LOCAL) & exists(local) & exists(local/Makefile)
82SUBDIR+= local
83.endif
84.if defined(MAKE_PORTS) & exists(ports) & exists(ports/Makefile)
85SUBDIR+= ports
86.endif
87
88# Handle the -DNOOBJDIR and -DNOCLEANDIR
89.if defined(NOOBJDIR)
90OBJDIR=
91.else
92OBJDIR=		obj
93.endif
94.if defined(NOCLEANDIR)
95CLEANDIR=	clean
96.else 
97CLEANDIR=	cleandir
98.endif
99
100world:	hierarchy cleandist mk includes libraries tools
101	@echo "--------------------------------------------------------------"
102	@echo " Rebuilding ${DESTDIR} The whole thing"
103	@echo "--------------------------------------------------------------"
104	@echo
105	${MAKE} depend all install
106	cd ${.CURDIR}/share/man &&		${MAKE} makedb
107
108
109hierarchy:
110	@echo "--------------------------------------------------------------"
111	@echo " Making hierarchy"
112	@echo "--------------------------------------------------------------"
113	cd ${.CURDIR}/release &&		${MAKE} hierarchy
114
115update:
116.if defined(SUP_UPDATE)
117	@echo "--------------------------------------------------------------"
118	@echo "Running sup"
119	@echo "--------------------------------------------------------------"
120	@sup -v ${SUPFILE}
121.endif
122.if defined(CVS_UPDATE)
123	@echo "--------------------------------------------------------------"
124	@echo "Updating /usr/src from cvs repository" ${CVSROOT}
125	@echo "--------------------------------------------------------------"
126	cd ${.CURDIR} &&  cvs update -P -d
127.endif
128
129cleandist:
130.if !defined(NOCLEANDIR)
131	@echo "--------------------------------------------------------------"
132	@echo " Cleaning up the source tree, and rebuilding the obj tree"
133	@echo "--------------------------------------------------------------"
134	@echo
135	here=`pwd`; dest=/usr/obj`echo $$here | sed 's,^/usr/src,,'`; \
136	if test -d /usr/obj -a ! -d $$dest; then \
137		mkdir -p $$dest; \
138	else \
139		true; \
140	fi; \
141	cd $$dest && rm -rf ${SUBDIR}
142	find . -name obj | xargs rm -rf
143.if defined(MAKE_LOCAL) & exists(local) & exists(local/Makefile)
144	# The cd is done as local may well be a symbolic link
145	-cd local && find . -name obj | xargs rm -rf
146.endif
147.if defined(MAKE_PORTS) & exists(ports) & exists(ports/Makefile)
148	# The cd is done as local may well be a symbolic link
149	-cd ports && find . -name obj | xargs rm -rf
150.endif
151	${MAKE} cleandir
152	${MAKE} obj
153.endif
154
155mk:
156	@echo "--------------------------------------------------------------"
157	@echo " Rebuilding ${DESTDIR}/usr/share/mk"
158	@echo "--------------------------------------------------------------"
159	cd ${.CURDIR}/share/mk &&		${MAKE} install
160
161includes:
162	@echo "--------------------------------------------------------------"
163	@echo " Rebuilding ${DESTDIR}/usr/include"
164	@echo "--------------------------------------------------------------"
165	@echo
166.if defined(CLOBBER)
167	rm -rf ${DESTDIR}/usr/include
168	mkdir ${DESTDIR}/usr/include
169	chown ${BINOWN}.${BINGRP} ${DESTDIR}/usr/include
170	chmod 755 ${DESTDIR}/usr/include
171.endif
172	cd ${.CURDIR}/include &&		${MAKE} install
173	cd ${.CURDIR}/gnu/lib/libreadline &&	${MAKE} beforeinstall
174	cd ${.CURDIR}/gnu/lib/libg++ &&         ${MAKE} beforeinstall
175.if exists(kerberosIV) && !defined(NOCRYPT) && defined(MAKE_KERBEROS)
176	cd ${.CURDIR}/kerberosIV/include &&	${MAKE} install
177.endif
178.if exists(eBones) && !defined(NOCRYPT) && defined(MAKE_EBONES)
179	cd ${.CURDIR}/eBones/include &&		${MAKE} beforeinstall
180.endif
181	cd ${.CURDIR}/lib/libc &&		${MAKE} beforeinstall
182	cd ${.CURDIR}/lib/libcurses &&		${MAKE} beforeinstall
183	cd ${.CURDIR}/lib/libedit &&		${MAKE} beforeinstall
184	cd ${.CURDIR}/lib/libmd &&		${MAKE} beforeinstall
185	cd ${.CURDIR}/lib/librpcsvc &&		${MAKE} beforeinstall
186
187libraries:
188	@echo "--------------------------------------------------------------"
189	@echo " Rebuilding ${DESTDIR}/usr/lib"
190	@echo "--------------------------------------------------------------"
191	@echo
192.if defined(CLOBBER)
193	find ${DESTDIR}/usr/lib \! -name '*.s[ao].*' -a \! -type d | \
194		xargs rm -rf
195.endif
196	cd ${.CURDIR}/gnu/lib && \
197		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
198	cd ${.CURDIR}/gnu/usr.bin/cc/libgcc && \
199		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
200.if exists(secure) && !defined(NOCRYPT) && !defined(NOSECURE)
201	cd ${.CURDIR}/secure/lib && \
202		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
203.endif
204.if exists(lib)
205	cd ${.CURDIR}/lib && \
206		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
207.endif
208	cd ${.CURDIR}/usr.bin/lex/lib && \
209		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
210.if exists(kerberosIV) && !defined(NOCRYPT) && defined(MAKE_KERBEROS)
211	cd ${.CURDIR}/kerberosIV/acl && \
212		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
213	cd ${.CURDIR}/kerberosIV/des && \
214		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
215	cd ${.CURDIR}/kerberosIV/kdb && \
216		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
217	cd ${.CURDIR}/kerberosIV/krb && \
218		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
219.endif
220.if exists(eBones) && !defined(NOCRYPT) && defined(MAKE_EBONES)
221	cd ${.CURDIR}/eBones/des && \
222		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
223	cd ${.CURDIR}/eBones/acl && \
224		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
225	cd ${.CURDIR}/eBones/kdb && \
226		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
227	cd ${.CURDIR}/eBones/krb && \
228		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
229.endif
230
231tools:
232	@echo "--------------------------------------------------------------"
233	@echo " Rebuilding ${DESTDIR} Compiler and Make"
234	@echo "--------------------------------------------------------------"
235	@echo
236	cd ${.CURDIR}/gnu/usr.bin/cc && \
237		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
238	cd ${.CURDIR}/usr.bin/make && \
239		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
240
241.include <bsd.subdir.mk>
242