#!smake
#
# Makefile for os library subdirectory
#

SUBDIR=os

PRDEPTH=../..
include $(PRDEPTH)/PRdefs

LIBDEPTH=..
include $(LIBDEPTH)/libdefs

sinclude locdefs

LCOPTS    = -non_shared -G 0 -mips2 -fullwarn -wlint,-f -woff 819,826,852
LCINCS    = -I. -I$(LIBDEPTH)/io -I$(LIBDEPTH)/rmon -I$(PRDEPTH)/include 

LASOPTS   = -non_shared -G 0 -mips2
LASINCS   = -I. -I$(PRDEPTH)/include

#if $(LIBNAME) != "ULTRA_EM"
ASFILES   = exceptasm.s getcause.s getcompare.s \
	    getconfig.s getcount.s getfpccsr.s getsr.s getintmask.s \
	    gettlbasid.s gettlbhi.s gettlblo0.s gettlblo1.s gettlbpagemask.s \
	    invaldcache.s invalicache.s \
	    interrupt.s maptlb.s parameters.s probetlb.s setintmask.s \
	    setcause.s setcompare.s setconfig.s setcount.s setfpccsr.s setsr.s \
	    settlbasid.s unmaptlb.s unmaptlball.s \
	    writebackdcache.s writebackdcacheall.s maptlbrdb.s
#endif

#if $(LIBNAME) != "ULTRA" && $(LIBNAME) != "ULTRA_ROM"
ASFILES  += errorasm.s 
#endif

#if $(LIBNAME) != "ULTRA_EM"
CFILES    = atomic.c createmesgqueue.c createthread.c destroythread.c \
	    getactivequeue.c getthreadid.c  getthreadpri.c gettime.c \
	    initialize.c jammesg.c kdebugserver.c physicaltovirtual.c \
	    recvmesg.c resetglobalintmask.c sendmesg.c seteventmesg.c \
	    setglobalintmask.c sethwinterrupt.c \
	    setthreadpri.c settime.c settimer.c startthread.c stopthread.c \
	    stoptimer.c syncputchars.c thread.c timerintr.c \
	    virtualtophysical.c yieldthread.c \
	    getcurrfaultthread.c getnextfaultthread.c initrdb.c rdbsend.c
#endif

#if $(LIBNAME) != "ULTRA" && $(LIBNAME) != "ULTRA_ROM"
CFILES   += error.c seterrorhandler.c assert.c
#endif

#if $(LIBNAME) != "ULTRA_ROM"
ASFILES += assertbreak.s
CFILES   += exit.c profile.c readhost.c testhost.c writehost.c ackramromread.c ackramromwrite.c
#endif

exceptasm.o:	exceptasm.s
	$(AS) $(LASDEFS) $(LASINCS) -non_shared -G 0 -mips3 -32 \
	$(GASFLAGS) -o $@ $(LIBDEPTH)/$(SUBDIR)/exceptasm.s

$(OBJECTS): ./threadasm.h

./threadasm.h: makethreadasm
	./makethreadasm > threadasm.h

makethreadasm: $(LIBDEPTH)/os/makethreadasm.c $(PRDEPTH)/include/os.h
	$(HOST_CC) $(LCINCS) -I$(ROOT)/usr/include -o $@ $(LIBDEPTH)/os/makethreadasm.c

include $(LIBDEPTH)/librules

include $(PRDEPTH)/PRrules

install! default
