#
# ${R_HOME}/etc/Makefile

VPATH = @srcdir@
srcdir = @srcdir@
top_srcdir = @top_srcdir@

top_builddir = ..
subdir = etc

include $(top_builddir)/Makeconf

SOURCES = Makeconf.in Renviron.in
OBJECTS = $(SOURCES:.in=)
distdir = $(top_builddir)/$(PACKAGE)-$(VERSION)/$(subdir)
DISTFILES = Makefile.in $(SOURCES)

EXPORTFILE = @EXPORTFILE@

## <FIXME>
## Remove eventually.
GNOME_IF_FILES = @GNOME_IF_FILES@
CLEANFILES = $(GNOME_IF_FILES) Makeconf-tests
## </FIXME>

all: Makefile R

.SUFFIXES:
.SUFFIXES: .in

.in:
	@cd $(top_builddir) && \
	  CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= \
	  $(SHELL) ./config.status

Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
	@cd $(top_builddir) && \
	  CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= \
	  $(SHELL) ./config.status
	@(for f in $(OBJECTS); do \
	    echo "$${f}: $(srcdir)/$${f}.in"; \
	  done) >> $@

R: $(OBJECTS)
$(OBJECTS): $(top_builddir)/config.status

install: installdirs
	@echo "installing $(subdir) ..."
	@for f in $(OBJECTS) $(EXPORTFILE); do \
	  $(INSTALL_DATA) $${f} $(rhome)/etc; \
	done
installdirs:
	@$(MKINSTALLDIRS) $(rhome)/etc
install-strip: install

uninstall:
	@echo "uninstalling $(subdir) ..."
	@if test -d $(rhome)/$(subdir) \
	  && test "`cd $(rhome); $(GETWD)`" \
	       != "`cd $(top_builddir); $(GETWD)`"; then \
	  (cd $(rhome)/etc && \
	    rm -f $(OBJECTS) $(EXPORTFILE) *.pl $(CLEANFILES)); \
	  rmdir $(rhome)/etc 2> /dev/null \
	    || echo "  subdir etc not removed"; \
	fi

mostlyclean: clean
clean:
## <FIXME>
## Remove eventually.
	@if test "$(BUILDDIR_IS_SRCDIR)" = no ; then \
	  rm -f *.pl $(CLEANFILES); \
	fi
## </FIXME>
	@rm -f $(EXPORTFILE)
distclean: clean
	@rm -f $(OBJECTS) Makefile
maintainer-clean: distclean

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

## Automagically generated dependencies: