# ACL:license
#  ----------------------------------------------------------------------
#  This software and ancillary information (herein called "SOFTWARE")
#  called SILOON is made available under the terms described here.  The
#  SOFTWARE has been approved for release with associated LA-CC Number
#  LA-CC-98-32.
#  
#  Unless otherwise indicated, this SOFTWARE has been authored by an
#  employee or employees of the University of California, operator of the
#  Los Alamos National Laboratory under Contract No.  W-7405-ENG-36 with
#  the U.S. Department of Energy.  The U.S. Government has rights to use,
#  reproduce, and distribute this SOFTWARE, and to allow others to do so.
#  The public may copy, distribute, prepare derivative works and publicly
#  display this SOFTWARE without charge, provided that this Notice and
#  any statement of authorship are reproduced on all copies.  Neither the
#  Government nor the University makes any warranty, express or implied,
#  or assumes any liability or responsibility for the use of this
#  SOFTWARE.
#  
#  If SOFTWARE is modified to produce derivative works, such modified
#  SOFTWARE should be clearly marked, so as not to confuse it with the
#  version available from LANL.  
#  
#  For more information about SILOON, send e-mail to
#  siloon-team@acl.lanl.gov, or visit the SILOON web page at
#  http://www.acl.lanl.gov/siloon/.
#  ----------------------------------------------------------------------
# ACL:license
#
# $Id: Makefile,v 1.8 2002/01/15 19:26:38 rasmussn Exp $

#### Start of system configuration section. ####

CCAFE_ROOT = ..

include user.defs
include MODULE

CXX      = $(SILOON_CXX)
AR       = $(SILOON_AR)
ARFLAGS  = $(SILOON_ARFLAGS)
DEFS     = $(SILOON_DEFS)
LIBS     = -lsiloon

SILOON_INCLUDE  = ./include

CXXFLAGS = $(SILOON_CXX_FLAGS)
CPPFLAGS = $(SILOON_USER_INCLUDES) -I$(SILOON_INCLUDE) -I$(PDT_INCLUDE)
LDFLAGS  = -L$(SILOON_LIBS)

#### End of system configuration section. ####

SHELL = /bin/sh

all: shared

# These are the files generated by siloon-gen.
GENFILES = siloon_register.cc siloon_execute.cc

SRCS = $(GENFILES)
OBJS = $(SILOON_USER_OBJECTS) $(SRCS:.cc=.o)

# Default rule for compiling C++ files.  Some versions of make don't
# automatically recognize the .cc suffix, so add it to .SUFFIXES.
.SUFFIXES: .cc .o
.cc.o:
	$(CXX) $(CPPFLAGS) $(CXXFLAGS) $(DEFS) -c $(@:.o=.cc)

shared: $(OBJS) libsiloon languages

languages: force
	@for subdir in $(LANGUAGES); do \
	    if [ -d $$subdir -a -f $$subdir/Makefile ] ; then \
	        echo "making in $$subdir" ; \
	        (cd $$subdir && $(MAKE) all) ; \
	    fi \
	done

libsiloon: force
	@echo "making in src"
	@(cd src ; $(MAKE))

clean: force
	rm -f *~ *.o
	rm -rf ii_files ti_files 
	@echo "making clean in src"
	@(cd src ; $(MAKE) clean)
	@for subdir in $(LANGUAGES); do \
	    if [ -d $$subdir -a -f $$subdir/Makefile ] ; then \
	        echo "making clean in $$subdir" ; \
	        (cd $$subdir && $(MAKE) clean) ; \
	    fi \
	done

distclean: clean

force:

Siloon-Unavailable/lib/MakeIncl.siloon:
	@echo ""
	@echo "************************* WARNING ******************************"
	@echo ""
	@echo "   Not configured for Python scripting.  Please install"
	@echo "   SILOON and configure CCAFE using --with-siloon=PATH option."
	@echo ""
	@echo "******************************************************************"
	@echo ""
	@exit 1

$(CCAFE_ROOT)/chez-rob/protoBS/libprotobs.a:
	(cd $(CCAFE_ROOT)/chez-rob/protoBS ; $(MAKE))
