# This Makefile contains rules to build files in the system/ directory.

# Name of this component (the directory this file is stored in)
COMP = system

# Source files for this component

# Important system components
S_FILES = startup.S pause.S
C_FILES = initialize.c kprintf.c queue.c

# Files for process control
S_FILES += ctxsw.S
C_FILES += create.c kill.c ready.c resched.c resume.c suspend.c chprio.c getprio.c queue.c getitem.c queinit.c insert.c gettid.c dispatch.c exception.c xdone.c yield.c userret.c

# Files for preemption
S_FILES += clkupdate.S intutils.S intdispatch.S halt.S
C_FILES += clkinit.c clkhandler.c insertd.c sleep.c unsleep.c wakeup.c

# Files for semaphores
C_FILES += semcreate.c semfree.c semcount.c signal.c signaln.c wait.c

# Files for memory management
C_FILES += memget.c memfree.c stkget.c bfpalloc.c bfpfree.c bufget.c buffree.c

# Files for interprocess communication
C_FILES += send.c receive.c recvclr.c recvtime.c

# Files for device drivers
C_FILES += close.c control.c getc.c open.c ioerr.c ionull.c read.c putc.c seek.c write.c getdev.c

# Files for system debugging
S_FILES += debugbreak.S
C_FILES += debug.c

# Add the files to the compile source path
DIR = ${TOPDIR}/${COMP}
COMP_SRC += ${S_FILES:%=${DIR}/%} ${C_FILES:%=${DIR}/%}

# Special rules for special files
${DIR}/initialize.o: ${DIR}/initialize.c
	sh mkvers.sh
	VERS=`cat version`
	${CC} -DVERSION=\""`cat version`"\" ${CFLAGS} -o $@ $<
