# --------------------------------------------------------------------------
# Copyright 1992 by Forschungszentrum Informatik (FZI)
#
# You can use and distribute this software under the terms of the license
# version 1 you should have received along with this software.
# If not or if you want additional information, write to
# Forschungszentrum Informatik, "OBST Projekt", Haid-und-Neu-Strasse 10-14,
# D-76131 Karlsruhe, Germany.
# --------------------------------------------------------------------------
default: all

include ../tut_common.mk

EXAMPLES=$(SAMPLE)

UF=$(EXAMPLES)/UnixFile
TF=$(EXAMPLES)/TextFile

INCLUDES=$(OBST_INCLUDES) -I$(UF)


# ~~~~~~~~~~~~~~~~
# TextFile example
# ~~~~~~~~~~~~~~~~

all: USED_MODULES $(TF)/TextFile

clean:
	rm -f $(TF)/*.o $(TF)/TextFile

realclean: clean
	rm -f $(TF)/*_obst.[Cch] $(TF)/*_use.h $(TF)/*_scp.C
	touch $(TF)/*.obst


# ~~~~~~~~~~~~~~~~
# used modules
# ~~~~~~~~~~~~~~~~
# TextFile uses UnixFile

UF_OBJS = $(UF)/UnixFile_obst.o $(UF)/UnixFile.o

USED_MODULES:
	cd $(UF); make ALL_MODULES


# ~~~~~~~~~~~~~~~
# module:TextFile
# ~~~~~~~~~~~~~~~

TF_OBJS = $(TF_MODULES) $(TF_MAIN)

TF_MAIN = $(TF)/TextFile_main.o

TF_MODULES = $(TF)/TextFile_obst.o $(TF)/TextFile.o

ALL_MODULES: USED_MODULES $(TF_MODULES) 


$(TF)/TextFile_obst.h $(TF)/TextFile_use.h $(TF)/TextFile_obst.C: \
	   $(TF)/TextFile.obst
	$(OBST.CMP) TextFile

$(TF)/TextFile_obst.o:  $(TF)/TextFile_obst.C $(TF)/TextFile_obst.h
	$(OBST.GEN.CC) $(TF)/TextFile_obst.C 

$(TF)/TextFile.o: $(TF)/TextFile_obst.h $(TF)/TextFile.C
	$(OBST.CC) $(TF)/TextFile.C  


$(TF)/TextFile_main.o: $(TF)/TextFile_use.h $(TF)/TextFile_main.C
	$(COMP.CC) $(TF)/TextFile_main.C 

$(TF)/TextFile: ALL_MODULES $(TF_MAIN) $(OBSTLIB)/libOBST*
	$(LINK.CC) $(UF_OBJS) $(TF_OBJS) $(libOBST) $(LDFLAGS)
