#-----------------------------------------------------------------------------#
# Copyright (C) 1998-2000 The University of Melbourne.
# This file may only be copied under the terms of the GNU Library General
# Public License - see the file COPYING.LIB in the Mercury distribution.
#-----------------------------------------------------------------------------#
# Mmakefile for the Mercury->Aditi interface.
# 
# Environment variables (must be set externally):
# MAKEFILE_ADITI - makefile containing variables used when compiling
# 		a program for Aditi.
#				
#-----------------------------------------------------------------------------#
#
# Defines $(ADITI_API_EXTRA_CFLAGS), $(ADITI_API_EXTRA_LIBS) and
# $(ADITI_API_EXTRA_LDFLAGS).
include $(MAKEFILE_ADITI)

# The Aditi interface only works with conservative garbage collection.
# It doesn't yet work with the new high level C code grade.
# This is equivalent to
# LIBGRADES-aditi = $(filter %.gc%,$(LIBGRADES))
# but gmake patterns can't include multiple wildcards.
LIBGRADES-aditi = \
	$(shell echo $(LIBGRADES) | tr ' ' '\n' | grep '.gc' | grep -v 'hl')

#----------------------------------------------------------------------------#

# The --Wno-strict-prototypes is to shut up warnings about prototypes
# without argument types in a header file generated by rpcgen.
# To get more debugging messages, add "-DDEBUG_ON" to CFLAGS.
CFLAGS = $(ADITI_API_EXTRA_CFLAGS) -Wno-strict-prototypes

# The RPC headers on Linux don't like it when `-ansi' is passed to gcc.
MGNUCFLAGS = --no-ansi

MLFLAGS = --use-thread-libs $(ADITI_API_EXTRA_LDFLAGS)
MLLIBS = $(ADITI_API_EXTRA_LIBS)

MCFLAGS = --no-infer-all --aditi --aditi-user guest

C2INITFLAGS = --aditi

#-----------------------------------------------------------------------------%

MAIN_TARGET = libaditi

.PHONY: depend
depend: aditi.depend
	cd tests && $(MMAKE) depend

.PHONY: clean
clean:
	cd tests && $(MMAKE) clean

.PHONY: realclean
realclean:
	cd tests && $(MMAKE) realclean

.PHONY: check
check:	tests

.PHONY: tests
tests:
	cd tests && $(MMAKE)

.PHONY: install
install: libaditi.install

#-----------------------------------------------------------------------------#
