#-----------------------------------------------------------------------
# Makefile variations depending on different configurations
#
# ANN: Approximate Nearest Neighbors
# Version: 1.1 05/03/05
#
# (This Make-config structure is based on the one used by Mesa by Brian
# Paul.  If you succeed in porting ANN to your favorite system, please
# send email to mount@cs.umd.edu, and I'll try to include it in this
# list.)
#
#----------------------------------------------------------------------
# The following configuration-dependent variables are passed to each
# the Makefile in subdirectories:
#
# ANNLIB	The name of the ANN library file (usually libANN.a)
# C++		The C compiler (usually CC or g++)
# MAKELIB	The command and flags to make a library file (usually
#			"ar ...")
# CFLAGS	Flags to C++ compiler
# RANLIB	For "ranlib" = use ranlib, "true" = don't use ranlib
#----------------------------------------------------------------------
# Revision 0.1  09/06/97
#	Initial release
# Revision 0.2  06/24/98
#	Minor changes to fix compilation errors on SGI systems.
# Revision 1.0  04/01/05
#	Modifications for alpha with cxx
#	Removed CFLAGS2 options (just write your own)
#	Removed -DUSING...  (Compilers are pretty consistent these days)
#	Added linux-g++ target
# Revision 1.1  05/03/05
#	Added macosx-g++ target
#-----------------------------------------------------------------------------

#-----------------------------------------------------------------------------
# Compilation options (add these, as desired, to the CFLAGS variable
# in the desired compilation target below).  For example,
#
#	"CFLAGS = -O3 -Wall -DANN_PERF"
#
#	-g			Debugging.
#	-O?			Run-time optimization.
#	-Wall		Be verbose about warnings.
#
#	-DANN_PERF	Enable performance evaluation. (This may slow execution
#				slightly.)
#
#	-DANN_NO_LIMITS_H
#				Use this if limits.h or float.h does not exist on your
#				system. (Also see include/ANN/ANN.h for other changes
#				needed.)
#
#	-DANN_NO_RANDOM
#				Use this option if srandom()/random() are not available
#				on your system. Pseudo-random number generation is used
#				in the utility program test/ann_test. The combination
#				srandom()/random() is considered the best pseudo-random
#				number generator, but is not available on all systems.
#				If they are not available on your system (for example,
#				Visual C++) then srand()/rand() will be used instead by
#				setting this parameter.
#
#	-DWIN32
#				This is used only for compilation under windows systems
#				(but instead of using this, use the various .vcproj
#				files in the MS_WIN32 directory).
#-----------------------------------------------------------------------------

#					Linux using g++
linux-g++:
	$(MAKE) targets \
	"ANNLIB = libANN.a" \
	"C++ = g++" \
	"CFLAGS = -O3" \
	"MAKELIB = ar ruv" \
	"RANLIB = true"

linux-g++-shared:
	$(MAKE) targets \
	"ANNLIB = libANN.so" \
	"C++ = g++" \
	"CFLAGS = -O3" \
	"MAKELIB = gcc -shared -Wl,-soname,$(ANNLIB) -o $(ANNLIB)" \
	"RANLIB = true"

#
linux64-g++:
	$(MAKE) targets \
	"ANNLIB = libANN64.a" \
	"C++ = g++" \
	"CFLAGS = -O3" \
	"MAKELIB = ar ruv" \
	"RANLIB = true"

#					Linux using icpc
linux-icpc:
	$(MAKE) targets \
	"ANNLIB = libANN.a" \
	"C++ = icpc" \
	"CFLAGS = -O3 -mtune=pentium4 -msse2 -funroll-loops" \
	"MAKELIB = ar ruv" \
	"RANLIB = true"

#					Mac OS X using g++
macosx-g++:
	$(MAKE) targets \
	"ANNLIB = libANN.a" \
	"C++ = g++" \
	"CFLAGS = -O3" \
	"MAKELIB = libtool -static -o " \
	"RANLIB = true"

#					SunOS5
sunos5:
	$(MAKE) targets \
	"ANNLIB = libANN.a" \
	"C++ = CC" \
	"CFLAGS = -O" \
	"MAKELIB = ar ruv" \
	"RANLIB = true"

#					SunOS5 with shared libraries
sunos5-sl:
	$(MAKE) targets \
	"ANNLIB = libANN.a" \
	"C++ = CC" \
	"CFLAGS = -Kpic -O" \
	"MAKELIB = ld -G -o" \
	"RANLIB = true"

#					SunOS5 with g++
sunos5-g++:
	$(MAKE) targets \
	"ANNLIB = libANN.a" \
	"C++ = g++" \
	"CFLAGS = -O3" \
	"MAKELIB = ar ruv" \
	"RANLIB = true"

#					SunOS5 with g++ and shared libraries
sunos5-g++-sl:
	$(MAKE) targets \
	"ANNLIB = libANN.so" \
	"C++ = g++" \
	"CFLAGS = -fpic -O3" \
	"MAKELIB = ld -G -o" \
	"RANLIB = true"

#-----------------------------------------------------------------------
# Used for the author's testing and debugging only
#-----------------------------------------------------------------------

#					debugging version for authors
authors-debug:
	$(MAKE) targets \
	"ANNLIB = libANN.a" \
	"C++ = g++" \
	"CFLAGS = -g -DANN_PERF -Wall" \
	"MAKELIB = ar ruv" \
	"RANLIB = true"

#					performance testing version for authors
authors-perf:
	$(MAKE) targets \
	"ANNLIB = libANN.a" \
	"C++ = g++" \
	"CFLAGS = -O3 -DANN_PERF -Wall" \
	"MAKELIB = ar ruv" \
	"RANLIB = true"

#-----------------------------------------------------------------------
# Some older ones that I have not tested with the latest version.
#-----------------------------------------------------------------------

sgi:
	$(MAKE) targets \
	"ANNLIB = libANN.a" \
	"C++ = CC -ansi" \
	"CFLAGS = -O2" \
	"MAKELIB = ar ruv" \
	"RANLIB = true"

#					DEC Alpha with g++
alpha-g++:
	$(MAKE) targets \
	"ANNLIB = libANN.a" \
	"C++ = g++" \
	"CFLAGS = -O3" \
	"MAKELIB = ar ruv" \
	"RANLIB = ranlib"

#					SunOS4
sunos4:
	$(MAKE) targets \
	"ANNLIB = libANN.a" \
	"C++ = CC" \
	"CFLAGS = -O" \
	"MAKELIB = ar ruv" \
	"RANLIB = ranlib"

#					SunOS4 with g++
sunos4-g++:
	$(MAKE) targets \
	"ANNLIB = libANN.a" \
	"C++ = g++" \
	"CFLAGS = -O3" \
	"MAKELIB = ar ruv" \
	"RANLIB = ranlib"

#					SunOS4 with g++ and shared libraries
sunos4-g++-sl:
	$(MAKE) targets \
	"ANNLIB = libANN.so" \
	"C++ = g++" \
	"CC = g++" \
	"CFLAGS = -fPIC -O3" \
	"MAKELIB = ld -assert pure-text -o" \
	"RANLIB = true"

