MKDIR?=mkdir
RM?=rm -f
CP?=cp

CXX_STD=CXX11
#PKG_CPPFLAGS = -DRCPP_USE_UNWIND_PROTECT
MKDIR_P = ${MKDIR} -p
PKG_LIBS = -lrt 
STATICLIB = SharedObject.a

.PHONY: all create-folder copy-files

all: ${SHLIB} copy-files
#all: ${SHLIB}

create-folder:
	 ${MKDIR_P} ../inst/include&&\
	 ${MKDIR_P} ../inst/include/SharedObject&&\
	 ${MKDIR_P} ../inst/usrlib${R_ARCH}

${STATICLIB}: ${OBJECTS}
	 ${AR} -crv ${STATICLIB} ${OBJECTS}

copy-files: create-folder ${STATICLIB}
	 ${CP} "sharedMemory.h" "../inst/include/SharedObject/"&&\
	 ${CP} ${STATICLIB} "../inst/usrlib${R_ARCH}/"
