CC = cc -g
CFLAGS = # idiots....
KCFLAGS = -I. -DIP12 -DECLIPSE -D_KERNEL -g -G 8 -prototypes \
	  -DDEFAULTSEMAMETER=0 -DSPLOCKMETER=0

SYS_INCS = /usr/include/sys/genrcireg.h \
	   /usr/include/sys/rci.h \
	   /usr/include/sys/rciioctl.h \
	   /usr/include/sys/xydreg.h \
	   /usr/include/sys/bitreg.h

CONFS = master.d/genrci \
        master.d/xyd \
	master.d/bit

OBJS =  boot/xyd.o \
	boot/genrci.o \
	boot/bit.o 

unix.new: system boot master.d $(SYS_INCS) $(CONFS) $(OBJS)
	/usr/sbin/lboot -v -s system

system:
	echo "need to create a 'system' file in this directory"

boot:
	ln -s /usr/sysgen/boot boot

master.d:
	ln -s /usr/sysgen/master.d master.d

/usr/include/sys/genrcireg.h:
	ln -s `pwd`/genrcireg.h /usr/include/sys/genrcireg.h

/usr/include/sys/rci.h:
	ln -s `pwd`/rci.h /usr/include/sys/rci.h

/usr/include/sys/rciioctl.h:
	ln -s `pwd`/rciioctl.h /usr/include/sys/rciioctl.h

/usr/include/sys/xydreg.h:
	ln -s `pwd`/xydreg.h /usr/include/sys/xydreg.h

/usr/include/sys/bitreg.h:
	ln -s `pwd`/bitreg.h /usr/include/sys/bitreg.h

master.d/genrci: master.d master.RCI/genrci
	cp master.RCI/genrci master.d

master.d/bit: master.d master.RCI/bit
	cp master.RCI/bit master.d

master.d/xyd: master.d master.RCI/xyd
	cp master.RCI/xyd master.d

boot/xyd.o: xyd.c
	$(CC) $(KCFLAGS) -c xyd.c; mv xyd.o boot

boot/bit.o: bit.c
	$(CC) $(KCFLAGS) -c bit.c; mv bit.o boot

boot/genrci.o: genrci.c
	$(CC) $(KCFLAGS) -c genrci.c; mv genrci.o boot

# 'pp' is a test program that has nothing to do with the system
pp: pp.o
	$(CC) -o pp pp.o $(TRACE)

# undo all the installation stuff:
clean:
	rm -f $(SYS_INCS) $(CONFS) $(OBJS) boot master.d
