Makefile revision 16550
142120Sdes#
2230132Suqs#	$Id: Makefile,v 1.82 1996/06/20 13:38:15 adam Exp $
342120Sdes#
442120Sdes# Make command line options:
542120Sdes#	-DCLOBBER will remove /usr/include
642120Sdes#	-DMAKE_LOCAL to add ./local to the SUBDIR list
742120Sdes#	-DMAKE_PORTS to add ./ports to the SUBDIR list
842120Sdes#	-DMAKE_EBONES to build eBones (KerberosIV)
942120Sdes#
1042120Sdes#	-DNOCLEANDIR run ${MAKE} clean, instead of ${MAKE} cleandir
1142120Sdes#	-DNOCLEAN do not clean at all
1242120Sdes#	-DNOCRYPT will prevent building of crypt versions
1342120Sdes#	-DNOLKM do not build loadable kernel modules
1442120Sdes#	-DNOOBJDIR do not run ``${MAKE} obj''
1542120Sdes#	-DNOPROFILE do not build profiled libraries
1642120Sdes#	-DNOSECURE do not go into secure subdir
1742120Sdes
1842120Sdes# Put initial settings here.
1942120SdesSUBDIR=
2042120Sdes
2142120Sdes# We must do include and lib first so that the perl *.ph generation
2242120Sdes# works correctly as it uses the header files installed by this.
2342120Sdes.if exists(include)
2442120SdesSUBDIR+= include
2542120Sdes.endif
2642120Sdes.if exists(lib)
2742120SdesSUBDIR+= lib
2850477Speter.endif
2942120Sdes
3042120Sdes.if exists(bin)
3142120SdesSUBDIR+= bin
3242120Sdes.endif
3342120Sdes.if exists(contrib)
3442120SdesSUBDIR+= contrib
3542120Sdes.endif
3648104Syokota.if exists(games)
3748104SyokotaSUBDIR+= games
3842120Sdes.endif
3948104Syokota.if exists(gnu)
4048104SyokotaSUBDIR+= gnu
4148104Syokota.endif
4242120Sdes.if exists(eBones) && !defined(NOCRYPT) && defined(MAKE_EBONES)
4386120SdesSUBDIR+= eBones
4442120Sdes.endif
45166868Sphilip.if exists(libexec)
46166868SphilipSUBDIR+= libexec
47166868Sphilip.endif
48174985Swkoszek.if exists(sbin)
49166868SphilipSUBDIR+= sbin
50166868Sphilip.endif
5186120Sdes.if exists(share)
5286120SdesSUBDIR+= share
5386120Sdes.endif
5486120Sdes.if exists(sys)
5586120SdesSUBDIR+= sys
5642120Sdes.endif
5786120Sdes.if exists(usr.bin)
5886120SdesSUBDIR+= usr.bin
5986120Sdes.endif
6086120Sdes.if exists(usr.sbin)
6142120SdesSUBDIR+= usr.sbin
6242504Syokota.endif
6342120Sdes.if exists(secure) && !defined(NOCRYPT) && !defined(NOSECURE)
6486120SdesSUBDIR+= secure
65166868Sphilip.endif
6686120Sdes.if exists(lkm) && !defined(NOLKM)
6786120SdesSUBDIR+= lkm
6886120Sdes.endif
69166868Sphilip
7086120Sdes# etc must be last for "distribute" to work
7186120Sdes.if exists(etc) && make(distribute)
7286120SdesSUBDIR+= etc
7386120Sdes.endif
7486120Sdes
7586120Sdes# These are last, since it is nice to at least get the base system
7686120Sdes# rebuilt before you do them.
7786120Sdes.if defined(MAKE_LOCAL) & exists(local) & exists(local/Makefile)
78166868SphilipSUBDIR+= local
7986120Sdes.endif
8086120Sdes.if defined(MAKE_PORTS) & exists(ports) & exists(ports/Makefile)
8186120SdesSUBDIR+= ports
8286120Sdes.endif
83166868Sphilip
8486120Sdes# Handle the -DNOOBJDIR and -DNOCLEANDIR
8586120Sdes.if defined(NOOBJDIR)
8686120SdesOBJDIR=
8742120Sdes.else
8842120SdesOBJDIR=		obj
8942120Sdes.endif
9042120Sdes
9142504Syokota.if defined(NOCLEAN)
9242120SdesCLEANDIR=
9386120SdesWORLD_CLEANDIST=obj
9486120Sdes.else
9542120SdesWORLD_CLEANDIST=cleandist
9686120Sdes.if defined(NOCLEANDIR)
9786120SdesCLEANDIR=	clean
9886120Sdes.else
9986120SdesCLEANDIR=	cleandir
10086120Sdes.endif
10186120Sdes.endif
10286120Sdes
10386120SdesMK_FLAGS=	-DNOMAN -DNOPROFILE
10486120Sdes
10586120Sdes.if !target(pre-world)
10642120Sdespre-world:
10742120Sdes	@/usr/bin/true
10842504Syokota.endif
10942504Syokota
11042120Sdesworld:	pre-world hierarchy mk $(WORLD_CLEANDIST) bootstrap include-tools includes lib-tools libraries build-tools
111117833Snyan	@echo "--------------------------------------------------------------"
11286120Sdes	@echo " Rebuilding ${DESTDIR} The whole thing"
11386120Sdes	@echo "--------------------------------------------------------------"
11486120Sdes	@echo
11586120Sdes	${MAKE} depend all install
11686120Sdes	cd ${.CURDIR}/share/man &&		${MAKE} makedb
117174985Swkoszek.if target(post-world)
118174985Swkoszek	cd ${.CURDIR} && ${MAKE} post-world
119174985Swkoszek.endif
12086120Sdes	@echo "make world completed on `date`"
12186120Sdes
12286120Sdesbootstrap:
12386120Sdes	cd ${.CURDIR}/usr.bin/xlint && ${MAKE} ${MK_FLAGS} lint1 lint2 xlint
12486120Sdes	cd ${.CURDIR}/usr.bin/xlint/lint1 && ${MAKE} ${MK_FLAGS} install
125174985Swkoszek	cd ${.CURDIR}/usr.bin/xlint/lint2 && ${MAKE} ${MK_FLAGS} install
12686120Sdes	cd ${.CURDIR}/usr.bin/xlint/xlint && ${MAKE} ${MK_FLAGS} install
12786120Sdes	cd ${.CURDIR}/usr.bin/lex && ${MAKE} ${MK_FLAGS} bootstrap && \
12886120Sdes		${MAKE} ${MK_FLAGS} all install
12986120Sdes
13042120Sdesreinstall:	hierarchy mk includes
13186120Sdes	@echo "--------------------------------------------------------------"
13242120Sdes	@echo " Reinstall ${DESTDIR} The whole thing"
13342120Sdes	@echo "--------------------------------------------------------------"
13442120Sdes	@echo
13542504Syokota	${MAKE} install
13642120Sdes	cd ${.CURDIR}/share/man &&		${MAKE} makedb
13786120Sdes
13886120Sdeshierarchy:
139174985Swkoszek	@echo "--------------------------------------------------------------"
14086120Sdes	@echo " Making hierarchy"
141174985Swkoszek	@echo "--------------------------------------------------------------"
14286120Sdes	cd ${.CURDIR}/etc &&		${MAKE} distrib-dirs
143174985Swkoszek
14493011Samoritaupdate:
145174985Swkoszek.if defined(SUP_UPDATE)
14693011Samorita	@echo "--------------------------------------------------------------"
14786120Sdes	@echo "Running sup"
14886120Sdes	@echo "--------------------------------------------------------------"
14986120Sdes	@sup -v ${SUPFILE}
15086120Sdes.if defined(SUPFILE1)
15186120Sdes	@sup -v ${SUPFILE1}
15286120Sdes.endif
15386120Sdes.if defined(SUPFILE2)
15486120Sdes	@sup -v ${SUPFILE2}
15586120Sdes.endif
15686120Sdes.endif
15786120Sdes.if defined(CVS_UPDATE)
15842120Sdes	@echo "--------------------------------------------------------------"
15942120Sdes	@echo "Updating /usr/src from cvs repository" ${CVSROOT}
16042120Sdes	@echo "--------------------------------------------------------------"
16142504Syokota	cd ${.CURDIR} &&  cvs update -P -d
16242120Sdes.endif
16386120Sdes
16442120Sdescleandist:
16542120Sdes.if !defined(NOCLEANDIR)
16642504Syokota	@echo "--------------------------------------------------------------"
16786120Sdes	@echo " Cleaning up the source tree, and rebuilding the obj tree"
16886120Sdes	@echo "--------------------------------------------------------------"
16986120Sdes	@echo
17086120Sdes	here=`pwd`; dest=/usr/obj`echo $$here | sed 's,^/usr/src,,'`; \
17186120Sdes	if test -d /usr/obj -a ! -d $$dest; then \
17242504Syokota		mkdir -p $$dest; \
17342504Syokota	else \
174206380Sjkim		true; \
175206380Sjkim	fi; \
176206380Sjkim	cd $$dest && rm -rf ${SUBDIR}
17742504Syokota	find . -name obj | xargs rm -rf
178206380Sjkim.if defined(MAKE_LOCAL) & exists(local) & exists(local/Makefile)
179	# The cd is done as local may well be a symbolic link
180	-cd local && find . -name obj | xargs rm -rf
181.endif
182.if defined(MAKE_PORTS) & exists(ports) & exists(ports/Makefile)
183	# The cd is done as local may well be a symbolic link
184	-cd ports && find . -name obj | xargs rm -rf
185.endif
186	${MAKE} cleandir
187	${MAKE} obj
188.endif
189
190installmost:
191	@echo "--------------------------------------------------------------"
192	@echo " Installing programs only"
193	@echo "--------------------------------------------------------------"
194	cd ${.CURDIR}/bin	&&	${MAKE} ${.MAKEFLAGS} install
195	cd ${.CURDIR}/sbin	&&	${MAKE} ${.MAKEFLAGS} install
196	cd ${.CURDIR}/libexec	&&	${MAKE} ${.MAKEFLAGS} install
197	cd ${.CURDIR}/usr.bin	&&	${MAKE} ${.MAKEFLAGS} install
198	cd ${.CURDIR}/usr.sbin	&&	${MAKE} ${.MAKEFLAGS} install
199	cd ${.CURDIR}/gnu/libexec &&	${MAKE} ${.MAKEFLAGS} install
200	cd ${.CURDIR}/gnu/usr.bin &&	${MAKE} ${.MAKEFLAGS} install
201	cd ${.CURDIR}/gnu/usr.sbin &&	${MAKE} ${.MAKEFLAGS} install
202#.if defined(MAKE_EBONES) && !defined(NOCRYPT)
203#	cd ${.CURDIR}/eBones	&&	${MAKE} ${.MAKEFLAGS} installmost
204#.endif
205#.if !defined(NOSECURE) && !defined(NOCRYPT)
206#	cd ${.CURDIR}/secure	&&	${MAKE} ${.MAKEFLAGS} installmost
207#.endif
208
209most:
210	@echo "--------------------------------------------------------------"
211	@echo " Building programs only"
212	@echo "--------------------------------------------------------------"
213	cd ${.CURDIR}/bin	&&	${MAKE} ${.MAKEFLAGS} all
214	cd ${.CURDIR}/sbin	&&	${MAKE} ${.MAKEFLAGS} all
215	cd ${.CURDIR}/libexec	&&	${MAKE} ${.MAKEFLAGS} all
216	cd ${.CURDIR}/usr.bin	&&	${MAKE} ${.MAKEFLAGS} all
217	cd ${.CURDIR}/usr.sbin	&&	${MAKE} ${.MAKEFLAGS} all
218	cd ${.CURDIR}/gnu/libexec &&	${MAKE} ${.MAKEFLAGS} all
219	cd ${.CURDIR}/gnu/usr.bin &&	${MAKE} ${.MAKEFLAGS} all
220	cd ${.CURDIR}/gnu/usr.sbin &&	${MAKE} ${.MAKEFLAGS} all
221#.if defined(MAKE_EBONES) && !defined(NOCRYPT)
222#	cd ${.CURDIR}/eBones	&&	${MAKE} ${.MAKEFLAGS} most
223#.endif
224#.if !defined(NOSECURE) && !defined(NOCRYPT)
225#	cd ${.CURDIR}/secure	&&	${MAKE} ${.MAKEFLAGS} most
226#.endif
227
228mk:
229	@echo "--------------------------------------------------------------"
230	@echo " Rebuilding ${DESTDIR}/usr/share/mk"
231	@echo "--------------------------------------------------------------"
232	cd ${.CURDIR}/share/mk &&		${MAKE} install
233
234includes:
235	@echo "--------------------------------------------------------------"
236	@echo " Rebuilding ${DESTDIR}/usr/include"
237	@echo "--------------------------------------------------------------"
238	@echo
239.if defined(CLOBBER)
240	rm -rf ${DESTDIR}/usr/include/*
241	mtree -deU -f ${.CURDIR}/etc/mtree/BSD.include.dist \
242		-p ${DESTDIR}/usr/include
243.endif
244	cd ${.CURDIR}/include &&		${MAKE} install
245	cd ${.CURDIR}/gnu/include &&		${MAKE}	install
246	cd ${.CURDIR}/gnu/lib/libreadline &&	${MAKE} beforeinstall
247	cd ${.CURDIR}/gnu/lib/libregex &&	${MAKE} beforeinstall
248	cd ${.CURDIR}/gnu/lib/libg++ &&         ${MAKE} beforeinstall
249	cd ${.CURDIR}/gnu/lib/libdialog &&      ${MAKE} beforeinstall
250.if exists(eBones) && !defined(NOCRYPT) && defined(MAKE_EBONES)
251	cd ${.CURDIR}/eBones/include &&		${MAKE} beforeinstall
252	cd ${.CURDIR}/eBones/lib/libkrb &&	${MAKE} beforeinstall
253	cd ${.CURDIR}/eBones/lib/libkadm &&	${MAKE} beforeinstall
254.endif
255	cd ${.CURDIR}/lib/libc &&		${MAKE} beforeinstall
256	cd ${.CURDIR}/lib/libcurses &&		${MAKE} beforeinstall
257	cd ${.CURDIR}/lib/libedit &&		${MAKE} beforeinstall
258	cd ${.CURDIR}/lib/libmd &&		${MAKE} beforeinstall
259	cd ${.CURDIR}/lib/libmytinfo &&		${MAKE}	beforeinstall
260	cd ${.CURDIR}/lib/libncurses &&		${MAKE}	beforeinstall
261.if !defined(WANT_CSRG_LIBM)
262	cd ${.CURDIR}/lib/msun &&		${MAKE} beforeinstall
263.endif
264	cd ${.CURDIR}/lib/libpcap &&		${MAKE} beforeinstall
265	cd ${.CURDIR}/lib/librpcsvc &&		${MAKE} beforeinstall
266	cd ${.CURDIR}/lib/libskey &&		${MAKE} beforeinstall
267	cd ${.CURDIR}/lib/libtermcap &&		${MAKE}	beforeinstall
268	cd ${.CURDIR}/lib/libcom_err &&		${MAKE} beforeinstall
269	cd ${.CURDIR}/lib/libss &&		${MAKE} beforeinstall
270	cd ${.CURDIR}/lib/libscsi &&		${MAKE}	beforeinstall
271	cd ${.CURDIR}/lib/libutil &&		${MAKE}	beforeinstall
272
273lib-tools:
274	@echo "--------------------------------------------------------------"
275	@echo " Rebuilding tools needed to build the libraries"
276	@echo "--------------------------------------------------------------"
277	@echo
278	cd ${.CURDIR}/usr.bin/xinstall && \
279		${MAKE} ${MK_FLAGS} depend all install ${CLEANDIR} ${OBJDIR}
280	cd ${.CURDIR}/gnu/usr.bin/ld && \
281		${MAKE} ${MK_FLAGS} depend all install ${CLEANDIR} ${OBJDIR}
282	cd ${.CURDIR}/usr.bin/ar && \
283		${MAKE} ${MK_FLAGS} depend all install ${CLEANDIR} ${OBJDIR}
284	cd ${.CURDIR}/usr.bin/ranlib && \
285		${MAKE} ${MK_FLAGS} depend all install ${CLEANDIR} ${OBJDIR}
286	cd ${.CURDIR}/usr.bin/nm && \
287		${MAKE} ${MK_FLAGS} depend all install ${CLEANDIR} ${OBJDIR}
288	cd ${.CURDIR}/usr.bin/lex/lib && \
289		${MAKE} ${MK_FLAGS} depend all install ${CLEANDIR} ${OBJDIR}
290	cd ${.CURDIR}/usr.bin/compile_et && \
291		${MAKE} ${MK_FLAGS} depend all install ${CLEANDIR} ${OBJDIR} && \
292		rm -f /usr/sbin/compile_et
293	cd ${.CURDIR}/usr.bin/mk_cmds && \
294		${MAKE} ${MK_FLAGS} depend all install ${CLEANDIR} ${OBJDIR}
295
296libraries:
297	@echo "--------------------------------------------------------------"
298	@echo " Rebuilding ${DESTDIR}/usr/lib"
299	@echo "--------------------------------------------------------------"
300	@echo
301.if exists(lib/libcompat)
302	cd ${.CURDIR}/lib/libcompat && \
303		${MAKE} ${MK_FLAGS} depend all install ${CLEANDIR} ${OBJDIR}
304.endif
305.if exists(lib/libncurses)
306	cd ${.CURDIR}/lib/libncurses && \
307		${MAKE} ${MK_FLAGS} depend all install ${CLEANDIR} ${OBJDIR}
308.endif
309.if exists(lib/libtermcap)
310	cd ${.CURDIR}/lib/libtermcap && \
311		${MAKE} ${MK_FLAGS} depend all install ${CLEANDIR} ${OBJDIR}
312.endif
313.if exists(gnu)
314	cd ${.CURDIR}/gnu/lib && \
315		${MAKE} ${MK_FLAGS} depend all install ${CLEANDIR} ${OBJDIR}
316	cd ${.CURDIR}/gnu/usr.bin/cc/libgcc && \
317		${MAKE} ${MK_FLAGS} depend all install ${CLEANDIR} ${OBJDIR}
318.endif
319.if exists(secure) && !defined(NOCRYPT) && !defined(NOSECURE)
320	cd ${.CURDIR}/secure/lib && \
321		${MAKE} ${MK_FLAGS} depend all install ${CLEANDIR} ${OBJDIR}
322.endif
323.if exists(lib)
324	cd ${.CURDIR}/lib/csu/i386 && \
325		${MAKE} ${MK_FLAGS} depend all install ${CLEANDIR} ${OBJDIR}
326	cd ${.CURDIR}/lib && \
327		${MAKE} ${MK_FLAGS} depend all install ${CLEANDIR} ${OBJDIR}
328.endif
329.if exists(usr.sbin/lex/lib)
330	cd ${.CURDIR}/usr.bin/lex/lib && \
331		${MAKE} ${MK_FLAGS} depend all install ${CLEANDIR} ${OBJDIR}
332.endif
333.if exists(eBones) && !defined(NOCRYPT) && defined(MAKE_EBONES)
334	cd ${.CURDIR}/eBones/lib && \
335		${MAKE} ${MK_FLAGS} depend all install ${CLEANDIR} ${OBJDIR}
336.endif
337.if exists(usr.sbin/pcvt/keycap)
338	cd ${.CURDIR}/usr.sbin/pcvt/keycap && \
339		${MAKE} ${MK_FLAGS} depend all install ${CLEANDIR} ${OBJDIR}
340.endif
341
342include-tools:
343	@echo "--------------------------------------------------------------"
344	@echo " Rebuild tools necessary to build the include files"
345	@echo "--------------------------------------------------------------"
346	@echo
347	cd ${.CURDIR}/usr.bin/xinstall && \
348		${MAKE} ${MK_FLAGS} depend all install ${CLEANDIR} ${OBJDIR}
349	cd ${.CURDIR}/usr.bin/rpcgen && \
350		${MAKE} ${MK_FLAGS} depend all install ${CLEANDIR} ${OBJDIR}
351
352build-tools:
353	@echo "--------------------------------------------------------------"
354	@echo " Rebuilding ${DESTDIR} C compiler, make, symorder, sgmlfmt and zic(8)"
355	@echo "--------------------------------------------------------------"
356	@echo
357	cd ${.CURDIR}/gnu/usr.bin/cc && \
358		${MAKE} ${MK_FLAGS} depend all install ${CLEANDIR} ${OBJDIR}
359	cd ${.CURDIR}/usr.bin/make && \
360		${MAKE} ${MK_FLAGS} depend all install ${CLEANDIR} ${OBJDIR}
361	cd ${.CURDIR}/usr.bin/symorder && \
362		${MAKE} ${MK_FLAGS} depend all install ${CLEANDIR} ${OBJDIR}
363	cd ${.CURDIR}/usr.bin/sgmlfmt && \
364		${MAKE} ${MK_FLAGS} depend all install ${CLEANDIR} ${OBJDIR} 
365	cd ${.CURDIR}/share/sgml && \
366		${MAKE} ${MK_FLAGS} depend all install ${CLEANDIR} ${OBJDIR} 
367	cd ${.CURDIR}/usr.sbin/zic && \
368		${MAKE} ${MK_FLAGS} depend all install ${CLEANDIR} ${OBJDIR}
369
370.include <bsd.subdir.mk>
371