#
#  make(1) instructions for creating demo database AAA for MUG '97
#  This is a hand-generated makefile (not from jake, don't zap it!)
#
#  Make CAS database
#
#  Set the symbol "D" to the directory which will contain the database.
#  Set the symbol "T" to the directory for temporary files.
#

D        = /nalgas/htdocs/meetings/mug97/agenda97/Rohde/cas
T        = /nalgas/htdocs/meetings/mug97/agenda97/Rohde/cas
FINAL_DB = cas.THOR
INDIR_DB = cas_indirect.THOR
DTYPE_DB = cas_datatypes.THOR
TEMPBASE = $(T)/BBB_TMP
TARGETS  = $(D)/$(FINAL_DB)

all:    $(TARGETS)

#
#  Create datatypes database and load it
#

$D/$(DTYPE_DB): $(T)/cas_datatypes.tdt
		thormake +NOSECURE_PASSWORDS \
                   "$(D)/$(DTYPE_DB)%,write,exec@challenge:thor:thor%" \
                   100 0
		thorload +NOSECURE_PASSWORDS +NOMERGE \
                   "$(D)/$(DTYPE_DB)%write@challenge:thor:thor%" \
                   $(T)/cas_datatypes.tdt

#
#  Create empty indirect database
#

$(D)/$(INDIR_DB):  $(T)/cas_indirect.tdt  $(D)/$(DTYPE_DB)
	thormake +NOSECURE_PASSWORDS   \
                      -DATATYPES_DATABASE $(DTYPE_DB) \
                      "$(D)/$(INDIR_DB)%,write,exec@challenge:thor:thor%" \
                   50000 50000

#
#  Create temporary database, load it, list its contents, then destroy it.
#  $SMI roots, GRF's, indirect data are automatically generated
#

$(T)/aaa_smi.tdt:  $(T)/cas.clean.tdt  $(D)/$(DTYPE_DB)  $(D)/$(INDIR_DB)
	thormake +NOSECURE_PASSWORDS   \
                     -DATATYPES_DATABASE $(D)/$(DTYPE_DB) \
                     -INDIRECT_DATABASE  $(D)/$(INDIR_DB)  \
                     "$(TEMPBASE)%write,exec@challenge:thor:thor%" \
                     100000 100000
	thorload +NOSECURE_PASSWORDS +GENERATE_INDIRECT  \
                     -INDIRECT_DATABASE "$(D)/$(INDIR_DB)%write@challenge:thor:thor%" \
                     "$(TEMPBASE)%write@challenge:thor:thor%"  \
                     $(T)/cas.clean.tdt
	thorlist +NOSECURE_PASSWORDS +KEEP_INDIRECT_DATA \
                     "$(TEMPBASE)%@challenge:thor:thor%" > $(T)/aaa_smi.tdt
	thordestroy +NOSECURE_PASSWORDS -ARE_YOU_SURE DONTASK \
                      "$(TEMPBASE)%exec@challenge:thor:thor%"

#
#  Fingerprint all $SMI-rooted datatrees
#

$(T)/aaa_fps.tdt:  $(T)/aaa_smi.tdt
		$(DY_ROOT)/bin/fingerprint -x \
                      $(T)/aaa_smi.tdt           \
                      > $(T)/aaa_fps.tdt

#
#  Create the final AAA database and raw-load it.
#

$(D)/$(FINAL_DB):  $(T)/aaa_fps.tdt  $(D)/$(DTYPE_DB)  $(D)/$(INDIR_DB)
	thormake +NOSECURE_PASSWORDS   \
                      -DATATYPES_DATABASE $(D)/$(DTYPE_DB) \
                      -INDIRECT_DATABASE  $(D)/$(INDIR_DB)  \
                      "$(D)/$(FINAL_DB)%write,exec@challenge:thor:thor%" \
                      100000 100000
	thorload +NOSECURE_PASSWORDS +RAW_DATA  \
                      "$(D)/$(FINAL_DB)%write@challenge:thor:thor%" \
                      $(T)/aaa_fps.tdt

#
#  Utility targets
#

clean:
	rm -f $(D)/AAA.* $(D)/BBB_*.*

cleanall:          clean
	rm -f $(T)/aaa_smi.tdt $(T)/aaa_fps.tdt

