top_builddir = ..
prefix      = /usr/local
exec_prefix = ${prefix}
libdir      = ${exec_prefix}/lib
includedir  = ${prefix}/include
mandir      = ${prefix}/man
bindir	    = ${exec_prefix}/bin
SHELL       = /bin/sh
RM          = rm -fr
INSTALL	    = /usr/bin/install -c
LIBTOOL	    = $(SHELL) $(top_builddir)/libtool


TARGET = libetpan.la

VERSINFO    = 2:3:1
CC          = gcc
LDFLAGS     = -llockfile  -lssl -lcrypto  -pthread  -ldb-4.2

SUBLIBS = data-types/libdata-types.la \
	low-level/liblow-level.la \
	driver/libdriver.la \
	main/libmain.la \
	engine/libengine.la \


SUBDIRS = data-types \
	low-level \
	driver \
	main \
	engine \


all: $(TARGET)

$(TARGET): Makefile $(SUBLIBS)
	$(LIBTOOL) --mode=link $(CC) $(LDFLAGS) -o $@ $(SUBLIBS) \
	  -rpath $(libdir) -version-info $(VERSINFO)

$(SUBLIBS): all-recursive

install: all install-dirs install-recursive
	$(LIBTOOL) --mode=install $(INSTALL) -m 644 $(TARGET) $(DESTDIR)$(libdir)

install-dirs:
	$(INSTALL) -d -m 755 $(DESTDIR)$(libdir)

clean: clean-recursive
	$(RM) -fr $(TARGET) .libs

prepare: prepare-recursive

all-recursive install-recursive clean-recursive \
	distclean-recursive prepare-recursive:
	@set fnord $(MAKEFLAGS); amf=$$2; \
        list='$(SUBDIRS)'; for subdir in $$list; do \
         target=`echo $@ | sed s/-recursive//`; \
         echo "Making $$target in $$subdir"; \
         (cd $$subdir && $(MAKE) $$target) \
          || case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \
        done && test -z "$$fail"

Makefile: Makefile.in ../config.status
	cd ${top_builddir} && CONFIG_FILES=src/Makefile CONFIG_HEADERS= ./config.status

distclean: clean
	rm -rf Makefile 

