Makefile revision 2068
150476Speter#
231027Sache#	$Id: Makefile,v 1.6 1994/08/13 22:47:28 jkh Exp $
331027Sache#
431027Sache# Make command line options:
531027Sache#	-DCLOBBER will remove /usr/include and MOST of /usr/lib 
6174990Sache#	-DMAKE_LOCAL to add ./local to the SUBDIR list
731027Sache#	-DMAKE_PORTS to add ./ports to the SUBDIR list
8134336Stjr#	-DNOCLEANDIR run ${MAKE} clean, instead of ${MAKE} cleandir
9134336Stjr# XXX1	-DNOCRYPT will prevent building of crypt versions (BROKEN RIGHT NOW)
10134336Stjr#	-DNOOBJDIR do not run ``${MAKE} obj''
11134336Stjr#	-DNOPROFILE do not build profiled libraries
12134336Stjr#
13134336Stjr# XXX1	This has not yet been implemented in FreeBSD 2.0.0, the only way
14134336Stjr#	to build the system is with full crypt and KerberosIV
15134336Stjr#
16134336Stjr
17134336Stjr# Put initial settings here.
18134336StjrNOCRYPT=	yes
19134336StjrSUBDIR=
2031027Sache
21174990Sache.if exists(bin)
2231027SacheSUBDIR+= bin
23134336Stjr.endif
24134336Stjr.if exists(contrib)
25134336StjrSUBDIR+= contrib
26134336Stjr.endif
27134336Stjr.if exists(etc)
28134336StjrSUBDIR+= etc
29134336Stjr.endif
30134336Stjr.if exists(games)
31134336StjrSUBDIR+= games
32134336Stjr.endif
33134336Stjr.if exists(gnu)
34134336StjrSUBDIR+= gnu
3531027Sache.endif
36174990Sache.if exists(include)
3731027SacheSUBDIR+= include
38134336Stjr.endif
39134336Stjr.if exists(lib)
40134336StjrSUBDIR+= lib
41134336Stjr.endif
42134336Stjr.if exists(kerberosIV) && !defined(NOCRYPT)
43134336StjrSUBDIR+= kerberosIV
44134336Stjr.endif
4531027Sache.if exists(libexec)
46174990SacheSUBDIR+= libexec
4731027Sache.endif
48134336Stjr.if exists(sbin)
49134336StjrSUBDIR+= sbin
50134336Stjr.endif
51134336Stjr.if exists(share)
52134336StjrSUBDIR+= share
53134336Stjr.endif
54134336Stjr.if exists(sys)
5531027SacheSUBDIR+= sys
5631027Sache.endif
5731027Sache.if exists(usr.bin)
5831027SacheSUBDIR+= usr.bin
5931027Sache.endif
6031027Sache.if exists(usr.sbin)
6131027SacheSUBDIR+= usr.sbin
6274570Sache.endif
6331027Sache
6431027Sache# These are last, since it is nice to at least get the base system
6531027Sache# rebuilt before you do them.
6654090Sache.if defined(MAKE_LOCAL) & exists(local) & exists(local/Makefile)
6731027SacheSUBDIR+= local
6831027Sache.endif
6931027Sache.if defined(MAKE_PORTS) & exists(ports) & exists(ports/Makefile)
7031027SacheSUBDIR+= ports
7131027Sache.endif
7231027Sache
7331027Sache# Handle the -DNOOBJDIR and -DNOCLEANDIR
7431027Sache.if defined(NOOBJDIR)
7531027SacheOBJDIR=
7631027Sache.else
7731027SacheOBJDIR=		obj
7854090Sache.endif
7953943Sache.if defined(NOCLEANDIR)
80174990SacheCLEANDIR=	clean
8153943Sache.else 
82134336StjrCLEANDIR=	cleandir
83134336Stjr.endif
84134336Stjr
85134336Stjrworld:	directories cleandist mk includes libraries tools mdec
86134336Stjr	@echo "--------------------------------------------------------------"
87134336Stjr	@echo " Rebuilding ${DESTDIR} The whole thing"
88134336Stjr	@echo "--------------------------------------------------------------"
89134336Stjr	@echo
90134336Stjr	${MAKE} depend all install
91134336Stjr	cd ${.CURDIR}/share/man &&		${MAKE} makedb
92134336Stjr
93134336Stjrdirectories:
9453943Sache	@echo "--------------------------------------------------------------"
9574413Sache	@echo " Making directories"
9653943Sache	@echo "--------------------------------------------------------------"
9774413Sache	@echo " XXX Not yet ready in 2.0.0"
9853961Sache# XXX	cd ${.CURDIR}/etc &&			${MAKE} distrib-dirs
9974413Sache
10053961Sachecleandist:
10174413Sache.if !defined(NOCLEANDIR)
10274413Sache	@echo "--------------------------------------------------------------"
103	@echo " Cleaning up the source tree, and rebuilding the obj tree"
104	@echo "--------------------------------------------------------------"
105	@echo
106	here=`pwd`; dest=/usr/obj`echo $$here | sed 's,^/usr/src,,'`; \
107	if test -d /usr/obj -a ! -d $$dest; then \
108		mkdir -p $$dest; \
109	else \
110		true; \
111	fi; \
112	cd $$dest && rm -rf ${SUBDIR}
113	find . -name obj | xargs rm -rf
114.if defined(MAKE_LOCAL) & exists(local) & exists(local/Makefile)
115	# The cd is done as local may well be a symbolic link
116	-cd local && find . -name obj | xargs rm -rf
117.endif
118.if defined(MAKE_PORTS) & exists(ports) & exists(ports/Makefile)
119	# The cd is done as local may well be a symbolic link
120	-cd ports && find . -name obj | xargs rm -rf
121.endif
122	${MAKE} cleandir
123	${MAKE} obj
124.endif
125
126mk:
127	@echo "--------------------------------------------------------------"
128	@echo " Rebuilding ${DESTDIR}/usr/share/mk"
129	@echo "--------------------------------------------------------------"
130	cd ${.CURDIR}/share/mk &&		${MAKE} install
131
132includes:
133	@echo "--------------------------------------------------------------"
134	@echo " Rebuilding ${DESTDIR}/usr/include"
135	@echo "--------------------------------------------------------------"
136	@echo
137.if defined(CLOBBER)
138	rm -rf ${DESTDIR}/usr/include
139	mkdir ${DESTDIR}/usr/include
140	chown ${BINOWN}.${BINGRP} ${DESTDIR}/usr/include
141	chmod 755 ${DESTDIR}/usr/include
142.endif
143	cd ${.CURDIR}/include &&		${MAKE} install
144#XXX	cd ${.CURDIR}/gnu/lib/libg++ &&		${MAKE} beforeinstall
145	cd ${.CURDIR}/gnu/usr.bin/cc/libobjc &&	${MAKE} beforeinstall
146.if !defined(NOCRYPT)
147	cd ${.CURDIR}/kerberosIV/include &&	${MAKE} install
148.endif
149	cd ${.CURDIR}/lib/libc &&		${MAKE} beforeinstall
150	cd ${.CURDIR}/lib/libcurses &&		${MAKE} beforeinstall
151	cd ${.CURDIR}/lib/libedit &&		${MAKE} beforeinstall
152	cd ${.CURDIR}/lib/librpcsvc &&		${MAKE} beforeinstall
153
154libraries:
155	@echo "--------------------------------------------------------------"
156	@echo " Rebuilding ${DESTDIR}/usr/lib"
157	@echo "--------------------------------------------------------------"
158	@echo
159.if defined(CLOBBER)
160	find ${DESTDIR}/usr/lib \! -name '*.s[ao].*' -a \! -type d | \
161		xargs rm -rf
162.endif
163	# XXX The whole GNU block should be doable in one command, as soon		# as libg++ works on FreeBSD 2.0 I will try that out
164#XXX	cd ${.CURDIR}/gnu/lib/libg++ && \
165#XXX		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
166	cd ${.CURDIR}/gnu/lib/libmalloc && \
167		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
168	cd ${.CURDIR}/gnu/lib/libreadline && \
169		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
170	cd ${.CURDIR}/gnu/lib/libregex && \
171		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
172	cd ${.CURDIR}/gnu/usr.bin/cc/libgcc && \
173		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
174	cd ${.CURDIR}/lib && \
175		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
176	# You need the lex lib before you can build kerberosIV
177#XXX	# We don't have lex in the 2.0 tree yet!
178#XXX	cd ${.CURDIR}/usr.bin/lex/lib && \
179#XXX		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
180.if !defined(NOCRYPT)
181	cd ${.CURDIR}/kerberosIV/acl && \
182		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
183	cd ${.CURDIR}/kerberosIV/des && \
184		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
185	cd ${.CURDIR}/kerberosIV/kdb && \
186		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
187	cd ${.CURDIR}/kerberosIV/krb && \
188		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
189.endif
190
191tools:
192	@echo "--------------------------------------------------------------"
193	@echo " Rebuilding ${DESTDIR} Compiler and Make"
194	@echo "--------------------------------------------------------------"
195	@echo
196	cd ${.CURDIR}/gnu/usr.bin/cc && \
197		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
198	cd ${.CURDIR}/usr.bin/make && \
199		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
200
201mdec:
202	@echo "--------------------------------------------------------------"
203	@echo " Rebuilding ${DESTDIR}/usr/mdec"
204	@echo "--------------------------------------------------------------"
205	@echo
206	@echo " XXX Not yet ready in 2.0.0"
207#XXX.if ${MACHINE} == "i386"
208#XXX	# XXX Need to fix for obj case, src/sys/Makefile needs to be fixed to
209#XXX	# traverse down into here and this can go away!
210#XXX	cd ${.CURDIR}/sys/i386/boot &&	${MAKE} depend all install ${CLEANDIR}
211#XXX.if defined (DESTDIR)
212#XXX	# XXX Really need to fix the sys/i386/boot Makefile so this is not
213#XXX	# necessary!!!
214#XXX	cd /usr/mdec && find . | cpio -pdamuv ${DESTDIR}/usr/mdec
215#XXX.endif
216#XXX.endif
217
218.include <bsd.subdir.mk>
219