#-----------------------------------------------------------------------------#
# This source file is hereby placed in the public domain.  -fjh (the author).
#-----------------------------------------------------------------------------#

MAIN_TARGET=all

depend: cpp_main.depend
all: cpp_main

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

.SUFFIXES: .cc
.cc.o:
	$(CXX) $(HACK) $(CXXFLAGS) -c $<

CXX=$(MGNUC) $(ALL_GRADEFLAGS) $(ALL_MGNUCFLAGS)

# Due to a bug in g++ 2.7, global register variables don't work in C++.
# Hence we need to ensure that we don't include the global register
# variable declarations.  The following hack seems to do the trick.

HACK=		-DMR_MACHDEPS_ALPHA_REGS_H \
		-DMR_MACHDEPS_MIPS_REGS_H \
		-DMR_MACHDEPS_SPARC_REGS_H \
		-DMR_MACHDEPS_I386_REGS_H \
		-DMR_MACHDEPS_PA_REGS_H \
		-DMR_MACHDEPS_RS6000_REGS_H

# Pass `-g' to the C compiler and linker, so we can use a debugger (e.g. gdb).
CXXFLAGS=-g
MGNUCFLAGS=-g

# Tell the Mercury linker that the Mercury stuff we're building should
# not define the C function main().
MLFLAGS=--no-main -g

# Tell the Mercury linker to link with main.o.
MLOBJS=main.o
MLLIBS=-lstdc++

MCFLAGS-cpp_main=--no-warn-nothing-exported

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

main.o: mercury_lib.mh

# make sure that `mmake clean' removes main.o
clean_local:
	rm -f main.o

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