# Makefile for the API, RUNTIME and SUN packages
#
#  LIBS should be set when making the RUNTIME target
#
#  Copyright 1996, 1997 Arizona Board of Regents;
#  see COPYRIGHT file for details. 

TOBA = ../bin/toba $(TBUILD)
LISTER = ../bin/lister

API: api.done
RUNTIME: runtime.done
SUN: sun.done


# Files for the RUNTIME package
GCFILES = `find ../gc -name '*.o' | grep -v test.o`
RTFILES = ../runtime/*.o ../runtime/runtime.h ../runtime/toba.h

# Build the API package
# Must have previously made the "classes" target in the toba directory
api.done:
	rm -rf API
	classes=`$(LISTER) | sort | grep "^java"` && \
	    $(TOBA) -J -I ../runtime -P API $$classes
	touch api.done api.updated


# Build the RUNTIME package
# Must have previously made the "classes" target in the toba directory, 
# and the gc and runtime directories
runtime.done: ../runtime/runtime.done ../gc/gc.a
	rm -rf RUNTIME
	$(TOBA) -J -I ../runtime -P RUNTIME $(GCFILES) $(RTFILES) $(LIBS)
	touch runtime.done runtime.updated


# Build the SUN package
# Must have previously made the "classes" target in the toba directory
sun.done:
	rm -rf SUN
	classes=`$(LISTER) | sort | \
	    grep '^sun.tools' | egrep -v '(debug|javadoc)'` && \
	    $(TOBA) -J -I ../runtime -P SUN $$classes
	touch sun.done sun.updated

clean:
	rm -rf *.done API RUNTIME SUN

