The R Project SVN R

Rev

Rev 86911 | 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 =
88582 smeyer 26
DISTCLEANFILES = Makefile 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
 
88582 smeyer 33
R: $(SCRIPTS_B) R.sh
86911 smeyer 34
	@$(MAKE) DESTDIR="" rhome=$(top_builddir) install-cmds
88582 smeyer 35
	@$(INSTALL_SCRIPT) R.sh $(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
 
11482 hornik 63
R.sh: $(srcdir)/R.sh.in $(top_builddir)/config.status
23203 hornik 64
	@cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@
10093 hornik 65
	@chmod +x $@
66
 
11203 hornik 67
$(top_builddir)/libtool:
68
	@(cd $(@D); $(MAKE) $(@F))
69
 
14068 hornik 70
install: installdirs install-cmds
41422 ripley 71
	@rm -f $(DESTDIR)$(bindir)/R
43482 ripley 72
	@(d=`$(ECHO) '$(rhome)' | sed 's,/,\\\/,g';`; \
58318 ripley 73
	  d2=`$(ECHO) '$(rsharedir)' | sed 's,/,\\\/,g';`; \
74
	  d3=`$(ECHO) '$(rincludedir)' | sed 's,/,\\\/,g';`; \
75
	  d4=`$(ECHO) '$(rdocdir)' | sed 's,/,\\\/,g';`; \
88582 smeyer 76
	  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}\"/;"\
77
	  < R.sh > "$(DESTDIR)$(Rexecbindir)/R")
41422 ripley 78
	@$(INSTALL_SCRIPT)  "$(DESTDIR)$(Rexecbindir)/R" "$(DESTDIR)$(bindir)/R"
79
	@chmod 755 "$(DESTDIR)$(bindir)/R" "$(DESTDIR)$(Rexecbindir)/R"
80
## why of all the scripts does this alone chmod just one copy?
14068 hornik 81
installdirs:
41422 ripley 82
	@$(MKINSTALLDIRS) $(DESTDIR)$(bindir)
14068 hornik 83
install-cmds:
41422 ripley 84
	@$(MKINSTALLDIRS) "$(DESTDIR)$(Rexecbindir)"
47440 ripley 85
	@for f in $(SCRIPTS_S); do \
61935 hornik 86
	  source="$(srcdir)/$${f}"; \
87
	  target="$(DESTDIR)$(Rexecbindir)/$${f}"; \
88
	  (test -r "$${target}" && \
89
	   cmp "$${source}" "$${target}" > /dev/null) || \
90
	    $(INSTALL_SCRIPT) "$${source}" "$${target}"; \
14068 hornik 91
	done
47438 ripley 92
	@for f in $(SCRIPTS_B); do \
93
	  $(INSTALL_SCRIPT) $${f} "$(DESTDIR)$(Rexecbindir)"; \
94
	done
41422 ripley 95
	@$(INSTALL_SCRIPT) $(top_builddir)/libtool "$(DESTDIR)$(Rexecbindir)"
40410 ripley 96
## there are no programs to install in this dir
14068 hornik 97
install-strip:
40399 ripley 98
	@$(MAKE) INSTALL_PROGRAM="${INSTALL_PROGRAM} -s" install
14068 hornik 99
uninstall:
100
	@for f in $(SCRIPTS_S) $(SCRIPTS_B) libtool R; do \
41422 ripley 101
	  rm -f "$(DESTDIR)$(Rexecbindir)/$${f}"; \
14068 hornik 102
	done
41422 ripley 103
	@rm -f $(DESTDIR)$(bindir)/R
14068 hornik 104
 
2158 hornik 105
mostlyclean: clean
106
clean:
22584 hornik 107
	-@test -z "$(CLEANFILES)" || rm -f $(CLEANFILES)
108
distclean: clean
109
	-@test -z "$(DISTCLEANFILES)" || rm -f $(DISTCLEANFILES)
2158 hornik 110
maintainer-clean: distclean
2456 hornik 111
 
14068 hornik 112
TAGS info dvi check:
113
 
2456 hornik 114
distdir: $(DISTFILES)
115
	@for f in $(DISTFILES); do \
116
	  test -f $(distdir)/$${f} \
117
	    || ln $(srcdir)/$${f} $(distdir)/$${f} 2>/dev/null \
118
	    || cp -p $(srcdir)/$${f} $(distdir)/$${f}; \
119
	done