#
# ${R_HOME}/src/modules/aqua/Makefile

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

top_builddir = ../../..
subdir = src/modules/aqua
R_HOME = $(top_builddir)

include $(top_builddir)/Makeconf

SOURCES = aquaconsole.c DataBrowser.c aquaprefs.c dataentry.c \
          browsepkgs.c print.c datamanager.c packagemanager.c  helpsearch.c
HEADERS = DataBrowser.h Raqua.h
DEPENDS = $(SOURCES:.c=.d)
OBJECTS = $(SOURCES:.c=.lo)

distdir = $(top_builddir)/$(PACKAGE)-$(VERSION)/$(subdir)
DISTFILES = AquaReadMe.txt  Raete.r Makefile.in Info.plist.in \
  CHANGES RMacOSX-FAQ.html RMacOSX-FAQ.texi $(SOURCES) $(HEADERS)

SUBDIRS_WITH_NO_BUILD = Contents

## <FIXME>
## Change to 'aqua.la' when using libtool for shlibs.
## Remove when using automake ... also fix target 'install' then.
aqua_la = R_aqua$(SHLIB_EXT)
## </FIXME>
Rexecmodulesdir_LTLIBRARIES = $(aqua_la)
aqua_la_SOURCES = $(SOURCES)
aqua_la_OBJECTS = $(OBJECTS)
@USE_LIBTOOL_TRUE@aqua_la_LDFLAGS = -avoid-version -rpath "$(Rexecmodulesdir)" -module
aqua_la_LIBADD = $(LIBR)

all: Makefile Makedeps R  Info.plist Contents/Info.plist

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

Makedeps: Makefile $(DEPENDS)
	@cat $(DEPENDS) >> Makefile
	@touch $@

R: Makefile
	@$(MAKE) Makedeps
	@$(MAKE) $(Rexecmodulesdir_LTLIBRARIES)

$(aqua_la): $(aqua_la_OBJECTS) $(aqua_la_DEPENDENCIES)
	$(SHLIB_LINK) -o $@ $(aqua_la_LDFLAGS) $(aqua_la_OBJECTS) $(aqua_la_LIBADD)
## <FIXME>
## Not sure if we want to do this ...
	@$(MAKE) rhome="$(abs_top_builddir)" install
## </FIXME>

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

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


install: installdirs
@USE_LIBTOOL_FALSE@	@$(SHELL) $(top_srcdir)/tools/copy-if-change $(aqua_la) "$(Rexecmodulesdir)/R_aqua$(SHLIB_EXT)"
@USE_LIBTOOL_TRUE@	@$(LIBTOOL) --mode=install $(INSTALL) $(aqua_la) "$(Rexecmodulesdir)"
installdirs:
	@$(MKINSTALLDIRS) "$(Rexecmodulesdir)"
install-strip:
	$(MAKE) INSTALL_PROGRAM="${INSTALL_PROGRAM} -s" install
uninstall:
	@rm -f "$(Rexecmodulesdir)/R_aqua$(SHLIB_EXT)"

mostlyclean: clean
clean:
	@-rm -rf .libs _libs
	@-rm -f Makedeps *.d *.o *.a *.lo *.la *$(SHLIB_EXT)
distclean: clean
	@-rm -f Makefile  Info.plist Contents/Info.plist
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
	@for d in $(SUBDIRS_WITH_NO_BUILD); do \
	  ((cd $(srcdir); $(TAR) -c -f - $(DISTDIR_TAR_EXCLUDE) $${d}) \
	      | (cd $(distdir); $(TAR) -x -f -)) \
	    || exit 1; \
	done

## Automagically generated dependencies:
