1#	$NetBSD$
2
3.include <bsd.own.mk>
4
5.if ${MKUPDATE} == "no" && !defined(NOCLEANDIR)
6BUILDTARGETS+=  cleandir
7.endif
8.if ${MKOBJDIRS} != "no"
9BUILDTARGETS+=  obj
10.endif
11BUILDTARGETS+=	do-tools
12.if !defined(NOINCLUDES)
13BUILDTARGETS+=	includes
14.endif
15BUILDTARGETS+=	do-lib
16BUILDTARGETS+=	do-build
17
18.ORDER: ${BUILDTARGETS}
19
20START_TIME!=	date
21
22build: check_EXTSRCSRCDIR
23	@echo "extsrc build started at: ${START_TIME}"
24.for tgt in ${BUILDTARGETS}
25	${MAKEDIRTARGET} . ${tgt}
26.endfor
27	@echo   "extsrc build started at:  ${START_TIME}"
28	@printf "extsrc build finished at: " && date
29
30do-build:
31.for targ in dependall install
32	${MAKEDIRTARGET} . ${targ}
33.endfor
34
35do-tools:
36.for dir in	${SUBDIR_TOOLS}
37	${MAKEDIRTARGET} . do-${dir:S/\//-/g}
38.endfor
39
40do-lib:
41.for dir in	${SUBDIR_LIB}
42	${MAKEDIRTARGET} . do-${dir:S/\//-/g}
43.endfor
44
45.for dir in	${SUBDIR_TOOLS} ${SUBDIR_LIB}
46do-${dir:S/\//-/g}:
47.  for targ in dependall install
48	${MAKEDIRTARGET} ${dir} ${targ}
49.  endfor
50.endfor
51
52afterinstall: .PHONY
53.if ${MKMAN} != "no"
54	${MAKEDIRTARGET} ${NETBSDSRCDIR}/share/man makedb \
55	    WHATISDBDIR=${EXTSRCMANDIR}
56.endif
57
58# XXX how to decide this?
59
60DISTRIBTARGETS=	# XXX
61
62distribution: check_EXTSRCSRCDIR
63.for tgt in ${DISTRIBTARGETS}
64	${MAKEDIRTARGET} ${tgt} configinstall
65.endfor
66
67
68check_EXTSRCSRCDIR: .PHONY .NOTMAIN
69.if !defined(EXTSRCSRCDIR)
70	@echo
71	@echo "ERROR: setenv EXTSRCSRCDIR before doing that!"
72	@false
73.else
74	@true
75.endif
76
77.include <bsd.subdir.mk>
78