.SILENT:

LIBNAME   = Chimera
CPP_FILES = Chimera.cpp
INCLUDES  = -I../../Utils

OBJECTS   = $(CPP_FILES:.cpp = .o)
OSTYPE    = $(shell uname -s)

ifeq ($(OSTYPE), Linux)
	SYS_LIBNAME = $(addsuffix .so, $(LIBNAME))
	OPTIONS = -fPIC -L ../../Utils -l OptiM_Tools
else
	SYS_LIBNAME = $(addsuffix .dll, $(LIBNAME))
	OPTIONS = ../../Utils/libOptiM_Tools.a
endif

.PHONY: clean

all: $(SYS_LIBNAME)

.cpp.o:
	echo --- compilation: $*.cpp ...
	g++ -c -Wall -O2 $< -o $@
	
$(SYS_LIBNAME): $(OBJECTS)
	@echo --- make library: $@
	g++ -Wall -shared $(INCLUDES) $(OBJECTS) -static-libgcc -static-libstdc++ $(OPTIONS) -o $(SYS_LIBNAME)  	  

clean:
	rm -f *.o $(SYS_LIBNAME)
