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

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

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

include $(top_builddir)/Makeconf

SOURCES = Rsock.c internet.c nanoftp.c nanohttp.c sock.c sockconn.c
HEADERS = sock.h win32config.h 
DEPENDS = $(SOURCES:.c=.d)
OBJECTS = $(SOURCES:.c=.lo)

distdir = $(top_builddir)/$(PACKAGE)-$(VERSION)/$(subdir)
DISTFILES = \
	README Makefile.in Makefile.win $(SOURCES) $(HEADERS) \
	dllversion.rc internet.mcp.hqx

## FIXME:
## Change to `internet.la' when using libtool for shlibs.
## Remove when using automake ... also fix install then.
internet_la = internet$(SHLIB_EXT)
## </FIXME>
Rexecmodulesdir_LTLIBRARIES = $(internet_la)
internet_la_SOURCES = $(SOURCES)
internet_la_OBJECTS = $(OBJECTS)
@USE_LIBTOOL_TRUE@internet_la_LDFLAGS = -avoid-version -rpath $(Rexecmodulesdir) -module
internet_la_LIBADD = $(LIBR)

all: Makefile Makedeps R

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

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

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

$(internet_la): $(internet_la_OBJECTS) $(internet_la_DEPENDENCIES)
	$(SHLIB_LINK) -o $@ $(internet_la_LDFLAGS) $(internet_la_OBJECTS) $(internet_la_LIBADD)
## FIXME: Not sure if we want to do this ...
	@$(MAKE) rhome=`cd $(top_builddir); pwd` install
## </FIXME>

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

mostlyclean: clean
clean:
	@-rm -rf .libs _libs
	@-rm -f Makedeps *.d *.o *.a *.lo *.la *$(SHLIB_EXT)
distclean: clean
	@-rm -f Makefile
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

## Automagically generated dependencies:

