The R Project SVN R

Rev

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

Rev Author Line No. Line
2158 hornik 1
#
4580 hornik 2
# ${R_HOME}/src/scripts/Makefile
2158 hornik 3
 
4
VPATH = @srcdir@
5
srcdir = @srcdir@
6
top_srcdir = @top_srcdir@
7
 
8
top_builddir = ../..
2456 hornik 9
subdir = src/scripts
2158 hornik 10
 
11
include $(top_builddir)/Makeconf
12
 
47538 ripley 13
## don't add '#! R_SHELL' for scripts intend to be run by 'R CMD script'
57136 ripley 14
SCRIPTS_S = BATCH COMPILE INSTALL LINK REMOVE Rd2pdf Rdconv Rdiff Rprof \
63335 ripley 15
  SHLIB Stangle Sweave build check config
22584 hornik 16
## <NOTE>
17
## Need target rules for all elements of SCRIPTS_B_IN/SCRIPTS_B.
75653 ripley 18
SCRIPTS_B_IN = Rcmd.in javareconf.in mkinstalldirs.in pager.in rtags.in
11482 hornik 19
SCRIPTS_B = $(SCRIPTS_B_IN:.in=)
22584 hornik 20
## </NOTE>
5122 hornik 21
 
2456 hornik 22
distdir = $(top_builddir)/$(PACKAGE)-$(VERSION)/$(subdir)
30438 hornik 23
DISTFILES = Makefile.in Makefile.win $(SCRIPTS_S) $(SCRIPTS_B_IN) R.sh.in
2456 hornik 24
 
29659 hornik 25
CLEANFILES =
22584 hornik 26
DISTCLEANFILES = Makefile R.fe R.sh $(SCRIPTS_B)
2158 hornik 27
 
5476 hornik 28
all: Makefile R
29
 
30
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
17899 hornik 31
	@cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@
5476 hornik 32
 
11493 hornik 33
R: $(SCRIPTS_B) R.fe
14068 hornik 34
	@$(MAKE) rhome=$(top_builddir) install-cmds
39184 hornik 35
	@$(INSTALL_SCRIPT) R.fe $(top_builddir)/bin/R
2158 hornik 36
 
22584 hornik 37
## <NOTE>
38
## Seems we need target rules for creating FOO from FOO.in: pattern
39
## rules ('%:%.in') are not portable, and some versions of Make do not
40
## allow separated dependencies for single suffix rules.
46821 ripley 41
Rcmd: $(srcdir)/Rcmd.in $(top_builddir)/config.status
42
	@cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@
63253 ripley 43
javareconf: $(srcdir)/javareconf.in $(top_builddir)/config.status
44
	@cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@
46832 ripley 45
makeinstalldirs: $(srcdir)/makeinstalldirs.in $(top_builddir)/config.status
46
	@cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@
46821 ripley 47
pager: $(srcdir)/pager.in $(top_builddir)/config.status
48
	@cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@
63335 ripley 49
rtags: $(srcdir)/rtags.in $(top_builddir)/config.status
50
	@cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@
22584 hornik 51
## The following target helps in automatically generating the above
43482 ripley 52
## target rules (provided that $(ECHO) understands backslash escapes).
22584 hornik 53
Makerules:
54
	@(dep="\$$(top_builddir)/config.status"; \
55
	  cmd="@cd \$$(top_builddir)"; \
56
	  cmd="$${cmd} && \$$(SHELL) ./config.status \$$(subdir)/\$$@"; \
57
	  for f in $(SCRIPTS_B); do \
43482 ripley 58
	    $(ECHO) "$${f}: \$$(srcdir)/$${f}.in $${dep}"; \
59
	    $(ECHO) "	$${cmd}"; \
22584 hornik 60
	  done)
61
## </NOTE>
5122 hornik 62
 
18626 hornik 63
## <NOTE>
64
## The front-end shell script now (2000-08-02) also contains the version
65
## information.  As we keep this information outside configure (as
66
## otherwise developers would have to reconfigure and hence rebuild
67
## every day), we now first create 'R.sh' from 'R.sh.in' via configure,
68
## and then use sed to create the front end ('R.fe') which gets
69
## installed as 'R'.
11482 hornik 70
R.sh: $(srcdir)/R.sh.in $(top_builddir)/config.status
23203 hornik 71
	@cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@
34560 ripley 72
R.fe: R.sh $(top_srcdir)/VERSION $(top_builddir)/SVN-REVISION
43482 ripley 73
	@$(ECHO) "creating $(subdir)/$@"
10093 hornik 74
	@(v=`cat $(top_srcdir)/VERSION`; \
34560 ripley 75
	  dat=`sed -e 1d -e 's/^Last Changed Date: //' $(top_builddir)/SVN-REVISION`; \
76
	  v="$${v} ($${dat})"; \
43482 ripley 77
	  y=`$(ECHO) $${dat} | cut -d- -f1`; \
78
	  d=`$(ECHO) "$(abs_top_builddir)" | sed 's,/,\\\/,g'`; \
44146 plummer 79
	  sed "1,/R_HOME_DIR/s/\\(R_HOME_DIR=\\).*/\\1\"$${d}\"/; \
11493 hornik 80
	       s@REPLACE_BY_VERSION@$${v}@; \
81
	       s@REPLACE_BY_YEAR@$${y}@" < R.sh > $@)
10093 hornik 82
	@chmod +x $@
18626 hornik 83
## </NOTE>
10093 hornik 84
 
11203 hornik 85
$(top_builddir)/libtool:
86
	@(cd $(@D); $(MAKE) $(@F))
87
 
14068 hornik 88
install: installdirs install-cmds
41422 ripley 89
	@rm -f $(DESTDIR)$(bindir)/R
43482 ripley 90
	@(d=`$(ECHO) '$(rhome)' | sed 's,/,\\\/,g';`; \
58318 ripley 91
	  d2=`$(ECHO) '$(rsharedir)' | sed 's,/,\\\/,g';`; \
92
	  d3=`$(ECHO) '$(rincludedir)' | sed 's,/,\\\/,g';`; \
93
	  d4=`$(ECHO) '$(rdocdir)' | sed 's,/,\\\/,g';`; \
94
	  sed -e "1,/R_HOME_DIR=/s/\\(R_HOME_DIR=\\).*/\\1$${d}/;" -e "s/\\(R_SHARE_DIR=\\).*/\\1$${d2}/;" -e  "s/\\(R_INCLUDE_DIR=\\).*/\\1$${d3}/;" -e "s/\\(R_DOC_DIR=\\).*/\\1$${d4}/;"\
41422 ripley 95
	  < R.fe > "$(DESTDIR)$(Rexecbindir)/R")
96
	@$(INSTALL_SCRIPT)  "$(DESTDIR)$(Rexecbindir)/R" "$(DESTDIR)$(bindir)/R"
97
	@chmod 755 "$(DESTDIR)$(bindir)/R" "$(DESTDIR)$(Rexecbindir)/R"
98
## why of all the scripts does this alone chmod just one copy?
14068 hornik 99
installdirs:
41422 ripley 100
	@$(MKINSTALLDIRS) $(DESTDIR)$(bindir)
14068 hornik 101
install-cmds:
41422 ripley 102
	@$(MKINSTALLDIRS) "$(DESTDIR)$(Rexecbindir)"
47440 ripley 103
	@for f in $(SCRIPTS_S); do \
61935 hornik 104
	  source="$(srcdir)/$${f}"; \
105
	  target="$(DESTDIR)$(Rexecbindir)/$${f}"; \
106
	  (test -r "$${target}" && \
107
	   cmp "$${source}" "$${target}" > /dev/null) || \
108
	    $(INSTALL_SCRIPT) "$${source}" "$${target}"; \
14068 hornik 109
	done
47438 ripley 110
	@for f in $(SCRIPTS_B); do \
111
	  $(INSTALL_SCRIPT) $${f} "$(DESTDIR)$(Rexecbindir)"; \
112
	done
41422 ripley 113
	@$(INSTALL_SCRIPT) $(top_builddir)/libtool "$(DESTDIR)$(Rexecbindir)"
40410 ripley 114
## there are no programs to install in this dir
14068 hornik 115
install-strip:
40399 ripley 116
	@$(MAKE) INSTALL_PROGRAM="${INSTALL_PROGRAM} -s" install
14068 hornik 117
uninstall:
118
	@for f in $(SCRIPTS_S) $(SCRIPTS_B) libtool R; do \
41422 ripley 119
	  rm -f "$(DESTDIR)$(Rexecbindir)/$${f}"; \
14068 hornik 120
	done
41422 ripley 121
	@rm -f $(DESTDIR)$(bindir)/R
14068 hornik 122
 
2158 hornik 123
mostlyclean: clean
124
clean:
22584 hornik 125
	-@test -z "$(CLEANFILES)" || rm -f $(CLEANFILES)
126
distclean: clean
127
	-@test -z "$(DISTCLEANFILES)" || rm -f $(DISTCLEANFILES)
2158 hornik 128
maintainer-clean: distclean
2456 hornik 129
 
14068 hornik 130
TAGS info dvi check:
131
 
2456 hornik 132
distdir: $(DISTFILES)
133
	@for f in $(DISTFILES); do \
134
	  test -f $(distdir)/$${f} \
135
	    || ln $(srcdir)/$${f} $(distdir)/$${f} 2>/dev/null \
136
	    || cp -p $(srcdir)/$${f} $(distdir)/$${f}; \
137
	done