b22faf0d |
SUBDIRS = gmap gstruct
.PHONY: all clean $(SUBDIRS)
|
86afb162 |
OBJECTS = bamreader.o bamtally.o iit.o variantsummary.o genome.o R_init_gmapR.o
|
b22faf0d |
R_SRC_DIR = ${CURDIR}
PREFIX = ${R_SRC_DIR}/../inst/usr
INCLUDE_DIR = $(PREFIX)/include
|
ca5cb9d7 |
GSTRUCT_LIB = $(PREFIX)/$(LIBnn)/libgstruct-1.0.a
|
b22faf0d |
GSTRUCT_INCLUDE_DIR = $(INCLUDE_DIR)/gstruct
SAMTOOLS_LIB = samtools/libbam.a
|
03e8ca6d |
PKG_CPPFLAGS += -I$(INCLUDE_DIR)
|
6cc263ed |
PKG_CFLAGS += -g -O3
|
b22faf0d |
PKG_LIBS += $(GSTRUCT_LIB) $(SAMTOOLS_LIB) -lz
SHLIB = gmapR.so
all: $(SHLIB) gmap
$(SHLIB): $(OBJECTS) $(GSTRUCT_LIB)
$(SHLIB_LINK) -o $@ $(OBJECTS) $(ALL_LIBS)
$(OBJECTS): $(GSTRUCT_INCLUDE_DIR) $(OBJECTS:%.o=%.c)
$(GSTRUCT_LIB) $(GSTRUCT_INCLUDE_DIR): gstruct
|
03e8ca6d |
RSAMTOOLS_PATH := $(shell R_LIBS=$(R_LIBRARY_DIR) $(R_HOME)/bin/Rscript \
--vanilla -e 'cat(system.file(package="Rsamtools"))')
|
b22faf0d |
${R_SRC_DIR}/samtools: $(RSAMTOOLS_PATH)
## gmap/gstruct assume samtools headers and libs are in one directory,
## so we need to create one and populate it with links to Rsamtools.
rm -rf samtools; mkdir samtools
ln -sf $(RSAMTOOLS_PATH)/usrlib/$(R_ARCH)/libbam.a samtools/libbam.a
for header in $(RSAMTOOLS_PATH)/include/samtools/*.h; do \
ln -sf $$header samtools/$(notdir $(header)); \
done
$(SUBDIRS): %: %/Makefile
cd $@; \
|
29fb70f5 |
$(MAKE) install
|
b22faf0d |
gstruct/Makefile: gstruct/configure ${R_SRC_DIR}/samtools
cd $(dir $@); \
|
a49cb8de |
CFLAGS="-g -O3" \
|
03e8ca6d |
./configure --enable-static --disable-shared \
|
b22faf0d |
--prefix=${PREFIX} --includedir=${GSTRUCT_INCLUDE_DIR} \
|
10998234 |
--libdir=${PREFIX}/${LIBnn} \
|
6cc263ed |
--with-samtools-lib=${R_SRC_DIR}/samtools \
|
15c3d797 |
--disable-maintainer-mode \
|
55d77a12 |
--disable-binaries
|
b22faf0d |
## does not appear to be a true dependency yet
## --with-gmap=${PREFIX}/bin
gmap/Makefile: gmap/configure
cd $(dir $@); \
|
c78be696 |
./configure --with-gmapdb=${GMAPDB} --prefix=${PREFIX} \
|
ff0b3d97 |
--libdir=${PREFIX}/${LIBnn} --disable-maintainer-mode
|
b22faf0d |
clean:
for dir in $(SUBDIRS); do \
$(MAKE) -C $$dir distclean; \
done
rm -rf samtools $(PREFIX)
rm -f *.o *.so *.dll
|