CXX=g++ -g
#CXX=g++-4.2
## Under MacOS you may have an old compiler as default (e.g. GCC 4.0).
## However, GCC 4.2 or later is available and preferable due to better
## handling of template code.


OPT = -O2
## As the Armadillo library uses recursive templates,
## compilation times depend on the level of optimisation:
##
## -O0: quick compilation, but the resulting program will be slow
## -O1: produces programs which achieve most of the possible speedup
## -O3: produces programs which have almost all possible speedups,
##      but compilation takes considerably longer


EXTRA_OPT = -fwhole-program -I../src/include -L..
## Uncomment the above line if you're compiling 
## all source files into one program in a single hit.


#DEBUG = -DARMA_EXTRA_DEBUG
## Uncomment the above line to enable low-level
## debugging.  Lots of debugging information will
## be printed when a compiled program is run.
## Please enable this option when reporting bugs.


#FINAL = -DARMA_NO_DEBUG
## Uncomment the above line to disable Armadillo's checks.
## DANGEROUS!  Not recommended unless your code has been
## thoroughly tested.

#
#
#

CXXFLAGS = $(DEBUG) $(FINAL) $(OPT) $(EXTRA_OPT)

all: example1 example2

example1: example1.cpp
	$(CXX) $(CXXFLAGS) -o $@ $< -larmadillo -llapack -lopenblas

example2: example2.cpp
	$(CXX) $(CXXFLAGS) -o $@ $< -larmadillo -llapack -lopenblas

## If you installed Armadillo's headers manually, you may need to tell
## the compiler where they are.  For example, place -I/usr/local/include
## into the CXXFLAGS line.  Furthermore, you may also need to change
## "-larmadillo" to "-llapack -lblas".  Under MacOS the change would
## be from "-larmadillo" to "-framework accelerate".
##
## See INSTALLATION.txt that came with Armadillo for more information.


.PHONY: clean

clean:
	rm -f example1 example2

