Makefile revision 8295
10SN/A#
2157SN/A#	$Id: Makefile,v 1.53 1995/04/27 11:25:48 jkh Exp $
30SN/A#
40SN/A# Make command line options:
50SN/A#	-DCLOBBER will remove /usr/include and MOST of /usr/lib 
60SN/A#	-DMAKE_LOCAL to add ./local to the SUBDIR list
7157SN/A#	-DMAKE_PORTS to add ./ports to the SUBDIR list
80SN/A#	-DMAKE_EBONES to build eBones (KerberosIV)
9157SN/A#
100SN/A#	-DNOCLEANDIR run ${MAKE} clean, instead of ${MAKE} cleandir
110SN/A#	-DNOCRYPT will prevent building of crypt versions
120SN/A#	-DNOLKM do not build loadable kernel modules
130SN/A#	-DNOOBJDIR do not run ``${MAKE} obj''
140SN/A#	-DNOPROFILE do not build profiled libraries
150SN/A#	-DNOSECURE do not go into secure subdir
160SN/A
170SN/A# Put initial settings here.
180SN/ASUBDIR=
190SN/A
200SN/A# We must do include and lib first so that the perl *.ph generation
21157SN/A# works correctly as it uses the header files installed by this.
22157SN/A.if exists(include)
23157SN/ASUBDIR+= include
240SN/A.endif
250SN/A.if exists(lib)
260SN/ASUBDIR+= lib
270SN/A.endif
280SN/A
290SN/A.if exists(bin)
300SN/ASUBDIR+= bin
310SN/A.endif
320SN/A.if exists(contrib)
330SN/ASUBDIR+= contrib
340SN/A.endif
350SN/A.if exists(games)
360SN/ASUBDIR+= games
370SN/A.endif
380SN/A.if exists(gnu)
390SN/ASUBDIR+= gnu
400SN/A.endif
410SN/A.if exists(eBones) && !defined(NOCRYPT) && defined(MAKE_EBONES)
420SN/ASUBDIR+= eBones
430SN/A.endif
440SN/A.if exists(libexec)
450SN/ASUBDIR+= libexec
460SN/A.endif
470SN/A.if exists(sbin)
480SN/ASUBDIR+= sbin
490SN/A.endif
500SN/A.if exists(share)
510SN/ASUBDIR+= share
520SN/A.endif
530SN/A.if exists(sys)
540SN/ASUBDIR+= sys
550SN/A.endif
560SN/A.if exists(usr.bin)
570SN/ASUBDIR+= usr.bin
580SN/A.endif
590SN/A.if exists(usr.sbin)
600SN/ASUBDIR+= usr.sbin
610SN/A.endif
620SN/A.if exists(secure) && !defined(NOCRYPT) && !defined(NOSECURE)
630SN/ASUBDIR+= secure
640SN/A.endif
650SN/A.if exists(lkm) && !defined(NOLKM)
660SN/ASUBDIR+= lkm
670SN/A.endif
680SN/A
690SN/A# etc must be last for "distribute" to work
700SN/A.if exists(etc) && make(distribute)
710SN/ASUBDIR+= etc
720SN/A.endif
730SN/A
740SN/A# These are last, since it is nice to at least get the base system
750SN/A# rebuilt before you do them.
760SN/A.if defined(MAKE_LOCAL) & exists(local) & exists(local/Makefile)
770SN/ASUBDIR+= local
780SN/A.endif
790SN/A.if defined(MAKE_PORTS) & exists(ports) & exists(ports/Makefile)
800SN/ASUBDIR+= ports
810SN/A.endif
82
83# Handle the -DNOOBJDIR and -DNOCLEANDIR
84.if defined(NOOBJDIR)
85OBJDIR=
86.else
87OBJDIR=		obj
88.endif
89.if defined(NOCLEANDIR)
90CLEANDIR=	clean
91.else 
92CLEANDIR=	cleandir
93.endif
94
95world:	hierarchy mk cleandist includes lib-tools libraries tools
96	@echo "--------------------------------------------------------------"
97	@echo " Rebuilding ${DESTDIR} The whole thing"
98	@echo "--------------------------------------------------------------"
99	@echo
100	${MAKE} depend all install
101	cd ${.CURDIR}/share/man &&		${MAKE} makedb
102
103hierarchy:
104	@echo "--------------------------------------------------------------"
105	@echo " Making hierarchy"
106	@echo "--------------------------------------------------------------"
107	cd ${.CURDIR}/etc &&		${MAKE} distrib-dirs
108
109update:
110.if defined(SUP_UPDATE)
111	@echo "--------------------------------------------------------------"
112	@echo "Running sup"
113	@echo "--------------------------------------------------------------"
114	@sup -v ${SUPFILE}
115.endif
116.if defined(CVS_UPDATE)
117	@echo "--------------------------------------------------------------"
118	@echo "Updating /usr/src from cvs repository" ${CVSROOT}
119	@echo "--------------------------------------------------------------"
120	cd ${.CURDIR} &&  cvs update -P -d
121.endif
122
123cleandist:
124.if !defined(NOCLEANDIR)
125	@echo "--------------------------------------------------------------"
126	@echo " Cleaning up the source tree, and rebuilding the obj tree"
127	@echo "--------------------------------------------------------------"
128	@echo
129	here=`pwd`; dest=/usr/obj`echo $$here | sed 's,^/usr/src,,'`; \
130	if test -d /usr/obj -a ! -d $$dest; then \
131		mkdir -p $$dest; \
132	else \
133		true; \
134	fi; \
135	cd $$dest && rm -rf ${SUBDIR}
136	find . -name obj | xargs rm -rf
137.if defined(MAKE_LOCAL) & exists(local) & exists(local/Makefile)
138	# The cd is done as local may well be a symbolic link
139	-cd local && find . -name obj | xargs rm -rf
140.endif
141.if defined(MAKE_PORTS) & exists(ports) & exists(ports/Makefile)
142	# The cd is done as local may well be a symbolic link
143	-cd ports && find . -name obj | xargs rm -rf
144.endif
145	${MAKE} cleandir
146	${MAKE} obj
147.endif
148
149installmost:
150	@echo "--------------------------------------------------------------"
151	@echo " Installing programs only"
152	@echo "--------------------------------------------------------------"
153	cd ${.CURDIR}/bin	&&	${MAKE} ${.MAKEFLAGS} install
154	cd ${.CURDIR}/sbin	&&	${MAKE} ${.MAKEFLAGS} install
155	cd ${.CURDIR}/libexec	&&	${MAKE} ${.MAKEFLAGS} install
156	cd ${.CURDIR}/usr.bin	&&	${MAKE} ${.MAKEFLAGS} install
157	cd ${.CURDIR}/usr.sbin	&&	${MAKE} ${.MAKEFLAGS} install
158	cd ${.CURDIR}/gnu/libexec &&	${MAKE} ${.MAKEFLAGS} install
159	cd ${.CURDIR}/gnu/usr.bin &&	${MAKE} ${.MAKEFLAGS} install
160	cd ${.CURDIR}/gnu/usr.sbin &&	${MAKE} ${.MAKEFLAGS} install
161#.if defined(MAKE_EBONES) && !defined(NOCRYPT)
162#	cd ${.CURDIR}/eBones	&&	${MAKE} ${.MAKEFLAGS} installmost
163#.endif
164#.if !defined(NOSECURE) && !defined(NOCRYPT)
165#	cd ${.CURDIR}/secure	&&	${MAKE} ${.MAKEFLAGS} installmost
166#.endif
167
168most:
169	@echo "--------------------------------------------------------------"
170	@echo " Building programs only"
171	@echo "--------------------------------------------------------------"
172	cd ${.CURDIR}/bin	&&	${MAKE} ${.MAKEFLAGS} all
173	cd ${.CURDIR}/sbin	&&	${MAKE} ${.MAKEFLAGS} all
174	cd ${.CURDIR}/libexec	&&	${MAKE} ${.MAKEFLAGS} all
175	cd ${.CURDIR}/usr.bin	&&	${MAKE} ${.MAKEFLAGS} all
176	cd ${.CURDIR}/usr.sbin	&&	${MAKE} ${.MAKEFLAGS} all
177	cd ${.CURDIR}/gnu/libexec &&	${MAKE} ${.MAKEFLAGS} all
178	cd ${.CURDIR}/gnu/usr.bin &&	${MAKE} ${.MAKEFLAGS} all
179	cd ${.CURDIR}/gnu/usr.sbin &&	${MAKE} ${.MAKEFLAGS} all
180#.if defined(MAKE_EBONES) && !defined(NOCRYPT)
181#	cd ${.CURDIR}/eBones	&&	${MAKE} ${.MAKEFLAGS} most
182#.endif
183#.if !defined(NOSECURE) && !defined(NOCRYPT)
184#	cd ${.CURDIR}/secure	&&	${MAKE} ${.MAKEFLAGS} most
185#.endif
186
187mk:
188	@echo "--------------------------------------------------------------"
189	@echo " Rebuilding ${DESTDIR}/usr/share/mk"
190	@echo "--------------------------------------------------------------"
191	cd ${.CURDIR}/share/mk &&		${MAKE} install
192
193includes:
194	@echo "--------------------------------------------------------------"
195	@echo " Rebuilding ${DESTDIR}/usr/include"
196	@echo "--------------------------------------------------------------"
197	@echo
198.if defined(CLOBBER)
199	rm -rf ${DESTDIR}/usr/include/*
200	mtree -deU -f ${.CURDIR}/etc/mtree/BSD.include.dist \
201		-p ${DESTDIR}/usr/include
202.endif
203	cd ${.CURDIR}/include &&		${MAKE} install
204	cd ${.CURDIR}/gnu/include &&		${MAKE}	install
205	cd ${.CURDIR}/gnu/lib/libreadline &&	${MAKE} beforeinstall
206	cd ${.CURDIR}/gnu/lib/libregex &&	${MAKE} beforeinstall
207	cd ${.CURDIR}/gnu/lib/libg++ &&         ${MAKE} beforeinstall
208	cd ${.CURDIR}/gnu/lib/libdialog &&      ${MAKE} beforeinstall
209.if exists(eBones) && !defined(NOCRYPT) && defined(MAKE_EBONES)
210	cd ${.CURDIR}/eBones/include &&		${MAKE} beforeinstall
211.endif
212	cd ${.CURDIR}/lib/libc &&		${MAKE} beforeinstall
213	cd ${.CURDIR}/lib/libcurses &&		${MAKE} beforeinstall
214	cd ${.CURDIR}/lib/libedit &&		${MAKE} beforeinstall
215	cd ${.CURDIR}/lib/libmd &&		${MAKE} beforeinstall
216	cd ${.CURDIR}/lib/libmytinfo &&		${MAKE}	beforeinstall
217	cd ${.CURDIR}/lib/libncurses &&		${MAKE}	beforeinstall
218.if !defined(WANT_CSRG_LIBM)
219	cd ${.CURDIR}/lib/msun &&		${MAKE} beforeinstall
220.endif
221	cd ${.CURDIR}/lib/libpcap &&		${MAKE} beforeinstall
222	cd ${.CURDIR}/lib/librpcsvc &&		${MAKE} beforeinstall
223	cd ${.CURDIR}/lib/libskey &&		${MAKE} beforeinstall
224	cd ${.CURDIR}/lib/libtermcap &&		${MAKE}	beforeinstall
225	cd ${.CURDIR}/lib/libcom_err &&		${MAKE} beforeinstall
226	cd ${.CURDIR}/lib/libss &&		${MAKE} beforeinstall
227	cd ${.CURDIR}/lib/libforms &&		${MAKE}	beforeinstall
228	cd ${.CURDIR}/lib/libscsi &&		${MAKE}	beforeinstall
229	cd ${.CURDIR}/lib/libftp &&		${MAKE}	beforeinstall
230
231lib-tools:
232	@echo "--------------------------------------------------------------"
233	@echo " Rebuilding tools needed to build the libraries"
234	@echo "--------------------------------------------------------------"
235	@echo
236	cd ${.CURDIR}/gnu/usr.bin/ld && \
237		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
238	cd ${.CURDIR}/usr.bin/ar && \
239		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
240	cd ${.CURDIR}/usr.bin/ranlib && \
241		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
242	cd ${.CURDIR}/usr.bin/nm && \
243		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
244	cd ${.CURDIR}/usr.bin/lex/lib && \
245		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
246	cd ${.CURDIR}/usr.bin/compile_et && \
247		${MAKE} depend all install ${CLEANDIR} ${OBJDIR} && \
248		rm -f /usr/sbin/compile_et
249	cd ${.CURDIR}/usr.bin/mk_cmds && \
250		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
251
252libraries:
253	@echo "--------------------------------------------------------------"
254	@echo " Rebuilding ${DESTDIR}/usr/lib"
255	@echo "--------------------------------------------------------------"
256	@echo
257.if defined(CLOBBER)
258	find ${DESTDIR}/usr/lib \! -name '*.s[ao].*' -a \! -type d | \
259		xargs rm -rf
260.endif
261.if exists(lib/libcompat)
262	cd ${.CURDIR}/lib/libcompat && \
263		${MAKE} depend all install
264.endif
265.if exists(gnu)
266	cd ${.CURDIR}/gnu/lib && \
267		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
268	cd ${.CURDIR}/gnu/usr.bin/cc/libgcc && \
269		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
270.endif
271.if exists(secure) && !defined(NOCRYPT) && !defined(NOSECURE)
272	cd ${.CURDIR}/secure/lib && \
273		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
274.endif
275.if exists(lib)
276	cd ${.CURDIR}/lib/csu/i386 && \
277		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
278	cd ${.CURDIR}/lib && \
279		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
280.endif
281	cd ${.CURDIR}/usr.bin/lex/lib && \
282		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
283.if exists(eBones) && !defined(NOCRYPT) && defined(MAKE_EBONES)
284	cd ${.CURDIR}/eBones/des && \
285		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
286	cd ${.CURDIR}/eBones/acl && \
287		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
288	cd ${.CURDIR}/eBones/kdb && \
289		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
290	cd ${.CURDIR}/eBones/krb && \
291		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
292.endif
293
294tools:
295	@echo "--------------------------------------------------------------"
296	@echo " Rebuilding ${DESTDIR} Compiler and Make"
297	@echo "--------------------------------------------------------------"
298	@echo
299	cd ${.CURDIR}/gnu/usr.bin/cc && \
300		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
301	cd ${.CURDIR}/usr.bin/make && \
302		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
303
304.include <bsd.subdir.mk>
305