#  Makefile for run-time helpers - this makefile is now Linux-specific
#
#  Copyright 1996, 1997 Arizona Board of Regents; see COPYRIGHT file for 
#  details.


include ../configs/basic.mk
include ../configs/current.mk

CFLAGS = -O -g -I .. -I . $(CBUILD) -DUSER_LEVEL

DONE = scout_threads.done
UPDATED = ../runtime/runtime.updated

MYSYSTEM=`uname -s`

SRC = scout_thread.c scout_semaphore.c scout_queue.c scout_fifo.c \
      scout_thread_toba.c

OBJ = $(SRC:.c=.o) system.o

default:  $(DONE)

scout_thread.c: machine

ccflags system.o:: system

system.o::
	cd system; $(MAKE) $@
	cp -p system/system.o .

ccflags::
	cd system; $(MAKE) ccflags
	cp -p system/ccflags .

machine:
	ln -sf $(ARCH) machine

system:
	ln -sf $(MYSYSTEM) system

$(DONE):  $(OBJ) ccflags
	touch $(UPDATED) $(DONE)

clean:
	if [ -d system ]; \
	then \
	    cd system; $(MAKE) clean; \
	fi
	rm -f system machine ccflags *.o $(DONE) $(UPDATED)
