# $Id: Makefile,v 1.12 1999/12/19 17:17:43 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 \
			/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

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

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

install-etc:
	${INSTALL} -c -o ${BINOWN} -g ${BINGRP} -m 0644 \
	    etc/rc.pccard etc/etc.i386/disktab /etc/
	${INSTALL} -c -o ${BINOWN} -g ${BINGRP} -m 0755 \
	    etc/pccard_ether etc/pccard_ether_remove etc/pccard_scsi /etc/
	${INSTALL} -c -o ${BINOWN} -g ${BINGRP} -m 0644 \
	    etc/pccard.conf.sample /etc/pccard.conf
	${INSTALL} -c -o ${BINOWN} -g ${BINGRP} -m 0644 \
	    etc/defaults/rc.conf /etc/defaults/
	${INSTALL} -c -o ${BINOWN} -g ${BINGRP} -m 0755 \
	    etc/etc.i386/MAKEDEV /dev/

clean:
	(cd $(.CURDIR)/usr.sbin; make SYS=$(SYS) clean)
	rm -f *~
