#
# Enduce aggregators Makefile: Dinorms, Contifiers, Clustions
#

AR=ar
CC=gcc
CXX=g++

CFLAGS=-Wall -fPIC -O2
CXXFLAGS=-Wall -fPIC -O2
LIBFLAGS=-Wall -fPIC -shared
# set LIBEXT to 'dll' under the wine/mswin platforms
#LIBEXT=dll
LIBEXT=so

OBJS=contifiers.o \
contifiers_ext.o \
dinorms.o \
dinorms_ext.o \
clustions.o \
clustions_ext.o

libs: libenduce.$(LIBEXT) libenduce.a

libenduce.a: $(OBJS)
	$(AR) r $@ $(OBJS)

libenduce.$(LIBEXT): $(OBJS)
	$(CXX) $(LIBFLAGS) -o $@ $(OBJS)

dinorms.o: dinorms.cc dinorms.h
	$(CXX) $(CXXFLAGS) -o $@ -c $<

dinorms_ext.o: dinorms_ext.cc dinorms_ext.h dinorms.h
	$(CXX) $(CXXFLAGS) -o $@ -c $<

contifiers.o: contifiers.cc contifiers.h
	$(CXX) $(CXXFLAGS) -o $@ -c $<

contifiers_ext.o: contifiers_ext.cc contifiers_ext.h contifiers.h
	$(CXX) $(CXXFLAGS) -o $@ -c $<

clustions.o: clustions.cc clustions.h
	$(CXX) $(CXXFLAGS) -o $@ -c $<

clustions_ext.o: clustions_ext.cc clustions_ext.h clustions.h
	$(CXX) $(CXXFLAGS) -o $@ -c $<

dist: libenduce.so libenduce.a
	cp libenduce.so ..
	cp libenduce.a ..
#	make clean

clean:
	rm -f libenduce.* *.o

