## Flags needed in src
PKG_LIB_A    = ../inst/lib/libMixAll.a
PKG_PROJECTS =  -I../inst/include -I../inst/projects/

######
## Use the R_HOME indirection to support installations of multiple R version
# flags needed by R
PKG_LIBS     = $(PKG_LIB_A) $(LAPACK_LIBS) $(BLAS_LIBS) $(FLIBS) $(SHLIB_OPENMP_CXXFLAGS)
PKG_CXXFLAGS = `$(R_HOME)/bin$(R_ARCH_BIN)/Rscript -e "rtkore:::CxxFlags()"` $(PKG_PROJECTS)  $(SHLIB_OPENMP_CXXFLAGS)
PKG_CPPFLAGS = `$(R_HOME)/bin$(R_ARCH_BIN)/Rscript -e "rtkore:::CppFlags()"`


## debug flags PKG_CPPFLAGS and STK_CPPFLAGS
#-DSTK_MIXTURE_DEBUG -DSTK_MIXTURE_VERBOSE -DSTK_MIXTURE_VERY_VERBOSE

## Flags needed in Clustering and MixAll projects
export STK_CPPFLAGS  = $(ALL_CPPFLAGS) # CPPFLAGS already in ALL_CPPFLAGS 
export STK_CXXFLAGS  = $(ALL_CXXFLAGS) # CXXFLAGS already in ALL_CXXFLAGS
export LIB_MIXALL_A = libMixAll.a

.PHONY: all mixall

all: $(SHLIB)
$(SHLIB): mixall

mixall:
	(cd ../inst && $(MAKE) CXX="$(CXX)" AR="$(AR)" ARFLAGS="$(ARFLAGS)" CXXFLAGS="$(CXXFLAGS)" CPPFLAGS="$(CPPFLAGS)" CXXPICFLAGS="$(CXXPICFLAGS)")
	(cd ../inst && $(MAKE) clean)

# From Kurt Hornick on R-project.org
# You need to pass at least 
#  CXX CXXFLAGS CXXPICFLAGS
#
# to the compilation in the subdirs to ensure that the same compiler (and
# flags) are used.  I.e.,
# (cd $(COCLUSTDIR) && $(MAKE) CXX=$(CXX) .......)
#
#Hth
#-k
	
