# $Id: Makefile,v 1.8 1999/09/26 08:34:59 toshi Exp $

# 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 xf -)

patch:
	cd $(SYS) && patch -p3 -E < $(.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 \
			if_wavelan_ieee.h /usr/include/machine
	rm -f /usr/include/pccard/*.h
	cp -p $(SYS)/pccard/*.h /usr/include/pccard

devices:
	cd /dev && sh MAKEDEV card0 card1 card2 card3 apm
	cd /dev && mknod apmctl c 39 8

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

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

install-etc:
	cp etc/rc.* etc/pccard_ether* /etc
	chmod +x /etc/pccard_ether /etc/pccard_ether_remove
	cp etc/pccard.conf.sample /etc/pccard.conf
	cp etc/defaults/rc.conf /etc/defaults

clean:
	rm -f *~
