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

depend: mercury_main.depend
all: mercury_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
MLFLAGS=-g

# tell the Mercury linker to link in cpp_main.o
MLOBJS=cpp_main.o
MLLIBS=-lstdc++

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

# we also need to add header file dependencies
cpp_main.o: cpp_main.h mercury_lib.mh
cpp_main_int.o: cpp_main.h

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

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