# WARNING: DO NOT EDIT.
# THIS FILE WAS AUTOMATICALLY GENERATED USING THE
# BUILDMAKE PROGRAM.

#
# Makefile for V kernel
# Main directory
# Tim Mann, April 5, 1982
# 

DIRS = mi m68k

HOST= m68k
MDNETOBJECTS=$(MD3MEGOBJECTS)

MDOBJECTS= $(HOST)/config.b $(HOST)/machine.b $(HOST)/serial.b \
	   $(HOST)/timer.b $(HOST)/trap.b $(HOST)/memory.b \
	   $(HOST)/exception.b $(HOST)/console.b \
	   $(HOST)/cbuff.b $(HOST)/mice.b $(HOST)/smimouse.b

MIOBJECTS= mi/bpi.b mi/dm.b mi/kp.b mi/naming.b \
           mi/pm.b mi/time.b mi/mouse.b \
	   mi/ikc.b mi/init.b mi/ipc.b


MD3MEGOBJECTS= $(HOST)/ether3meg.b
MD10MEGOBJECTS= $(HOST)/ether10meg.b

C68FLAGS =  -DMC68000 -O

# first, define the world of 68000s
.SUFFIXES: .b .ls .a68 .c

# how to compile a 68000 file
.c.b:
	cc68 $(C68FLAGS) -c $*.c 

# how to make an assembly file (Not deleting it or assembling it)
.c.s:
	cc68 $(C68FLAGS) -S $*.c

# how to make an assembly listing
.c.ls:
	cc68 $(C68FLAGS) -c -L $*.c

#END of the world of 68000's

# compile everything that needs it
all: mistuff m68kstuff Vkernel.r

mistuff:
	cd mi ; make

m68kstuff:
	cd m68k ; make

# Update the downloadable kernel image (byte-reversed)
#  .68 is the default extension for rev68
Vkernel.r: Vkernel.68
	rev68 Vkernel Vkernel.r

# Update the unreversed version
Vkernel.68: $(MDOBJECTS) $(MIOBJECTS) $(MDNETOBJECTS)
	ld68 -e Init_kernel -o Vkernel.68 -s \
		$(MDOBJECTS) $(MIOBJECTS) $(MDNETOBJECTS) -lc
	rm -f symbols

symbols: Vkernel.68
	ld68 -e Init_kernel -o foo -X \
		$(MDOBJECTS) $(MIOBJECTS) $(MDNETOBJECTS) -lc
	nm68 -n -h foo | grep -v " a " >symbols
	rm foo

clean:
	rm -f *.o *.b *.s *.ls *.BAK *.CKP .emacs* .netupd*
	rm -f Vkernel.* symbols
	domake "$(DIRS)" "make clean"

install: all
	netinstall "Vkernel.r" /usr/sun/bootfile

backup:
	cd ..; cpdir kernel ../Vbackup/kernel

build:
	buildmake.sh
	domake "$(DIRS)" "make build"

xbuild:
	buildmake.sh -DX=1
	domake "$(DIRS)" "make xbuild"
