#
# Makefile,v 1.10 2003/07/30 00:08:44 dsg Exp
# OpenMMS Makefile for directory: run/unix
#
# Copyright 2001 The Regents of the University of California
# All Rights Reserved
#
# OpenMMS was developed by Dr. Douglas S. Greer at the San Diego
# Supercomputer Center, a research unit of the University of California,
# San Diego.  Support for this effort was provided by NSF through the
# Protein Data Bank (Grant DBI-9814284) and the National Partnership for
# Advanced Computational Infrastructure (Grant ACI-9619020)
#
# Permission to use, copy, modify and distribute any part of OpenMMS for
# educational, research and non-profit purposes, without fee, and
# without a written agreement is hereby granted, provided that the above
# copyright notice, this paragraph and the following paragraphs appear
# in all copies.
#
# Those desiring to incorporate this OpenMMS into commercial products or
# use for commercial purposes should contact the Technology Transfer
# Office, University of California, San Diego, 9500 Gilman Drive, La
# Jolla, CA 92093-0910, Ph: (619) 534-5815, FAX: (619) 534-7345.
#
# In no event shall the University of California be liable to any party
# for direct, indirect, special, incidental, or consequential damages,
# including lost profits, arising out of the use of this OpenMMS, even
# if the University of California has been advised of the possibility of
# such damage.
#
# The OpenMMS provided herein is on an "as is" basis, and the
# University of California has no obligation to provide maintenance,
# support, updates, enhancements, or modifications.  The University of
# California makes no representations and extends no warranties of any
# kind, either implied or express, including, but not limited to, the
# implied warranties of merchantability or fitness for a particular
# purpose, or that the use of the OpenMMS will not infringe any patent,
# trademark or other rights.

ifndef TOP_DIR
export TOP_DIR := $(shell (cd ../..; pwd))
endif
	
.PHONY: $(TOP_DIR)/config/openmms.gmake
include $(TOP_DIR)/config/openmms.gmake

Package        =
Sources        = 
Dependencies   =
Build_Subdirs  =

# use ../.. rather that $(TOP_DIR) in the following definition
# so .PHONY directives will not cause unnecessary remakes
config_files = $(wildcard ../../config/*.gmake)

lvf := _vars.sh
plvf := _generated$(lvf)

xml_target := ../../data/xml/1xy2.xml

$(BUILD_TARGET):: $(lvf) $(xml_target)

init::

# The prototype variable file $(plvf) is created here, if the actual
# variable file $(lvf) does not exist it is created by copying $(plvf)
# This is done so that if users/administrators edit the
# variables file by hand, these changes will not be overiden.
$(lvf): $(plvf)
	if [ ! -f $(lvf) ] ; then $(CP) $(plvf) $(lvf) ; fi

$(plvf): $(config_files)
	@echo "# " >  $(plvf)
	@echo "# Runtime variable definitons." >> $(plvf)
	@echo "# " >> $(plvf)
	@echo "#     ******** WARNING: DERIVED FILE ********" >> $(plvf)
	@echo "# " >> $(plvf)
	@echo "# The file $(plvf) is generated from the variables in the file" >> $(plvf)
	@echo "# config/localdefs.gmake." >> $(plvf)
	@echo "# If $(lvf) does not exist, $(plvf) is copied to it." >> $(plvf)
	@echo "# This prevents overwritting local edits to $(lvf)." >> $(plvf)
	@echo "# " >> $(plvf)
	@echo "# To permanently change the variables defined here, edit the file" >> $(plvf)
	@echo "# config/localvars.gmake, remove $(lvf) and then run gmake in this directory" >> $(plvf)
	@echo "# " >> $(plvf)
	echo "" >> $(plvf)
	echo "TOP_DIR=\"$(TOP_DIR)\"" >> $(plvf)
	echo "DICTIONARY_DIR=\"$(DICTIONARY_DIR)\"" >> $(plvf)
	echo "CIF_MM_DICTIONARY_NAME=\"$(CIF_MM_DICTIONARY_NAME)\"" >> $(plvf)
	echo "EXCHANGE_DICTIONARY_NAME=\"$(EXCHANGE_DICTIONARY_NAME)\"" >> $(plvf)
	echo "LOG_DIR=\"$(LOG_DIR)\"" >> $(plvf)
	echo "LOCAL_CIF_DATA_DIR=\"$(LOCAL_CIF_DATA_DIR)\"" >> $(plvf)
	echo "TEST_DATA_DIR=\"$(TEST_DATA_DIR)\"" >> $(plvf)
	echo "TEST_CIF_DATA_DIR=\"$(TEST_CIF_DATA_DIR)\"" >> $(plvf)
	echo "" >> $(plvf)
	echo "JDBC_DRIVER_CLASSES=\"$(JDBC_DRIVER_CLASSES)\"" >> $(plvf)
	echo "" >> $(plvf)
	echo "JAVA_BIN_DIR=\"$(JAVA_BIN_DIR)\"" >> $(plvf)
	echo "RUN_JAVA=\"$(RUN_JAVA)\"" >> $(plvf)
	echo "" >> $(plvf)
	echo "NAME_SERVER=\"$(NAME_SERVER)\"" >> $(plvf)
	echo "MMS_SERVICE_NAME=\"$(MMS_SERVICE_NAME)\"" >> $(plvf)
	echo "REMOTE_NS_PORT=\"$(REMOTE_NS_PORT)\"" >> $(plvf)
	echo "REMOTE_NS_URL=\"$(REMOTE_NS_URL)\"" >> $(plvf)
	echo "LOCAL_NS_PORT=\"$(LOCAL_NS_PORT)\"" >> $(plvf)
	echo "LOCAL_NS_URL=\"$(LOCAL_NS_URL)\"" >> $(plvf)
	echo "" >> $(plvf)


clean::
	$(RM) -rf $(plvf) $(lvf)

xml_cmd := ./xmlconv
$(xml_target):: $(xml_cmd)
	$(xml_cmd)
	
include $(TOP_DIR)/config/rules.gmake

fin::
