Makefile revision 8295
1139825Simp#
21541Srgrimes#	$Id: Makefile,v 1.53 1995/04/27 11:25:48 jkh Exp $
31541Srgrimes#
41541Srgrimes# Make command line options:
51541Srgrimes#	-DCLOBBER will remove /usr/include and MOST of /usr/lib 
61541Srgrimes#	-DMAKE_LOCAL to add ./local to the SUBDIR list
71541Srgrimes#	-DMAKE_PORTS to add ./ports to the SUBDIR list
81541Srgrimes#	-DMAKE_EBONES to build eBones (KerberosIV)
91541Srgrimes#
101541Srgrimes#	-DNOCLEANDIR run ${MAKE} clean, instead of ${MAKE} cleandir
111541Srgrimes#	-DNOCRYPT will prevent building of crypt versions
121541Srgrimes#	-DNOLKM do not build loadable kernel modules
131541Srgrimes#	-DNOOBJDIR do not run ``${MAKE} obj''
141541Srgrimes#	-DNOPROFILE do not build profiled libraries
151541Srgrimes#	-DNOSECURE do not go into secure subdir
161541Srgrimes
171541Srgrimes# Put initial settings here.
181541SrgrimesSUBDIR=
191541Srgrimes
201541Srgrimes# We must do include and lib first so that the perl *.ph generation
211541Srgrimes# works correctly as it uses the header files installed by this.
221541Srgrimes.if exists(include)
231541SrgrimesSUBDIR+= include
241541Srgrimes.endif
251541Srgrimes.if exists(lib)
261541SrgrimesSUBDIR+= lib
271541Srgrimes.endif
281541Srgrimes
291541Srgrimes.if exists(bin)
301541SrgrimesSUBDIR+= bin
311541Srgrimes.endif
321817Sdg.if exists(contrib)
331541SrgrimesSUBDIR+= contrib
341541Srgrimes.endif
351541Srgrimes.if exists(games)
361541SrgrimesSUBDIR+= games
371541Srgrimes.endif
381541Srgrimes.if exists(gnu)
395455SdgSUBDIR+= gnu
401541Srgrimes.endif
411541Srgrimes.if exists(eBones) && !defined(NOCRYPT) && defined(MAKE_EBONES)
421541SrgrimesSUBDIR+= eBones
431541Srgrimes.endif
441541Srgrimes.if exists(libexec)
455455SdgSUBDIR+= libexec
465455Sdg.endif
475455Sdg.if exists(sbin)
481541SrgrimesSUBDIR+= sbin
495455Sdg.endif
501541Srgrimes.if exists(share)
511541SrgrimesSUBDIR+= share
521541Srgrimes.endif
531541Srgrimes.if exists(sys)
541541SrgrimesSUBDIR+= sys
551541Srgrimes.endif
561541Srgrimes.if exists(usr.bin)
571541SrgrimesSUBDIR+= usr.bin
581541Srgrimes.endif
591541Srgrimes.if exists(usr.sbin)
601541SrgrimesSUBDIR+= usr.sbin
611541Srgrimes.endif
621541Srgrimes.if exists(secure) && !defined(NOCRYPT) && !defined(NOSECURE)
631541SrgrimesSUBDIR+= secure
641541Srgrimes.endif
65116226Sobrien.if exists(lkm) && !defined(NOLKM)
66116226SobrienSUBDIR+= lkm
67116226Sobrien.endif
681541Srgrimes
691541Srgrimes# etc must be last for "distribute" to work
7087157Sluigi.if exists(etc) && make(distribute)
71168395SpjdSUBDIR+= etc
7276166Smarkm.endif
732112Swollman
746129Sdg# These are last, since it is nice to at least get the base system
75248084Sattilio# rebuilt before you do them.
76188964Srwatson.if defined(MAKE_LOCAL) & exists(local) & exists(local/Makefile)
77254025SjeffSUBDIR+= local
781541Srgrimes.endif
791541Srgrimes.if defined(MAKE_PORTS) & exists(ports) & exists(ports/Makefile)
8012662SdgSUBDIR+= ports
81254025Sjeff.endif
8212662Sdg
8312662Sdg# Handle the -DNOOBJDIR and -DNOCLEANDIR
8412662Sdg.if defined(NOOBJDIR)
851541SrgrimesOBJDIR=
861541Srgrimes.else
8712726SbdeOBJDIR=		obj
88168395Spjd.endif
891541Srgrimes.if defined(NOCLEANDIR)
90248277SkibCLEANDIR=	clean
91248277Skib.else 
92118764SsilbyCLEANDIR=	cleandir
932112Swollman.endif
94221853Smdf
95221853Smdfworld:	hierarchy mk cleandist includes lib-tools libraries tools
96221853Smdf	@echo "--------------------------------------------------------------"
97290728Sjhb	@echo " Rebuilding ${DESTDIR} The whole thing"
98290728Sjhb	@echo "--------------------------------------------------------------"
99290728Sjhb	@echo
100320797Smarkj	${MAKE} depend all install
101320797Smarkj	cd ${.CURDIR}/share/man &&		${MAKE} makedb
102320797Smarkj
103246316Smariushierarchy:
104273377Shselasky	@echo "--------------------------------------------------------------"
105246316Smarius	@echo " Making hierarchy"
106246316Smarius	@echo "--------------------------------------------------------------"
107246926Salc	cd ${.CURDIR}/etc &&		${MAKE} distrib-dirs
108246316Smarius
109246316Smariusupdate:
110273377Shselasky.if defined(SUP_UPDATE)
111246316Smarius	@echo "--------------------------------------------------------------"
112246316Smarius	@echo "Running sup"
113246316Smarius	@echo "--------------------------------------------------------------"
1141541Srgrimes	@sup -v ${SUPFILE}
115254025Sjeff.endif
11647841Sdt.if defined(CVS_UPDATE)
117118317Salc	@echo "--------------------------------------------------------------"
118118317Salc	@echo "Updating /usr/src from cvs repository" ${CVSROOT}
119118317Salc	@echo "--------------------------------------------------------------"
120118317Salc	cd ${.CURDIR} &&  cvs update -P -d
121118317Salc.endif
12247841Sdt
12347841Sdtcleandist:
124324781Semaste.if !defined(NOCLEANDIR)
12547841Sdt	@echo "--------------------------------------------------------------"
12647841Sdt	@echo " Cleaning up the source tree, and rebuilding the obj tree"
12747841Sdt	@echo "--------------------------------------------------------------"
12847841Sdt	@echo
129254025Sjeff	here=`pwd`; dest=/usr/obj`echo $$here | sed 's,^/usr/src,,'`; \
13047841Sdt	if test -d /usr/obj -a ! -d $$dest; then \
131254025Sjeff		mkdir -p $$dest; \
13247841Sdt	else \
13347841Sdt		true; \
13447841Sdt	fi; \
13547841Sdt	cd $$dest && rm -rf ${SUBDIR}
136254025Sjeff	find . -name obj | xargs rm -rf
137206819Sjmallett.if defined(MAKE_LOCAL) & exists(local) & exists(local/Makefile)
138254025Sjeff	# The cd is done as local may well be a symbolic link
139254025Sjeff	-cd local && find . -name obj | xargs rm -rf
140254025Sjeff.endif
141254025Sjeff.if defined(MAKE_PORTS) & exists(ports) & exists(ports/Makefile)
142254025Sjeff	# The cd is done as local may well be a symbolic link
143206819Sjmallett	-cd ports && find . -name obj | xargs rm -rf
144254025Sjeff.endif
145324781Semaste	${MAKE} cleandir
1461541Srgrimes	${MAKE} obj
1471541Srgrimes.endif
1481541Srgrimes
149254025Sjeffinstallmost:
1501541Srgrimes	@echo "--------------------------------------------------------------"
1511541Srgrimes	@echo " Installing programs only"
1521541Srgrimes	@echo "--------------------------------------------------------------"
153238452Salc	cd ${.CURDIR}/bin	&&	${MAKE} ${.MAKEFLAGS} install
154238452Salc	cd ${.CURDIR}/sbin	&&	${MAKE} ${.MAKEFLAGS} install
155238452Salc	cd ${.CURDIR}/libexec	&&	${MAKE} ${.MAKEFLAGS} install
156238452Salc	cd ${.CURDIR}/usr.bin	&&	${MAKE} ${.MAKEFLAGS} install
157238452Salc	cd ${.CURDIR}/usr.sbin	&&	${MAKE} ${.MAKEFLAGS} install
158238452Salc	cd ${.CURDIR}/gnu/libexec &&	${MAKE} ${.MAKEFLAGS} install
159238452Salc	cd ${.CURDIR}/gnu/usr.bin &&	${MAKE} ${.MAKEFLAGS} install
160238452Salc	cd ${.CURDIR}/gnu/usr.sbin &&	${MAKE} ${.MAKEFLAGS} install
161254025Sjeff#.if defined(MAKE_EBONES) && !defined(NOCRYPT)
162238452Salc#	cd ${.CURDIR}/eBones	&&	${MAKE} ${.MAKEFLAGS} installmost
163238452Salc#.endif
164254025Sjeff#.if !defined(NOSECURE) && !defined(NOCRYPT)
165316073Skib#	cd ${.CURDIR}/secure	&&	${MAKE} ${.MAKEFLAGS} installmost
166238452Salc#.endif
167238452Salc
168238452Salcmost:
169238452Salc	@echo "--------------------------------------------------------------"
170254025Sjeff	@echo " Building programs only"
171238452Salc	@echo "--------------------------------------------------------------"
172238452Salc	cd ${.CURDIR}/bin	&&	${MAKE} ${.MAKEFLAGS} all
173254025Sjeff	cd ${.CURDIR}/sbin	&&	${MAKE} ${.MAKEFLAGS} all
174248084Sattilio	cd ${.CURDIR}/libexec	&&	${MAKE} ${.MAKEFLAGS} all
175254025Sjeff	cd ${.CURDIR}/usr.bin	&&	${MAKE} ${.MAKEFLAGS} all
176238452Salc	cd ${.CURDIR}/usr.sbin	&&	${MAKE} ${.MAKEFLAGS} all
177238452Salc	cd ${.CURDIR}/gnu/libexec &&	${MAKE} ${.MAKEFLAGS} all
178316073Skib	cd ${.CURDIR}/gnu/usr.bin &&	${MAKE} ${.MAKEFLAGS} all
179254025Sjeff	cd ${.CURDIR}/gnu/usr.sbin &&	${MAKE} ${.MAKEFLAGS} all
180238452Salc#.if defined(MAKE_EBONES) && !defined(NOCRYPT)
181248084Sattilio#	cd ${.CURDIR}/eBones	&&	${MAKE} ${.MAKEFLAGS} most
182238452Salc#.endif
183292469Salc#.if !defined(NOSECURE) && !defined(NOCRYPT)
184292469Salc#	cd ${.CURDIR}/secure	&&	${MAKE} ${.MAKEFLAGS} most
185292469Salc#.endif
186292469Salc
187248084Sattiliomk:
188238452Salc	@echo "--------------------------------------------------------------"
189238452Salc	@echo " Rebuilding ${DESTDIR}/usr/share/mk"
190238452Salc	@echo "--------------------------------------------------------------"
191288281Salc	cd ${.CURDIR}/share/mk &&		${MAKE} install
192254025Sjeff
193238452Salcincludes:
194238452Salc	@echo "--------------------------------------------------------------"
195238452Salc	@echo " Rebuilding ${DESTDIR}/usr/include"
196238452Salc	@echo "--------------------------------------------------------------"
197238452Salc	@echo
198269728Skib.if defined(CLOBBER)
199269728Skib	rm -rf ${DESTDIR}/usr/include/*
200238452Salc	mtree -deU -f ${.CURDIR}/etc/mtree/BSD.include.dist \
201248084Sattilio		-p ${DESTDIR}/usr/include
202238452Salc.endif
203238452Salc	cd ${.CURDIR}/include &&		${MAKE} install
204238452Salc	cd ${.CURDIR}/gnu/include &&		${MAKE}	install
205238452Salc	cd ${.CURDIR}/gnu/lib/libreadline &&	${MAKE} beforeinstall
206238452Salc	cd ${.CURDIR}/gnu/lib/libregex &&	${MAKE} beforeinstall
207238452Salc	cd ${.CURDIR}/gnu/lib/libg++ &&         ${MAKE} beforeinstall
208238452Salc	cd ${.CURDIR}/gnu/lib/libdialog &&      ${MAKE} beforeinstall
209238452Salc.if exists(eBones) && !defined(NOCRYPT) && defined(MAKE_EBONES)
210238452Salc	cd ${.CURDIR}/eBones/include &&		${MAKE} beforeinstall
211238452Salc.endif
212238452Salc	cd ${.CURDIR}/lib/libc &&		${MAKE} beforeinstall
213238452Salc	cd ${.CURDIR}/lib/libcurses &&		${MAKE} beforeinstall
214254025Sjeff	cd ${.CURDIR}/lib/libedit &&		${MAKE} beforeinstall
215238452Salc	cd ${.CURDIR}/lib/libmd &&		${MAKE} beforeinstall
216238452Salc	cd ${.CURDIR}/lib/libmytinfo &&		${MAKE}	beforeinstall
217238452Salc	cd ${.CURDIR}/lib/libncurses &&		${MAKE}	beforeinstall
218254025Sjeff.if !defined(WANT_CSRG_LIBM)
219316073Skib	cd ${.CURDIR}/lib/msun &&		${MAKE} beforeinstall
220238452Salc.endif
221292469Salc	cd ${.CURDIR}/lib/libpcap &&		${MAKE} beforeinstall
222238452Salc	cd ${.CURDIR}/lib/librpcsvc &&		${MAKE} beforeinstall
223238452Salc	cd ${.CURDIR}/lib/libskey &&		${MAKE} beforeinstall
224238452Salc	cd ${.CURDIR}/lib/libtermcap &&		${MAKE}	beforeinstall
225254025Sjeff	cd ${.CURDIR}/lib/libcom_err &&		${MAKE} beforeinstall
226238452Salc	cd ${.CURDIR}/lib/libss &&		${MAKE} beforeinstall
227238452Salc	cd ${.CURDIR}/lib/libforms &&		${MAKE}	beforeinstall
228254025Sjeff	cd ${.CURDIR}/lib/libscsi &&		${MAKE}	beforeinstall
229292469Salc	cd ${.CURDIR}/lib/libftp &&		${MAKE}	beforeinstall
230248084Sattilio
231238452Salclib-tools:
232238452Salc	@echo "--------------------------------------------------------------"
233316073Skib	@echo " Rebuilding tools needed to build the libraries"
234292469Salc	@echo "--------------------------------------------------------------"
235238452Salc	@echo
236248084Sattilio	cd ${.CURDIR}/gnu/usr.bin/ld && \
237238452Salc		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
238292469Salc	cd ${.CURDIR}/usr.bin/ar && \
239292469Salc		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
240292469Salc	cd ${.CURDIR}/usr.bin/ranlib && \
241248084Sattilio		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
242238452Salc	cd ${.CURDIR}/usr.bin/nm && \
243238452Salc		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
244238452Salc	cd ${.CURDIR}/usr.bin/lex/lib && \
245254025Sjeff		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
246238452Salc	cd ${.CURDIR}/usr.bin/compile_et && \
247238452Salc		${MAKE} depend all install ${CLEANDIR} ${OBJDIR} && \
248292469Salc		rm -f /usr/sbin/compile_et
249254025Sjeff	cd ${.CURDIR}/usr.bin/mk_cmds && \
250238452Salc		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
251238452Salc
252238452Salclibraries:
253238452Salc	@echo "--------------------------------------------------------------"
254269728Skib	@echo " Rebuilding ${DESTDIR}/usr/lib"
255269728Skib	@echo "--------------------------------------------------------------"
256254025Sjeff	@echo
257238452Salc.if defined(CLOBBER)
258248084Sattilio	find ${DESTDIR}/usr/lib \! -name '*.s[ao].*' -a \! -type d | \
259238452Salc		xargs rm -rf
260238452Salc.endif
261238452Salc.if exists(lib/libcompat)
262238452Salc	cd ${.CURDIR}/lib/libcompat && \
2631541Srgrimes		${MAKE} depend all install
2641541Srgrimes.endif
2651541Srgrimes.if exists(gnu)
2661541Srgrimes	cd ${.CURDIR}/gnu/lib && \
2671541Srgrimes		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
2681541Srgrimes	cd ${.CURDIR}/gnu/usr.bin/cc/libgcc && \
2691541Srgrimes		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
2701541Srgrimes.endif
27170480Salfred.if exists(secure) && !defined(NOCRYPT) && !defined(NOSECURE)
2721541Srgrimes	cd ${.CURDIR}/secure/lib && \
273178933Salc		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
2741541Srgrimes.endif
2758876Srgrimes.if exists(lib)
276178933Salc	cd ${.CURDIR}/lib/csu/i386 && \
277178933Salc		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
2781541Srgrimes	cd ${.CURDIR}/lib && \
27970478Salfred		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
2805455Sdg.endif
2811541Srgrimes	cd ${.CURDIR}/usr.bin/lex/lib && \
2821541Srgrimes		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
2831541Srgrimes.if exists(eBones) && !defined(NOCRYPT) && defined(MAKE_EBONES)
284178637Salc	cd ${.CURDIR}/eBones/des && \
285255426Sjhb		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
286254430Sjhb	cd ${.CURDIR}/eBones/acl && \
287194766Skib		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
288177762Salc	cd ${.CURDIR}/eBones/kdb && \
289177762Salc		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
2901541Srgrimes	cd ${.CURDIR}/eBones/krb && \
29132702Sdyson		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
2921541Srgrimes.endif
2931541Srgrimes
29470478Salfredtools:
2951541Srgrimes	@echo "--------------------------------------------------------------"
2965455Sdg	@echo " Rebuilding ${DESTDIR} Compiler and Make"
2971541Srgrimes	@echo "--------------------------------------------------------------"
2981541Srgrimes	@echo
2991541Srgrimes	cd ${.CURDIR}/gnu/usr.bin/cc && \
30042957Sdillon		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
3011541Srgrimes	cd ${.CURDIR}/usr.bin/make && \
302254025Sjeff		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
3031541Srgrimes
3041541Srgrimes.include <bsd.subdir.mk>
305254025Sjeff