COMPILER = mpicc
ARG= -Iheaders -I.. -Iplatform/linux/include	
CCFLAGS = -c
OUT=libmesham.a
CP=cp
AR=ar
RANLIB=ranlib

all: static shared clean

static: cpit 

shared: compiledyn
	${CP} libmesham.so ../libmesham.so

compiledyn:
	${COMPILER} -shared -o libmesham.so *.o -lm
	
cpit: ran
	${CP} libmesham.a ../libmesham.a
	
ran:out.o
	${RANLIB} ${OUT}

out.o: maths other io errors string system
	${AR} rc ${OUT} *.o
	
errors:
	${COMPILER} -c -fPIC Errors/*.c ${ARG}
maths:  
	${COMPILER} -c -fPIC Maths/*.c ${ARG}
	
other:  
	${COMPILER} -c -fPIC Other/*.c ${ARG}
	
io:  
	${COMPILER} -c -fPIC io/*.c ${ARG}

string:  
	${COMPILER} -c -fPIC String/*.c ${ARG}
	
system:  
	${COMPILER} -c -fPIC System/*.c ${ARG}

clean: 
	rm -rf *.o *.a *.so
