#
# ${R_HOME}/src/include/R_ext/Makefile


srcdir = .
top_srcdir = ../../..

top_builddir = ../../..
subdir = src/include/R_ext

include $(top_builddir)/Makeconf

distdir = $(top_builddir)/$(PACKAGE)-$(VERSION)/$(subdir)

## Partially included by the API (1) headers in .., but not part of the
## API per se. 
R_EXT_HEADERS = \
  Applic.h Arith.h BLAS.h Boolean.h Callbacks.h Complex.h Constants.h \
  Error.h GetX11Image.h \
  GraphicsDevice.h GraphicsEngine.h GraphicsBase.h \
  Lapack.h Linpack.h Memory.h \
  Parse.h Print.h PrtUtil.h R-ftp-http.h RS.h Random.h RConverters.h \
  Rdynload.h Utils.h eventloop.h libextern.h

## <FIXME>
## Why are the module headers not in R_EXT_HEADERS?
DISTFILES = Makefile.in $(R_EXT_HEADERS) \
  RX11.h Rinternet.h Rlapack.h
## </FIXME>
TIMESTAMPS = $(R_EXT_HEADERS:.h=.ts)

CLEANFILES = stamp-R $(TIMESTAMPS)
DISTCLEANFILES = Makefile

.SUFFIXES:
.SUFFIXES: .h .ts

.h.ts: 
	@$(INSTALL_DATA) $< $(top_builddir)/include/R_ext/`basename $<`
	@touch $@

all: Makefile R

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

R: Makefile stamp-R $(TIMESTAMPS)
stamp-R: 
	@$(MKINSTALLDIRS) $(top_builddir)/include/R_ext
	@touch $@
$(TIMESTAMPS): stamp-R

install: installdirs
	@for f in $(R_EXT_HEADERS); do \
	  $(INSTALL_DATA) $(srcdir)/$${f} $(rhome)/include/R_ext; \
	done
installdirs:
	@$(MKINSTALLDIRS) $(rhome)/include/R_ext
install-strip:
	$(MAKE) INSTALL_PROGRAM="${INSTALL_PROGRAM} -s" install
uninstall:
	@rm -rf $(rhome)/include/R_ext

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

TAGS info dvi check:

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
