187866Ssheldonh#	$Id: Makefile,v 1.12 2001/04/16 04:34:26 bp Exp $
287866Ssheldonh#
387866Ssheldonh#	Valid targets:
487866Ssheldonh#	install		installs binaries and man pages
587866Ssheldonh#	deinstall	undo install (except man pages)
687866Ssheldonh#	install-src	copy .h files in /usr/local/include
787866Ssheldonh#	install-lib	copy lib files in /usr/lib
887866Ssheldonh#	deinstall-lib,
987866Ssheldonh#	deinstall-src	undo corresponding install-* target
1087866Ssheldonh#	clean		cleanup source tree
1187866Ssheldonh
1287866Ssheldonh.if ${MACHINE_ARCH} != "i386"
1387866Ssheldonh.	error "only IA32 machines supported"
1487866Ssheldonh.endif
1587866Ssheldonh
1687866SsheldonhCONFIG_INT?=	config.int
1787866SsheldonhCONFIG_MK?=	config.mk
1887866Ssheldonh
1987866SsheldonhCFGDEPEND=
2087866Ssheldonh
2187866Ssheldonh.ifmake !configure && !clean
2287866Ssheldonh.  if !exists(${CONFIG_INT})
2387866Ssheldonh.	error "Run 'make configure' before build"
2487866Ssheldonh.  else
2587866Ssheldonh.	include "${CONFIG_INT}"
2687866Ssheldonh.  endif
2787866Ssheldonh.else
2887866Ssheldonh.  if exists(${CONFIG_MK})
2987866SsheldonhCFGDEPEND=	${CONFIG_MK}
3087866Ssheldonh
3187866Ssheldonh${CONFIG_MK}:	config.mk.in
3287866Ssheldonh	@echo Your ${CONFIG_MK} file is older than the config.mk.in file
3387866Ssheldonh	@echo Please check for possible changes
3487866Ssheldonh	@false
3587866Ssheldonh
3687866Ssheldonh.	include "${CONFIG_MK}"
3787866Ssheldonh.  endif
3887866Ssheldonh.endif
3987866Ssheldonh
4087866SsheldonhBUILDKLD?=yes
4187866SsheldonhPREFIX?=/usr/local
4287866SsheldonhSYSDIR?=/usr/src/sys
4387866Ssheldonh
4487866Ssheldonhconfigure::
4587866Ssheldonh.if ${CFGDEPEND} == ${CONFIG_MK}
4687866Ssheldonh	@echo Using ${CFGDEPEND} file...
4787866Ssheldonh.endif
4887866Ssheldonh	echo PREFIX= ${PREFIX} > ${CONFIG_INT}
4987866Ssheldonh	echo SYSDIR=${SYSDIR} >> ${CONFIG_INT}
5087866Ssheldonh	echo KMODDIR=${KMODDIR} >> ${CONFIG_INT}
5187866Ssheldonh	echo SINGLEKLD=yes >> ${CONFIG_INT}
5287866Ssheldonh.if !defined(WITHOUT_CRYPT)
5387866Ssheldonh	echo ENCRYPTED_PASSWD=yes >> ${CONFIG_INT}
5487866Ssheldonh.endif
5587866Ssheldonh.if defined(SMP_SUPPORT) || defined(SMP)
5687866Ssheldonh	echo SMP=yes >> ${CONFIG_INT}
5787866Ssheldonh.endif
5887866Ssheldonh
5987866SsheldonhSUBDIR=
6087866Ssheldonh
6187866Ssheldonh.if defined(COMPLETEBUILD) || (${BUILDKLD} == yes && !exists(${SYSDIR}/netsmb/smb.h))
6287866SsheldonhSUBDIR+= kernel/modules
6387866Ssheldonh.endif
6487866Ssheldonh
6587866SsheldonhSUBDIR+= lib
6687866Ssheldonh
6787866SsheldonhSUBDIR+= mount_smbfs smbutil
6887866Ssheldonh
6987866Ssheldonhinstall-src install-lib deinstall-lib deinstall-src:
7087866Ssheldonh	cd kernel && make ${.TARGET}
7187866Ssheldonh	cd lib && make ${.TARGET}
7287866Ssheldonh
7387866Ssheldonh
7487866Ssheldonhmakedev:
7587866Ssheldonh	@-( if [ `mount -t devfs | wc -l` = 0 ]; then \
7687866Ssheldonh		cd /dev && && rm -f nsmb* && mknod nsmb0 c 144 0; \
7787866Ssheldonh	    else \
7887866Ssheldonh		echo This operation is not required with devfs; \
7987866Ssheldonh	    fi; \
8087866Ssheldonh	)
8187866Ssheldonh
8287866Ssheldonhcleandepend deinstall: _SUBDIRUSE
8387866Ssheldonh
8487866Ssheldonhclean: _SUBDIRUSE
8587866Ssheldonh	rm -f ${CONFIG_INT}
8687866Ssheldonh
8787866Ssheldonh.include <bsd.subdir.mk>
88