#
# ${R_HOME}/src/extra/pcre/Makefile

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

top_builddir = ../../..
subdir = src/extra/pcre
R_HOME = $(top_builddir)

include $(top_builddir)/Makeconf

PCRE_CPPFLAGS = -I$(srcdir)
ALL_CPPFLAGS = $(BZIP2_CPPFLAGS) $(R_XTRA_CPPFLAGS) $(CPPFLAGS) $(DEFS)

SOURCES = get.c maketables.c pcre.c study.c

HEADERS = internal.h pcre.h
DEPENDS = $(SOURCES:.c=.d)
@WANT_R_SHLIB_FALSE@OBJECTS = $(SOURCES:.c=.o)
@WANT_R_SHLIB_TRUE@OBJECTS = $(SOURCES:.c=.lo)

distdir = $(top_builddir)/$(PACKAGE)-$(VERSION)/$(subdir)
DISTFILES = LICENCE Makefile.in Makefile.win dftables.c \
  chartables.h.win $(SOURCES) $(HEADERS)
noinst_LIBRARIES = @BUILD_PCRE_TRUE@ libpcre.a
libpcre_a_SOURCES = $(SOURCES)
libpcre_a_OBJECTS = $(OBJECTS)


all: Makefile Makedeps R

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 chartables.h
	@$(MAKE) Makedeps
	@$(MAKE) $(noinst_LIBRARIES)

chartables.h: dftables
	./dftables chartables.h

dftables.o:  maketables.c internal.h pcre.h
dftables: dftables.o
	$(MAIN_LD) $(LDFLAGS) -o dftables dftables.o

libpcre.a: $(libpcre_a_OBJECTS)
	rm -f $@
	$(AR) cr $@ $(libpcre_a_OBJECTS)
	$(RANLIB) $@


mostlyclean: clean
clean:
	@-rm -f Makedeps *.d *.o *.lo *.a
distclean: clean
	@-rm -f Makefile dftables chartables.h
maintainer-clean: distclean

install install-strip uninstall 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:

