#                             Source/Makefile
#
# This is the makefile that builds the engine executables for MagicStats...
# It compiles six different executables... Enterprise, Professional, and Free
# in both Optimized and Debuggable form.
# 
# The most complex part of this makefile is it trying to generate three
# slightly different versions of the executable, all linking to a
# different version of a single .o file.  
#

LEVEL = ..

# PCRE is the Regular Expression library
#
DIRS = PCRE 

# Include common make functionality...
include $(LEVEL)/Makefile.common

# Install the version of the binary selected in makefile.common.
install::
	cp -f $(LEVEL)/Install/MagicStats2 $(BinInstDir)/MagicStats2

clean::

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

libpcre.a = PCRE/libpcre.a

Dirs      = Release/.dir Debug/.dir Depend/.dir

# The main files to generate... MagicStats2 and friends...
MainFileO = $(LEVEL)/Install/MagicStats2
MainFileG = $(LEVEL)/Install/MagicStats2_g

# all - Build both binaries
#
all:: $(MainFileG) $(MainFileO) $(Dirs)

# MainFiles - Create the final binaries...
$(MainFileO) : $(LEVEL)/Install/.dir $(libpcre.a) $(ObjectsO)
	@echo --- Linking Release version...
	$(Link) -ldl -o $@ $(ObjectsO) $(ModeOO) $(libpcre.a)
	#strip $@

$(MainFileG) : $(LEVEL)/Install/.dir $(libpcre.a) $(ObjectsG)
	@echo --- Linking Debug version...
	$(Link) \
            -ldl -o $@ $(ObjectsG) $(ModeOG) $(libpcre.a)

# To Link in debugmalloc...
#/usr/local/lib/libdmalloc.so -lelf -lbfd -liberty \