#  GNUMakefile
 
# Just a snippet to stop executing under other make(1) commands
# that won't understand these lines
ifneq (,)
This makefile requires GNU Make.
endif
	
CXX_STD = CXX11
PKG_CPPFLAGS =-DROUT -I../inst/include/ -I/usr/include/libxml2
PKG_LIBS =`${R_HOME}/bin/Rscript -e "RProtoBufLib:::LdFlags();cat(' ');RcppParallel::RcppParallelLibs()"` -lxml2 

USERDIR = ${R_PACKAGE_DIR}/lib${R_ARCH}
PKGLIB = ${USERDIR}/libflowWorkspace.a

 
all:  $(SHLIB)
	if [ `uname -s` = 'Darwin' ]; then install_name_tool -change /usr/local/clang4/lib/libc++.1.dylib /usr/lib/libc++.1.dylib $(SHLIB); fi

$(SHLIB): $(PKGLIB)


#expose static lib for other package to link to 
$(PKGLIB): $(OBJECTS)
	mkdir -p "${USERDIR}"
	$(AR) rs "${PKGLIB}" $(OBJECTS)


.PHONY: 	all clean 

clean:
		rm -f $(OBJECTS) $(SHLIB)
 
