Makefile revision 2069
1#
2#	$Id: Makefile,v 1.7 1994/08/14 16:52:44 jkh Exp $
3#
4# Make command line options:
5#	-DCLOBBER will remove /usr/include and MOST of /usr/lib 
6#	-DMAKE_LOCAL to add ./local to the SUBDIR list
7#	-DMAKE_PORTS to add ./ports to the SUBDIR list
8#	-DNOCLEANDIR run ${MAKE} clean, instead of ${MAKE} cleandir
9# XXX1	-DNOCRYPT will prevent building of crypt versions (BROKEN RIGHT NOW)
10#	-DNOOBJDIR do not run ``${MAKE} obj''
11#	-DNOPROFILE do not build profiled libraries
12#
13# XXX1	This has not yet been implemented in FreeBSD 2.0.0, the only way
14#	to build the system is with full crypt and KerberosIV
15#
16
17# Put initial settings here.
18NOCRYPT=	yes
19SUBDIR=
20
21.if exists(bin)
22SUBDIR+= bin
23.endif
24.if exists(contrib)
25SUBDIR+= contrib
26.endif
27.if exists(etc)
28SUBDIR+= etc
29.endif
30.if exists(games)
31SUBDIR+= games
32.endif
33.if exists(gnu)
34SUBDIR+= gnu
35.endif
36.if exists(include)
37SUBDIR+= include
38.endif
39.if exists(lib)
40SUBDIR+= lib
41.endif
42.if exists(kerberosIV) && !defined(NOCRYPT)
43SUBDIR+= kerberosIV
44.endif
45.if exists(libexec)
46SUBDIR+= libexec
47.endif
48.if exists(sbin)
49SUBDIR+= sbin
50.endif
51.if exists(share)
52SUBDIR+= share
53.endif
54.if exists(sys)
55SUBDIR+= sys
56.endif
57.if exists(usr.bin)
58SUBDIR+= usr.bin
59.endif
60.if exists(usr.sbin)
61SUBDIR+= usr.sbin
62.endif
63
64# These are last, since it is nice to at least get the base system
65# rebuilt before you do them.
66.if defined(MAKE_LOCAL) & exists(local) & exists(local/Makefile)
67SUBDIR+= local
68.endif
69.if defined(MAKE_PORTS) & exists(ports) & exists(ports/Makefile)
70SUBDIR+= ports
71.endif
72
73# Handle the -DNOOBJDIR and -DNOCLEANDIR
74.if defined(NOOBJDIR)
75OBJDIR=
76.else
77OBJDIR=		obj
78.endif
79.if defined(NOCLEANDIR)
80CLEANDIR=	clean
81.else 
82CLEANDIR=	cleandir
83.endif
84
85world:	directories cleandist mk includes libraries tools mdec
86	@echo "--------------------------------------------------------------"
87	@echo " Rebuilding ${DESTDIR} The whole thing"
88	@echo "--------------------------------------------------------------"
89	@echo
90	${MAKE} depend all install
91	cd ${.CURDIR}/share/man &&		${MAKE} makedb
92
93directories:
94	@echo "--------------------------------------------------------------"
95	@echo " Making directories"
96	@echo "--------------------------------------------------------------"
97	@echo " XXX Not yet ready in 2.0.0"
98# XXX	cd ${.CURDIR}/etc &&			${MAKE} distrib-dirs
99
100cleandist:
101.if !defined(NOCLEANDIR)
102	@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/cc26/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/cc26/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/cc26 && \
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