The R Project SVN R

Rev

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

#-*- Makefile -*-
include ../gnuwin32/MkRules
R_HOME=../..

VER=$(shell sed -e 's/\([^ ]*\).*/\1/' ../../VERSION)

## keep these in step with ./Makefile.in
SRC_HEADERS = R.h S.h Rdefines.h Rembedded.h Rinternals.h
## this deliberately does not include Rinterfaces.h, which is Unix-only
OBJ_HEADERS = Rconfig.h Rmath.h Rversion.h
GW32_HEADERS = iconv.h psignal.h

all: fixh config.h
    @echo 'installing C headers'
    @mkdir -p $(R_HOME)/include/R_ext
    @cp -p $(SRC_HEADERS) $(OBJ_HEADERS) iconv.h $(R_HOME)/include
    @cp -p R_ext/*.h $(R_HOME)/include/R_ext
    @cp -p ../extra/graphapp/graphapp.h ../extra/graphapp/ga.h \
      $(R_HOME)/include

version: Rversion.h

fixh: $(GW32_HEADERS) $(OBJ_HEADERS)
    @$(ECHO) done > fixh

config.h: ../gnuwin32/fixed/h/config.h ../../VERSION
    @$(SED) 's/@VERSION@/$(VER)/' $< > $@

iconv.h: ../gnuwin32/fixed/h/iconv.h
    @cp $< $@

psignal.h: ../gnuwin32/fixed/h/psignal.h
    @cp $< $@

SC_proxy.h: ../gnuwin32/front-ends/SC_proxy.h
    @cp $< $@

SC_system.h: ../gnuwin32/front-ends/SC_system.h
    @cp $< $@

rproxy.h: ../gnuwin32/front-ends/rproxy.h
    @cp $< $@

bdx.h: ../gnuwin32/front-ends/bdx.h
    @cp $< $@

bdx_SEXP.h: ../gnuwin32/front-ends/bdx_SEXP.h
    @cp $< $@

bdx_com.h: ../gnuwin32/front-ends/bdx_com.h
    @cp $< $@

bdx_util.h: ../gnuwin32/front-ends/bdx_util.h
    @cp $< $@

com_util.h: ../gnuwin32/front-ends/com_util.h
    @cp $< $@

Rconfig.h: config.h $(R_HOME)/tools/GETCONFIG
    @sh $(R_HOME)/tools/GETCONFIG > Rconfig.h

Rversion.h: $(R_HOME)/VERSION $(R_HOME)/SVN-REVISION $(R_HOME)/tools/GETVERSION
    @sh $(R_HOME)/tools/GETVERSION > $@

Rmath.h0: Rmath.h0.in $(R_HOME)/VERSION
    @$(SED) -e 's/@RMATH_HAVE_LOG1P@/# define HAVE_LOG1P 1/'  \
      -e /@RMATH_HAVE_EXPM1@/d  \
      -e  's/@RMATH_HAVE_WORKING_LOG1P@/# define HAVE_WORKING_LOG1P 1/' \
      -e  's/@RMATH_HAVE_WORKING_LOG@/# define HAVE_WORKING_LOG 1/' \
      -e "s/@PACKAGE_VERSION@/`sed 's/\([^ ]*\).*/\1/' < $(R_HOME)/VERSION`/" $< > Rmath.h0

Rmath.h: Rmath.h0
    @sh $(R_HOME)/tools/copy-if-change $< $@

## If we do not have svn, get the old file from SVN-REVISION.bak (if poss).
## This needs to be copy-on-change.
## The date from svn info is not in GMT, but we have decided to live
## with that as they changed the format in svn 1.4.x
## <FIXME> USE_SVNVERSION does not work if there is no 'svnversion'
FORCE:
$(R_HOME)/SVN-REVISION: FORCE
    @if test -f  $(R_HOME)/SVN-REVISION ; then \
      cp -p $(R_HOME)/SVN-REVISION $(R_HOME)/SVN-REVISION.bak ; \
    fi
ifdef USE_SVNVERSION
    @LC_ALL=C svnversion ../.. | sed -n 's/^/Revision: /p' > svn-tmp || rm -f svn-tmp
    @grep -v exported svn-tmp > /dev/null || rm -f svn-tmp
else
    @(cd ../..; LC_ALL=C svn info || echo "Revision: unknown") 2> /dev/null \
      | sed -n '/^Revision/p' > svn-tmp
    @if grep unknown svn-tmp > /dev/null ; then \
      rm svn-tmp; \
    fi
endif
    @if test -f svn-tmp ; then \
      (cd ../..; LC_ALL=C TZ=GMT svn info || echo "Last Changed Date: unknown") 2> /dev/null \
        | sed -n '/^Last Changed Date:/p' | sed 's/[0-9][0-9]:.*//' \
        >> svn-tmp ; \
    else \
      rm -f svn-tmp ; \
    fi
    @if test -f svn-tmp; then \
      if test ! -f $@ || ! cmp svn-tmp $@ > /dev/null ; then\
        cp svn-tmp $@; \
      fi ; \
    else \
      cp -p $(R_HOME)/SVN-REVISION.bak $@ 2> /dev/null || \
      (echo "Revision: 00000" > $@; \
       echo "Last Changed Date: 2006-00-00" >> $@) ; \
    fi 
    @rm -f svn-tmp $(R_HOME)/SVN-REVISION.bak

distclean:
    $(RM) -f Rmath.h0 fixh