Makefile revision 2279
1#
2#	$Id: Makefile,v 1.11 1994/08/25 10:47:30 paul 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#	-DNOCRYPT will prevent building of crypt versions
10# XXX2	-DNOKERBEROS do not build Kerberos
11#	-DNOOBJDIR do not run ``${MAKE} obj''
12#	-DNOPROFILE do not build profiled libraries
13#	-DNOSECURE do not go into secure subdir
14#
15# XXX2	Mandatory, and Kerberos will not build sucessfully yet
16
17# Put initial settings here.
18NOKERBEROS=	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) && !defined(NOKERBEROS)
43SUBDIR+= kerberosIV
44.endif
45.if exists(libexec)
46SUBDIR+= libexec
47.endif
48.if exists(sbin)
49SUBDIR+= sbin
50.endif
51.if exists(secure) && !defined(NOCRYPT) && !defined(NOSECURE)
52SUBDIR+= secure
53.endif
54.if exists(share)
55SUBDIR+= share
56.endif
57.if exists(sys)
58SUBDIR+= sys
59.endif
60.if exists(usr.bin)
61SUBDIR+= usr.bin
62.endif
63.if exists(usr.sbin)
64SUBDIR+= usr.sbin
65.endif
66
67# These are last, since it is nice to at least get the base system
68# rebuilt before you do them.
69.if defined(MAKE_LOCAL) & exists(local) & exists(local/Makefile)
70SUBDIR+= local
71.endif
72.if defined(MAKE_PORTS) & exists(ports) & exists(ports/Makefile)
73SUBDIR+= ports
74.endif
75
76# Handle the -DNOOBJDIR and -DNOCLEANDIR
77.if defined(NOOBJDIR)
78OBJDIR=
79.else
80OBJDIR=		obj
81.endif
82.if defined(NOCLEANDIR)
83CLEANDIR=	clean
84.else 
85CLEANDIR=	cleandir
86.endif
87
88world:	directories cleandist mk includes libraries tools
89	@echo "--------------------------------------------------------------"
90	@echo " Rebuilding ${DESTDIR} The whole thing"
91	@echo "--------------------------------------------------------------"
92	@echo
93	${MAKE} depend all install
94	cd ${.CURDIR}/share/man &&		${MAKE} makedb
95
96directories:
97	@echo "--------------------------------------------------------------"
98	@echo " Making directories"
99	@echo "--------------------------------------------------------------"
100	@echo " XXX Not yet ready in 2.0.0"
101# XXX	cd ${.CURDIR}/etc &&			${MAKE} distrib-dirs
102
103cleandist:
104.if !defined(NOCLEANDIR)
105	@echo "--------------------------------------------------------------"
106	@echo " Cleaning up the source tree, and rebuilding the obj tree"
107	@echo "--------------------------------------------------------------"
108	@echo
109	here=`pwd`; dest=/usr/obj`echo $$here | sed 's,^/usr/src,,'`; \
110	if test -d /usr/obj -a ! -d $$dest; then \
111		mkdir -p $$dest; \
112	else \
113		true; \
114	fi; \
115	cd $$dest && rm -rf ${SUBDIR}
116	find . -name obj | xargs rm -rf
117.if defined(MAKE_LOCAL) & exists(local) & exists(local/Makefile)
118	# The cd is done as local may well be a symbolic link
119	-cd local && find . -name obj | xargs rm -rf
120.endif
121.if defined(MAKE_PORTS) & exists(ports) & exists(ports/Makefile)
122	# The cd is done as local may well be a symbolic link
123	-cd ports && find . -name obj | xargs rm -rf
124.endif
125	${MAKE} cleandir
126	${MAKE} obj
127.endif
128
129mk:
130	@echo "--------------------------------------------------------------"
131	@echo " Rebuilding ${DESTDIR}/usr/share/mk"
132	@echo "--------------------------------------------------------------"
133	cd ${.CURDIR}/share/mk &&		${MAKE} install
134
135includes:
136	@echo "--------------------------------------------------------------"
137	@echo " Rebuilding ${DESTDIR}/usr/include"
138	@echo "--------------------------------------------------------------"
139	@echo
140.if defined(CLOBBER)
141	rm -rf ${DESTDIR}/usr/include
142	mkdir ${DESTDIR}/usr/include
143	chown ${BINOWN}.${BINGRP} ${DESTDIR}/usr/include
144	chmod 755 ${DESTDIR}/usr/include
145.endif
146	cd ${.CURDIR}/include &&		${MAKE} install
147#XXX	cd ${.CURDIR}/gnu/lib/libg++ &&		${MAKE} beforeinstall
148#XXX	cd ${.CURDIR}/gnu/usr.bin/cc/libobjc &&	${MAKE} beforeinstall
149.if !defined(NOCRYPT) && !defined(NOKERBEROS)
150	cd ${.CURDIR}/kerberosIV/include &&	${MAKE} install
151.endif
152	cd ${.CURDIR}/lib/libc &&		${MAKE} beforeinstall
153	cd ${.CURDIR}/lib/libcurses &&		${MAKE} beforeinstall
154	cd ${.CURDIR}/lib/libedit &&		${MAKE} beforeinstall
155	cd ${.CURDIR}/lib/librpcsvc &&		${MAKE} beforeinstall
156
157libraries:
158	@echo "--------------------------------------------------------------"
159	@echo " Rebuilding ${DESTDIR}/usr/lib"
160	@echo "--------------------------------------------------------------"
161	@echo
162.if defined(CLOBBER)
163	find ${DESTDIR}/usr/lib \! -name '*.s[ao].*' -a \! -type d | \
164		xargs rm -rf
165.endif
166	# 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
167#XXX	cd ${.CURDIR}/gnu/lib/libg++ && \
168#XXX		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
169	cd ${.CURDIR}/gnu/lib/libmalloc && \
170		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
171	cd ${.CURDIR}/gnu/lib/libreadline && \
172		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
173	cd ${.CURDIR}/gnu/lib/libregex && \
174		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
175	cd ${.CURDIR}/gnu/usr.bin/cc/libgcc && \
176		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
177.if exists(secure) && !defined(NOCRYPT) && !defined(NOSECURE)
178	cd ${.CURDIR}/secure/lib && \
179		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
180.endif
181.if exists(sys)
182	cd ${.CURDIR}/sys/libkern && \
183		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
184.endif
185.if exists(lib)
186	cd ${.CURDIR}/lib && \
187		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
188.endif
189	# You need the lex lib before you can build kerberosIV
190#XXX	# We don't have lex in the 2.0 tree yet!
191#XXX	cd ${.CURDIR}/usr.bin/lex/lib && \
192#XXX		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
193.if !defined(NOCRYPT) && !defined(NOKERBEROS)
194	cd ${.CURDIR}/kerberosIV/acl && \
195		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
196	cd ${.CURDIR}/kerberosIV/des && \
197		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
198	cd ${.CURDIR}/kerberosIV/kdb && \
199		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
200	cd ${.CURDIR}/kerberosIV/krb && \
201		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
202.endif
203
204tools:
205	@echo "--------------------------------------------------------------"
206	@echo " Rebuilding ${DESTDIR} Compiler and Make"
207	@echo "--------------------------------------------------------------"
208	@echo
209	cd ${.CURDIR}/gnu/usr.bin/cc && \
210		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
211	cd ${.CURDIR}/usr.bin/make && \
212		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
213
214.include <bsd.subdir.mk>
215