# $Id:$

# SRC should be used only in 'backup-sys'.
# otherwise we will not be able to override SYS.
SRC=	/usr/src
SYS=	$(SRC)/sys

# safety sentinel
.TARGET:	msg

msg:
	@echo "welcome to PAO world!  read documents first."

all: kernel userland

kernel: backup-sys patch install-include

userland: devices tools install-tools

backup-sys:
	-cd $(SRC) && mkdir -p sys.ORG
	cd $(SRC)/sys.ORG && ((chdir ../sys ; tar cf - .) | tar xvf -)

patch:
	cd $(SYS) && patch -p1 < $(.CURDIR)/sys/sys-pao.diff

install-include:
	cd $(SYS)/i386/include && \
		cp -p apm_bios.h clock.h cpu.h if_cnwioctl.h scc.h wavelan.h \
			/usr/include/machine
	cp -p $(SYS)/pccard/*.h /usr/include/pccard

devices:
	cd /dev && sh MAKEDEV card0 card1 card2 card3 apm

tools:
	(cd $(.CURDIR)/sbin; make )
	(cd $(.CURDIR)/usr.sbin; make )

install-tools: tools
	(cd $(.CURDIR)/sbin; make install)
	(cd $(.CURDIR)/usr.sbin; make install)

install-etc:
	cp etc/rc.pccard etc/pccard_ether* /etc
	cp etc/pccard.conf.sample /etc/pccard.conf
	cp etc/defaults/rc.conf /etc/defaults/rc.conf

clean:
	rm -f *~
