#
# Copyright  2014 Daniel Taliun, Johann Gamper and Cristian Pattaro. All rights reserved.
#
# This file is part of S-MIG++.
#
# S-MIG++ is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# S-MIG++ is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with S-MIG++. If not, see <http://www.gnu.org/licenses/>.
#

LIBS = -lz -lgsl -lgslcblas

APPDIRS = 	auxiliary \
				exception \
				reader \
				writer \
				db \
				algorithms

APPLIBS = 	auxiliary/*.o \
				exception/*.o \
				reader/*.o \
				writer/*.o \
				db/*.o \
				algorithms/*.o
     
all: applibs

applibs: subclean
			@for appdir in $(APPDIRS); do \
				(cd $${appdir} && $(MAKE) applib) || exit 1; \
			done
			g++ -std=c++11 -Wall -O3 -o smigpp smigpp.cpp $(APPLIBS) $(LIBS)
			
subclean:
	@-rm -f $(SHLIB)
	@for appdir in $(APPDIRS); do \
		(cd $${appdir} && $(MAKE) clean) || exit 1; \
	done

clean: subclean
	@-rm -f *.o
