The R Project SVN R

Rev

Rev 61307 | Rev 67638 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
30054 ripley 1
#-*- Makefile -*-
2
include ../gnuwin32/MkRules
3
R_HOME=../..
4
 
43390 ripley 5
VER=$(shell sed -e 's/\([^ ]*\).*/\1/' ../../VERSION)
6
 
30054 ripley 7
## keep these in step with ./Makefile.in
44934 ripley 8
SRC_HEADERS = R.h S.h Rdefines.h Rembedded.h Rinternals.h
31538 ripley 9
## this deliberately does not include Rinterfaces.h, which is Unix-only
30054 ripley 10
OBJ_HEADERS = Rconfig.h Rmath.h Rversion.h
46436 ripley 11
GW32_HEADERS = iconv.h psignal.h
30054 ripley 12
 
43424 ripley 13
all: fixh config.h
30054 ripley 14
	@echo 'installing C headers'
15
	@mkdir -p $(R_HOME)/include/R_ext
46407 ripley 16
	@cp -p $(SRC_HEADERS) $(OBJ_HEADERS) iconv.h $(R_HOME)/include
30054 ripley 17
	@cp -p R_ext/*.h $(R_HOME)/include/R_ext
42521 ripley 18
	@cp -p ../extra/graphapp/graphapp.h ../extra/graphapp/ga.h \
30077 ripley 19
	  $(R_HOME)/include
30054 ripley 20
 
21
version: Rversion.h
22
 
46407 ripley 23
fixh: $(GW32_HEADERS) $(OBJ_HEADERS)
30054 ripley 24
	@$(ECHO) done > fixh
25
 
61307 ripley 26
ifeq "$(WIN)" "64"
43424 ripley 27
config.h: ../gnuwin32/fixed/h/config.h ../../VERSION
61307 ripley 28
	@$(SED) -e 's/@VERSION@/$(VER)/' -e 's/@ST@/8/' $< > $@
29
else
30
config.h: ../gnuwin32/fixed/h/config.h ../../VERSION
31
	@$(SED) -e 's/@VERSION@/$(VER)/' -e 's/@ST@/4/' $< > $@
32
endif
30074 ripley 33
 
61352 ripley 34
Rconfig.h: ../gnuwin32/fixed/h/Rconfig.h
35
	@cp $< $@
36
 
32482 ripley 37
iconv.h: ../gnuwin32/fixed/h/iconv.h
38
	@cp $< $@
39
 
30074 ripley 40
psignal.h: ../gnuwin32/fixed/h/psignal.h
41
	@cp $< $@
35017 ripley 42
 
34560 ripley 43
Rversion.h: $(R_HOME)/VERSION $(R_HOME)/SVN-REVISION $(R_HOME)/tools/GETVERSION
46835 ripley 44
	@sh $(R_HOME)/tools/GETVERSION > $@
30054 ripley 45
 
54768 ripley 46
Rmath.h0: Rmath.h0.in $(R_HOME)/VERSION Makefile.win
30072 ripley 47
	@$(SED) -e 's/@RMATH_HAVE_LOG1P@/# define HAVE_LOG1P 1/'  \
54768 ripley 48
	  -e 's/@RMATH_HAVE_EXPM1@/# define HAVE_EXPM1 1/'  \
49
	  -e 's/@RMATH_HAVE_HYPOT@/# define HAVE_HYPOT 1/'  \
30054 ripley 50
	  -e  's/@RMATH_HAVE_WORKING_LOG1P@/# define HAVE_WORKING_LOG1P 1/' \
51
	  -e "s/@PACKAGE_VERSION@/`sed 's/\([^ ]*\).*/\1/' < $(R_HOME)/VERSION`/" $< > Rmath.h0
52
 
53
Rmath.h: Rmath.h0
54
	@sh $(R_HOME)/tools/copy-if-change $< $@
34417 ripley 55
 
56
## If we do not have svn, get the old file from SVN-REVISION.bak (if poss).
57
## This needs to be copy-on-change.
39448 ripley 58
## The date from svn info is not in GMT, but we have decided to live
59
## with that as they changed the format in svn 1.4.x
34417 ripley 60
## <FIXME> USE_SVNVERSION does not work if there is no 'svnversion'
34418 ripley 61
FORCE:
62
$(R_HOME)/SVN-REVISION: FORCE
37052 ripley 63
	@if test -f  $(R_HOME)/SVN-REVISION ; then \
64
	  cp -p $(R_HOME)/SVN-REVISION $(R_HOME)/SVN-REVISION.bak ; \
65
	fi
34408 murdoch 66
ifdef USE_SVNVERSION
36904 ripley 67
	@LC_ALL=C svnversion ../.. | sed -n 's/^/Revision: /p' > svn-tmp || rm -f svn-tmp
34408 murdoch 68
	@grep -v exported svn-tmp > /dev/null || rm -f svn-tmp
69
else
36904 ripley 70
	@(cd ../..; LC_ALL=C svn info || echo "Revision: unknown") 2> /dev/null \
34417 ripley 71
	  | sed -n '/^Revision/p' > svn-tmp
72
	@if grep unknown svn-tmp > /dev/null ; then \
73
	  rm svn-tmp; \
74
	fi
34408 murdoch 75
endif
39448 ripley 76
	@if test -f svn-tmp ; then \
77
	  (cd ../..; LC_ALL=C TZ=GMT svn info || echo "Last Changed Date: unknown") 2> /dev/null \
78
	    | sed -n '/^Last Changed Date:/p' | sed 's/[0-9][0-9]:.*//' \
79
	    >> svn-tmp ; \
34417 ripley 80
	else \
81
	  rm -f svn-tmp ; \
82
	fi
34408 murdoch 83
	@if test -f svn-tmp; then \
34417 ripley 84
	  if test ! -f $@ || ! cmp svn-tmp $@ > /dev/null ; then\
85
	    cp svn-tmp $@; \
86
	  fi ; \
34408 murdoch 87
	else \
35017 ripley 88
	  cp -p $(R_HOME)/SVN-REVISION.bak $@ 2> /dev/null || \
35041 murdoch 89
	  (echo "Revision: 00000" > $@; \
39448 ripley 90
	   echo "Last Changed Date: 2006-00-00" >> $@) ; \
34408 murdoch 91
	fi 
92
	@rm -f svn-tmp $(R_HOME)/SVN-REVISION.bak
30054 ripley 93
 
94
distclean:
95
	$(RM) -f Rmath.h0 fixh