The R Project SVN R

Rev

Rev 33029 | Rev 35550 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | Download | RSS feed

#
# ${R_HOME}/src/nmath/standalone/Makefile

VPATH = @srcdir@
srcdir = @srcdir@
top_srcdir = @top_srcdir@

top_builddir = ../../..
subdir = src/nmath/standalone

include $(top_builddir)/Makeconf

SOURCES_NMATH = \
    mlutils.c \
    d1mach.c i1mach.c \
    fmax2.c fmin2.c fprec.c fround.c ftrunc.c \
    sign.c fsign.c \
    imax2.c imin2.c \
    chebyshev.c log1p.c expm1.c lgammacor.c gammalims.c stirlerr.c bd0.c \
    gamma.c lgamma.c gamma_cody.c beta.c lbeta.c polygamma.c \
    bessel_i.c bessel_j.c bessel_k.c bessel_y.c \
    choose.c \
    snorm.c sexp.c \
    dgamma.c pgamma.c qgamma.c rgamma.c \
    dbeta.c pbeta.c qbeta.c rbeta.c \
    dunif.c punif.c qunif.c runif.c \
    dnorm.c pnorm.c qnorm.c rnorm.c \
    dlnorm.c plnorm.c qlnorm.c rlnorm.c \
    df.c pf.c qf.c rf.c \
    dt.c pt.c qt.c rt.c \
    dchisq.c pchisq.c qchisq.c rchisq.c rnchisq.c \
    dbinom.c pbinom.c qbinom.c rbinom.c \
    rmultinom.c \
    dcauchy.c pcauchy.c qcauchy.c rcauchy.c \
    dexp.c pexp.c qexp.c rexp.c \
    dgeom.c pgeom.c qgeom.c rgeom.c \
    dhyper.c phyper.c qhyper.c rhyper.c \
    dnbinom.c pnbinom.c qnbinom.c rnbinom.c \
    dpois.c ppois.c qpois.c rpois.c \
    dweibull.c pweibull.c qweibull.c rweibull.c \
    dlogis.c plogis.c qlogis.c rlogis.c \
    dnchisq.c pnchisq.c qnchisq.c \
    dnbeta.c pnbeta.c \
    pnf.c pnt.c \
    ptukey.c qtukey.c \
    toms708.c wilcox.c \
    signrank.c
SOURCES = $(SOURCES_NMATH) std_unif.c
DEPENDS = $(SOURCES:.c=.d)
OBJECTS = $(SOURCES:.c=.o)

distdir = $(top_builddir)/$(PACKAGE)-$(VERSION)/$(subdir)
DISTFILES = Makefile.in test.c sunif.c

Rexeclibdir_LIBRARIES = libRmath.a
libRmath_a_SOURCES = $(SOURCES)
libRmath_a_OBJECTS = $(OBJECTS)

## <FIXME>
## Change to 'libRmath.la' when using libtool for shlibs.
## Remove when using automake ...
libRmath_la = libRmath$(DYLIB_EXT)
## </FIXME>
Rexeclibdir_LTLIBRARIES = $(libRmath_la)
libRmath_la_SOURCES = $(SOURCES)
libRmath_la_OBJECTS = $(OBJECTS:.o=.lo)
libRmath_la_LDFLAGS =

CLEANFILES = Makedeps *.d *.o *.lo test $(SOURCES)
DISTCLEANFILES = Makefile $(Rexeclibdir_LIBRARIES) $(Rexeclibdir_LTLIBRARIES)

DEFS = -DHAVE_CONFIG_H -DMATHLIB_STANDALONE
ALL_CPPFLAGS = $(R_XTRA_CPPFLAGS) -I$(srcdir)/.. $(CPPFLAGS) $(DEFS)

.SUFFIXES:
.SUFFIXES: .c .d .o .lo

all: Makefile static shared

## can't run test, as that depends on OS-specific way to set library path.
## clean is useful, but forces a remake each time which MM did not want
check: all # clean

Copy:
    @echo "Copying source files"
    @test -f std_unif.c || $(LN_S) $(srcdir)/sunif.c std_unif.c
    @for f in $(SOURCES_NMATH); do \
      test -f $${f} || $(LN_S) $(srcdir)/../$${f} . ; \
    done

static: Makefile ../../include/Rconfig.h Copy Makedeps
    @$(MAKE) $(Rexeclibdir_LIBRARIES)

shared: Makefile ../../include/Rconfig.h Copy Makedeps
    @$(MAKE) $(Rexeclibdir_LTLIBRARIES)

../../include/Rconfig.h:
    (cd $(@D); $(MAKE) $(@F))

Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
    @cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@

Makedeps: Makefile ../../include/Rconfig.h
    @$(MAKE) $(DEPENDS)
    @cat $(DEPENDS) >> Makefile
    @cat $(DEPENDS) | sed s/\.o:/.lo:/>> Makefile
    @touch $@

libRmath.a: $(libRmath_a_OBJECTS)
    $(AR) cr $@ $(libRmath_a_OBJECTS)
    $(RANLIB) $@

$(libRmath_la): $(libRmath_la_OBJECTS)
    $(DYLIB_LINK) -o $@ $(libRmath_la_LDFLAGS) $(libRmath_la_OBJECTS)

test: $(srcdir)/test.c
    $(CC) -o $@ $(ALL_CPPFLAGS) $(ALL_CFLAGS) $(srcdir)/test.c \
      -L. -lRmath $(LIBM)

install: installdirs install-header
    @!(test -f $(libRmath_la)) || $(SHELL) $(top_srcdir)/tools/copy-if-change $(libRmath_la) $(libdir)/$(libRmath_la)
    @!(test -f libRmath.a) || $(SHELL) $(top_srcdir)/tools/copy-if-change libRmath.a $(libdir)/libRmath.a

install-header:
    @(cd ../../include; $(MAKE) Rmath.h)
    @$(SHELL) $(top_srcdir)/tools/copy-if-change ../../include/Rmath.h $(includedir)/Rmath.h


installdirs:
    @$(MKINSTALLDIRS) $(includedir)
    @$(MKINSTALLDIRS) $(libdir)

uninstall:
    @rm -f $(includedir)/Rmath.h $(libdir)/$(libRmath_la) $(libdir)/libRmath.a

mostlyclean: clean
clean:
    @-test -z "$(CLEANFILES)" || rm -f $(CLEANFILES)
    @-rm -rf .libs _libs
distclean: clean
    @-test -z "$(DISTCLEANFILES)" || rm -f $(DISTCLEANFILES)
maintainer-clean: distclean

distdir: $(DISTFILES)
    @for f in $(DISTFILES); do \
      test -f $(distdir)/$${f} \
        || ln $(srcdir)/$${f} $(distdir)/$${f} 2>/dev/null \
        || cp -p $(srcdir)/$${f} $(distdir)/$${f}; \
    done

## Automagically generated dependencies: