#
# Makefile,v 1.6 2003/05/12 22:08:12 dsg Exp
# Top-level Makefile for the OpenMMS builds.
#
# 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 pwd)
endif

# define all necessary variables
include config/localdefs.gmake
BUILD_TARGET_FILE = $(TOP_DIR)/log/build_target

# Top-level gmake file
TOP_GMAKE = top.gmake

# BUILD TYPE DEFINITIONS
# To create additional build targets simply add them to the
# BUILD_TYPES list below
BUILD_TYPES = Std Lsr Dev Compact Test Full

# Default Target for entire tree
all: Std

# Create a log file for the entire make process in log/MAKE.LOG
# The actual makefile used for the top-level make is specified by
# the TOP_GMAKE variable.
# If the source has previously been built, then subsequent builds
# must use the same target unless a "gmake clean" is done.
$(BUILD_TYPES):
	@if [ -f $(BUILD_TARGET_FILE) ] ;\
	  then if [ $@ != `$(CAT) $(BUILD_TARGET_FILE)` ] ;\
	    then echo New target name for top-level build being used ;\
	      echo run \'% gmake clean\' first ;\
	      exit 1;\
	  fi; \
	fi
	@echo $@ > $(BUILD_TARGET_FILE)
	@$(MAKE) -f $(TOP_GMAKE) $@ 2>&1 | tee log/MAKE.LOG

clean:
	@$(MAKE) -f $(TOP_GMAKE) $@ 2>&1 | tee log/CLEAN.LOG
	@$(RM) -f $(BUILD_TARGET_FILE)

