# MAKEFILE (in each subdir of SRC\)
# built by concatenating MAKE[123].ADD (in LIB\)
# LIBFILE from file LIBFILE (in each subdir)
# OBJS and dependency information collected by makemake program

# the latter also makes xmodules and xbldlib

# this makefile adds OBJS to relevant LIB if $(UPDATE) defined

# The env var L3XCOPTS can be set to additional C compiler flags, defines ...

!include ..\..\lib\config.mk


LIBFILE = xkernel.lib

.c.obj:
	$(CC) -c $(CFLAGS) -I$(H) $<
!ifdef UPDATE
	$(LIB) $(L)\$(LIBFILE) $(LIBFLAGS) -+$*
!endif

.asm.obj:
	$(ASM) $*;
!ifdef UPDATE
	$(LIB) $(L)\$(LIBFILE) $(LIBFLAGS) -+$*
!endif

.c.asm:
	$(CC) -S $(CFLAGS) -I$(H) $<
	rename $*.asm $*.log

OBJS = cbrkint.obj chprio.obj clkint.obj conf.obj create.obj ctxsw.obj \
die.obj eidi.obj freemem.obj getitem.obj getmem.obj getnok.obj getpid.obj \
getprio.obj initiali.obj insert.obj intmap.obj isownstk.obj kill.obj map.obj \
nullfun.obj panic.obj queue.obj ready.obj receive.obj recvclr.obj resched.obj \
resume.obj scount.obj screate.obj sdelete.obj send.obj sendf.obj sendn.obj \
setnok.obj signal.obj signaln.obj sreset.obj stack.obj suspend.obj \
userret.obj wait.obj xdone.obj xeidi.obj 

update:
	@make -DUPDATE all

all: $(OBJS)

objs: all

lib: all
 	$(LIB) $(L)\$(LIBFILE) $(LIBFLAGS) @xbldlib

clean:
	del *.obj

make:
	makemake

xref:
	objxref @xmodules


cbrkint.obj: $(H)\butler.h $(H)\conf.h $(H)\kernel.h $(H)\xtypes.h cbrkint.c
chprio.obj: $(H)\conf.h $(H)\kernel.h $(H)\xtypes.h $(H)\proc.h chprio.c
clkint.obj: $(H)\conf.h $(H)\io.h $(H)\kernel.h $(H)\xtypes.h $(H)\proc.h $(H)\q.h $(H)\sleep.h clkint.c
conf.obj: $(H)\conf.h $(H)\pc.h conf.c
create.obj: $(H)\conf.h $(H)\dos.h $(H)\xtypes.h $(H)\io.h $(H)\kernel.h $(H)\xtypes.h $(H)\mem.h $(H)\xtypes.h $(H)\proc.h create.c
ctxsw.obj: ..\h\dos.asm ctxsw.asm
die.obj: $(H)\conf.h $(H)\dos.h $(H)\xtypes.h $(H)\io.h $(H)\kernel.h $(H)\xtypes.h $(H)\mem.h $(H)\xtypes.h $(H)\proc.h $(H)\sem.h die.c
eidi.obj: ..\h\dos.asm eidi.asm
freemem.obj: $(H)\conf.h $(H)\dos.h $(H)\xtypes.h $(H)\kernel.h $(H)\xtypes.h $(H)\mem.h $(H)\xtypes.h freemem.c
getitem.obj: $(H)\conf.h $(H)\kernel.h $(H)\xtypes.h $(H)\q.h getitem.c
getmem.obj: $(H)\conf.h $(H)\dos.h $(H)\xtypes.h $(H)\kernel.h $(H)\xtypes.h $(H)\mem.h $(H)\xtypes.h getmem.c
getnok.obj: $(H)\conf.h $(H)\kernel.h $(H)\xtypes.h $(H)\proc.h getnok.c
getpid.obj: $(H)\conf.h $(H)\kernel.h $(H)\xtypes.h $(H)\proc.h getpid.c
getprio.obj: $(H)\conf.h $(H)\kernel.h $(H)\xtypes.h $(H)\proc.h getprio.c
initiali.obj: $(H)\bufpool.h $(H)\mark.h $(H)\butler.h $(H)\conf.h $(H)\dos.h $(H)\xtypes.h $(H)\io.h $(H)\kbdio.h $(H)\kernel.h $(H)\xtypes.h $(H)\mark.h $(H)\mem.h $(H)\xtypes.h $(H)\mffile.h $(H)\pc.h $(H)\proc.h $(H)\q.h $(H)\sem.h $(H)\shell.h $(H)\tty.h $(H)\window.h initiali.c
insert.obj: $(H)\conf.h $(H)\kernel.h $(H)\xtypes.h $(H)\q.h insert.c
intmap.obj: ..\h\dos.asm intmap.asm
isownstk.obj: $(H)\conf.h $(H)\dos.h $(H)\xtypes.h $(H)\io.h $(H)\kernel.h $(H)\xtypes.h $(H)\proc.h isownstk.c
kill.obj: $(H)\conf.h $(H)\dos.h $(H)\xtypes.h $(H)\kernel.h $(H)\xtypes.h $(H)\proc.h $(H)\q.h $(H)\sem.h kill.c
map.obj: $(H)\conf.h $(H)\dos.h $(H)\xtypes.h $(H)\io.h $(H)\kernel.h $(H)\xtypes.h map.c
nullfun.obj: $(H)\kernel.h $(H)\xtypes.h nullfun.c
panic.obj: $(H)\conf.h $(H)\dos.h $(H)\xtypes.h $(H)\io.h $(H)\kernel.h $(H)\xtypes.h $(H)\pc.h $(H)\proc.h $(H)\tty.h $(H)\window.h $(H)\xtypes.h panic.c
queue.obj: $(H)\conf.h $(H)\kernel.h $(H)\xtypes.h $(H)\q.h queue.c
ready.obj: $(H)\conf.h $(H)\kernel.h $(H)\xtypes.h $(H)\proc.h $(H)\q.h ready.c
receive.obj: $(H)\conf.h $(H)\kernel.h $(H)\xtypes.h $(H)\proc.h receive.c
recvclr.obj: $(H)\conf.h $(H)\kernel.h $(H)\xtypes.h $(H)\proc.h recvclr.c
resched.obj: $(H)\conf.h $(H)\dos.h $(H)\xtypes.h $(H)\kernel.h $(H)\xtypes.h $(H)\proc.h $(H)\q.h $(H)\sleep.h resched.c
resume.obj: $(H)\conf.h $(H)\kernel.h $(H)\xtypes.h $(H)\proc.h resume.c
scount.obj: $(H)\conf.h $(H)\kernel.h $(H)\xtypes.h $(H)\sem.h scount.c
screate.obj: $(H)\conf.h $(H)\kernel.h $(H)\xtypes.h $(H)\proc.h $(H)\q.h $(H)\sem.h screate.c
sdelete.obj: $(H)\conf.h $(H)\kernel.h $(H)\xtypes.h $(H)\proc.h $(H)\q.h $(H)\sem.h sdelete.c
send.obj: $(H)\conf.h $(H)\kernel.h $(H)\xtypes.h $(H)\proc.h send.c
sendf.obj: $(H)\conf.h $(H)\kernel.h $(H)\xtypes.h $(H)\proc.h sendf.c
sendn.obj: $(H)\conf.h $(H)\kernel.h $(H)\xtypes.h $(H)\proc.h sendn.c
setnok.obj: $(H)\conf.h $(H)\kernel.h $(H)\xtypes.h $(H)\proc.h setnok.c
signal.obj: $(H)\conf.h $(H)\kernel.h $(H)\xtypes.h $(H)\proc.h $(H)\q.h $(H)\sem.h signal.c
signaln.obj: $(H)\conf.h $(H)\kernel.h $(H)\xtypes.h $(H)\proc.h $(H)\q.h $(H)\sem.h signaln.c
sreset.obj: $(H)\conf.h $(H)\kernel.h $(H)\xtypes.h $(H)\proc.h $(H)\q.h $(H)\sem.h sreset.c
stack.obj: ..\h\dos.asm stack.asm
suspend.obj: $(H)\conf.h $(H)\kernel.h $(H)\xtypes.h $(H)\proc.h $(H)\q.h suspend.c
userret.obj: $(H)\conf.h $(H)\kernel.h $(H)\xtypes.h userret.c
wait.obj: $(H)\conf.h $(H)\kernel.h $(H)\xtypes.h $(H)\proc.h $(H)\q.h $(H)\sem.h wait.c
xdone.obj: $(H)\conf.h $(H)\disk.h $(H)\dir.h $(H)\iblock.h $(H)\io.h $(H)\kernel.h $(H)\xtypes.h $(H)\proc.h $(H)\q.h $(H)\tty.h $(H)\window.h xdone.c
xeidi.obj: ..\h\dos.asm xeidi.asm
