]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - Makefile
Kludge alert!
[FreeBSD/FreeBSD.git] / Makefile
1 #
2 #       $Id: Makefile,v 1.72 1996/01/01 08:33:17 peter 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 #       -DMAKE_EBONES to build eBones (KerberosIV)
9 #
10 #       -DNOCLEANDIR run ${MAKE} clean, instead of ${MAKE} cleandir
11 #       -DNOCLEAN do not clean at all
12 #       -DNOCRYPT will prevent building of crypt versions
13 #       -DNOLKM do not build loadable kernel modules
14 #       -DNOOBJDIR do not run ``${MAKE} obj''
15 #       -DNOPROFILE do not build profiled libraries
16 #       -DNOSECURE do not go into secure subdir
17
18 # Put initial settings here.
19 SUBDIR=
20
21 # We must do include and lib first so that the perl *.ph generation
22 # works correctly as it uses the header files installed by this.
23 .if exists(include)
24 SUBDIR+= include
25 .endif
26 .if exists(lib)
27 SUBDIR+= lib
28 .endif
29
30 .if exists(bin)
31 SUBDIR+= bin
32 .endif
33 .if exists(contrib)
34 SUBDIR+= contrib
35 .endif
36 .if exists(games)
37 SUBDIR+= games
38 .endif
39 .if exists(gnu)
40 SUBDIR+= gnu
41 .endif
42 .if exists(eBones) && !defined(NOCRYPT) && defined(MAKE_EBONES)
43 SUBDIR+= eBones
44 .endif
45 .if exists(libexec)
46 SUBDIR+= libexec
47 .endif
48 .if exists(sbin)
49 SUBDIR+= sbin
50 .endif
51 .if exists(share)
52 SUBDIR+= share
53 .endif
54 .if exists(sys)
55 SUBDIR+= sys
56 .endif
57 .if exists(usr.bin)
58 SUBDIR+= usr.bin
59 .endif
60 .if exists(usr.sbin)
61 SUBDIR+= usr.sbin
62 .endif
63 .if exists(secure) && !defined(NOCRYPT) && !defined(NOSECURE)
64 SUBDIR+= secure
65 .endif
66 .if exists(lkm) && !defined(NOLKM)
67 SUBDIR+= lkm
68 .endif
69
70 # etc must be last for "distribute" to work
71 .if exists(etc) && make(distribute)
72 SUBDIR+= etc
73 .endif
74
75 # These are last, since it is nice to at least get the base system
76 # rebuilt before you do them.
77 .if defined(MAKE_LOCAL) & exists(local) & exists(local/Makefile)
78 SUBDIR+= local
79 .endif
80 .if defined(MAKE_PORTS) & exists(ports) & exists(ports/Makefile)
81 SUBDIR+= ports
82 .endif
83
84 # Handle the -DNOOBJDIR and -DNOCLEANDIR
85 .if defined(NOOBJDIR)
86 OBJDIR=
87 .else
88 OBJDIR=         obj
89 .endif
90
91 .if defined(NOCLEAN)
92 CLEANDIR=
93 WORLD_CLEANDIST=obj
94 .else
95 WORLD_CLEANDIST=cleandist
96 .if defined(NOCLEANDIR)
97 CLEANDIR=       clean
98 .else
99 CLEANDIR=       cleandir
100 .endif
101 .endif
102
103 world:  hierarchy mk $(WORLD_CLEANDIST) includes lib-tools libraries build-tools
104         @echo "--------------------------------------------------------------"
105         @echo " Rebuilding ${DESTDIR} The whole thing"
106         @echo "--------------------------------------------------------------"
107         @echo
108         ${MAKE} depend all install
109         cd ${.CURDIR}/share/man &&              ${MAKE} makedb
110
111 reinstall:      hierarchy mk includes
112         @echo "--------------------------------------------------------------"
113         @echo " Reinstall ${DESTDIR} The whole thing"
114         @echo "--------------------------------------------------------------"
115         @echo
116         ${MAKE} install
117         cd ${.CURDIR}/share/man &&              ${MAKE} makedb
118
119 hierarchy:
120         @echo "--------------------------------------------------------------"
121         @echo " Making hierarchy"
122         @echo "--------------------------------------------------------------"
123         cd ${.CURDIR}/etc &&            ${MAKE} distrib-dirs
124
125 update:
126 .if defined(SUP_UPDATE)
127         @echo "--------------------------------------------------------------"
128         @echo "Running sup"
129         @echo "--------------------------------------------------------------"
130         @sup -v ${SUPFILE}
131 .if defined(SUPFILE1)
132         @sup -v ${SUPFILE1}
133 .endif
134 .if defined(SUPFILE2)
135         @sup -v ${SUPFILE2}
136 .endif
137 .endif
138 .if defined(CVS_UPDATE)
139         @echo "--------------------------------------------------------------"
140         @echo "Updating /usr/src from cvs repository" ${CVSROOT}
141         @echo "--------------------------------------------------------------"
142         cd ${.CURDIR} &&  cvs update -P -d
143 .endif
144
145 cleandist:
146 .if !defined(NOCLEANDIR)
147         @echo "--------------------------------------------------------------"
148         @echo " Cleaning up the source tree, and rebuilding the obj tree"
149         @echo "--------------------------------------------------------------"
150         @echo
151         here=`pwd`; dest=/usr/obj`echo $$here | sed 's,^/usr/src,,'`; \
152         if test -d /usr/obj -a ! -d $$dest; then \
153                 mkdir -p $$dest; \
154         else \
155                 true; \
156         fi; \
157         cd $$dest && rm -rf ${SUBDIR}
158         find . -name obj | xargs rm -rf
159 .if defined(MAKE_LOCAL) & exists(local) & exists(local/Makefile)
160         # The cd is done as local may well be a symbolic link
161         -cd local && find . -name obj | xargs rm -rf
162 .endif
163 .if defined(MAKE_PORTS) & exists(ports) & exists(ports/Makefile)
164         # The cd is done as local may well be a symbolic link
165         -cd ports && find . -name obj | xargs rm -rf
166 .endif
167         ${MAKE} cleandir
168         ${MAKE} obj
169 .endif
170
171 installmost:
172         @echo "--------------------------------------------------------------"
173         @echo " Installing programs only"
174         @echo "--------------------------------------------------------------"
175         cd ${.CURDIR}/bin       &&      ${MAKE} ${.MAKEFLAGS} install
176         cd ${.CURDIR}/sbin      &&      ${MAKE} ${.MAKEFLAGS} install
177         cd ${.CURDIR}/libexec   &&      ${MAKE} ${.MAKEFLAGS} install
178         cd ${.CURDIR}/usr.bin   &&      ${MAKE} ${.MAKEFLAGS} install
179         cd ${.CURDIR}/usr.sbin  &&      ${MAKE} ${.MAKEFLAGS} install
180         cd ${.CURDIR}/gnu/libexec &&    ${MAKE} ${.MAKEFLAGS} install
181         cd ${.CURDIR}/gnu/usr.bin &&    ${MAKE} ${.MAKEFLAGS} install
182         cd ${.CURDIR}/gnu/usr.sbin &&   ${MAKE} ${.MAKEFLAGS} install
183 #.if defined(MAKE_EBONES) && !defined(NOCRYPT)
184 #       cd ${.CURDIR}/eBones    &&      ${MAKE} ${.MAKEFLAGS} installmost
185 #.endif
186 #.if !defined(NOSECURE) && !defined(NOCRYPT)
187 #       cd ${.CURDIR}/secure    &&      ${MAKE} ${.MAKEFLAGS} installmost
188 #.endif
189
190 most:
191         @echo "--------------------------------------------------------------"
192         @echo " Building programs only"
193         @echo "--------------------------------------------------------------"
194         cd ${.CURDIR}/bin       &&      ${MAKE} ${.MAKEFLAGS} all
195         cd ${.CURDIR}/sbin      &&      ${MAKE} ${.MAKEFLAGS} all
196         cd ${.CURDIR}/libexec   &&      ${MAKE} ${.MAKEFLAGS} all
197         cd ${.CURDIR}/usr.bin   &&      ${MAKE} ${.MAKEFLAGS} all
198         cd ${.CURDIR}/usr.sbin  &&      ${MAKE} ${.MAKEFLAGS} all
199         cd ${.CURDIR}/gnu/libexec &&    ${MAKE} ${.MAKEFLAGS} all
200         cd ${.CURDIR}/gnu/usr.bin &&    ${MAKE} ${.MAKEFLAGS} all
201         cd ${.CURDIR}/gnu/usr.sbin &&   ${MAKE} ${.MAKEFLAGS} all
202 #.if defined(MAKE_EBONES) && !defined(NOCRYPT)
203 #       cd ${.CURDIR}/eBones    &&      ${MAKE} ${.MAKEFLAGS} most
204 #.endif
205 #.if !defined(NOSECURE) && !defined(NOCRYPT)
206 #       cd ${.CURDIR}/secure    &&      ${MAKE} ${.MAKEFLAGS} most
207 #.endif
208
209 mk:
210         @echo "--------------------------------------------------------------"
211         @echo " Rebuilding ${DESTDIR}/usr/share/mk"
212         @echo "--------------------------------------------------------------"
213         cd ${.CURDIR}/share/mk &&               ${MAKE} install
214
215 includes: include-tools
216         @echo "--------------------------------------------------------------"
217         @echo " Rebuilding ${DESTDIR}/usr/include"
218         @echo "--------------------------------------------------------------"
219         @echo
220 .if defined(CLOBBER)
221         rm -rf ${DESTDIR}/usr/include/*
222         mtree -deU -f ${.CURDIR}/etc/mtree/BSD.include.dist \
223                 -p ${DESTDIR}/usr/include
224 .endif
225         cd ${.CURDIR}/include &&                ${MAKE} install
226         cd ${.CURDIR}/gnu/include &&            ${MAKE} install
227         cd ${.CURDIR}/gnu/lib/libreadline &&    ${MAKE} beforeinstall
228         cd ${.CURDIR}/gnu/lib/libregex &&       ${MAKE} beforeinstall
229         cd ${.CURDIR}/gnu/lib/libg++ &&         ${MAKE} beforeinstall
230         cd ${.CURDIR}/gnu/lib/libdialog &&      ${MAKE} beforeinstall
231 .if exists(eBones) && !defined(NOCRYPT) && defined(MAKE_EBONES)
232         cd ${.CURDIR}/eBones/include &&         ${MAKE} beforeinstall
233         cd ${.CURDIR}/eBones/lib/libkrb &&      ${MAKE} beforeinstall
234         cd ${.CURDIR}/eBones/lib/libkadm &&     ${MAKE} beforeinstall
235 .endif
236         cd ${.CURDIR}/lib/libc &&               ${MAKE} beforeinstall
237         cd ${.CURDIR}/lib/libcurses &&          ${MAKE} beforeinstall
238         cd ${.CURDIR}/lib/libedit &&            ${MAKE} beforeinstall
239         cd ${.CURDIR}/lib/libmd &&              ${MAKE} beforeinstall
240         cd ${.CURDIR}/lib/libmytinfo &&         ${MAKE} beforeinstall
241         cd ${.CURDIR}/lib/libncurses &&         ${MAKE} beforeinstall
242 .if !defined(WANT_CSRG_LIBM)
243         cd ${.CURDIR}/lib/msun &&               ${MAKE} beforeinstall
244 .endif
245         cd ${.CURDIR}/lib/libpcap &&            ${MAKE} beforeinstall
246         cd ${.CURDIR}/lib/librpcsvc &&          ${MAKE} beforeinstall
247         cd ${.CURDIR}/lib/libskey &&            ${MAKE} beforeinstall
248         cd ${.CURDIR}/lib/libtermcap &&         ${MAKE} beforeinstall
249         cd ${.CURDIR}/lib/libcom_err &&         ${MAKE} beforeinstall
250         cd ${.CURDIR}/lib/libss &&              ${MAKE} beforeinstall
251         cd ${.CURDIR}/lib/libforms &&           ${MAKE} beforeinstall
252         cd ${.CURDIR}/lib/libscsi &&            ${MAKE} beforeinstall
253         cd ${.CURDIR}/lib/libutil &&            ${MAKE} beforeinstall
254
255 lib-tools:
256         @echo "--------------------------------------------------------------"
257         @echo " Rebuilding tools needed to build the libraries"
258         @echo "--------------------------------------------------------------"
259         @echo
260         cd ${.CURDIR}/usr.bin/xinstall && \
261                 ${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
262         cd ${.CURDIR}/gnu/usr.bin/ld && \
263                 ${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
264         cd ${.CURDIR}/usr.bin/ar && \
265                 ${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
266         cd ${.CURDIR}/usr.bin/ranlib && \
267                 ${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
268         cd ${.CURDIR}/usr.bin/nm && \
269                 ${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
270         cd ${.CURDIR}/usr.bin/lex/lib && \
271                 ${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
272         cd ${.CURDIR}/usr.bin/compile_et && \
273                 ${MAKE} depend all install ${CLEANDIR} ${OBJDIR} && \
274                 rm -f /usr/sbin/compile_et
275         cd ${.CURDIR}/usr.bin/mk_cmds && \
276                 ${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
277
278 libraries:
279         @echo "--------------------------------------------------------------"
280         @echo " Rebuilding ${DESTDIR}/usr/lib"
281         @echo "--------------------------------------------------------------"
282         @echo
283 .if defined(CLOBBER)
284         find ${DESTDIR}/usr/lib \! -name '*.s[ao].*' -a \! -type d | \
285                 xargs rm -rf
286 .endif
287 .if exists(lib/libcompat)
288         cd ${.CURDIR}/lib/libcompat && \
289                 ${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
290 .endif
291 .if exists(lib/libncurses)
292         cd ${.CURDIR}/lib/libncurses && \
293                 ${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
294 .endif
295 .if exists(lib/libtermcap)
296         cd ${.CURDIR}/lib/libtermcap && \
297                 ${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
298 .endif
299 .if exists(gnu)
300         cd ${.CURDIR}/gnu/lib && \
301                 ${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
302         cd ${.CURDIR}/gnu/usr.bin/cc/libgcc && \
303                 ${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
304 .endif
305 .if exists(secure) && !defined(NOCRYPT) && !defined(NOSECURE)
306         cd ${.CURDIR}/secure/lib && \
307                 ${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
308 .endif
309 .if exists(lib)
310         cd ${.CURDIR}/lib/csu/i386 && \
311                 ${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
312         cd ${.CURDIR}/lib && \
313                 ${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
314 .endif
315 .if exists(usr.sbin/lex/lib)
316         cd ${.CURDIR}/usr.bin/lex/lib && \
317                 ${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
318 .endif
319 .if exists(eBones) && !defined(NOCRYPT) && defined(MAKE_EBONES)
320         cd ${.CURDIR}/eBones/des && \
321                 ${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
322         cd ${.CURDIR}/eBones/lib && \
323                 ${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
324 .endif
325 .if exists(usr.sbin/pcvt/keycap)
326         cd ${.CURDIR}/usr.sbin/pcvt/keycap && \
327                 ${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
328 .endif
329
330 include-tools:
331         @echo "--------------------------------------------------------------"
332         @echo " Rebuild tools necessary to build the include files"
333         @echo "--------------------------------------------------------------"
334         @echo
335         cd ${.CURDIR}/usr.bin/rpcgen && \
336                 ${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
337
338 build-tools:
339         @echo "--------------------------------------------------------------"
340         @echo " Rebuilding ${DESTDIR} C compiler, make, symorder, sgmlfmt and zic(8)"
341         @echo "--------------------------------------------------------------"
342         @echo
343         cd ${.CURDIR}/gnu/usr.bin/cc && \
344                 ${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
345         cd ${.CURDIR}/usr.bin/make && \
346                 ${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
347         cd ${.CURDIR}/usr.bin/symorder && \
348                 ${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
349         cd ${.CURDIR}/usr.bin/sgmlfmt && \
350                 ${MAKE} depend all install ${CLEANDIR} ${OBJDIR} 
351         cd ${.CURDIR}/share/sgml && \
352                 ${MAKE} depend all install ${CLEANDIR} ${OBJDIR} 
353         cd ${.CURDIR}/usr.sbin/zic && \
354                 ${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
355
356 .include <bsd.subdir.mk>