#
# Top-level Makefile for TCNATIVE
#

CFLAGS = @CFLAGS@
CPPFLAGS = @CPPFLAGS@

# gets substituted into some targets
TCNATIVE_MAJOR_VERSION=@TCNATIVE_MAJOR_VERSION@
TCNATIVE_DOTTED_VERSION=@TCNATIVE_DOTTED_VERSION@
TCNATIVE_LIBTOOL_VERSION=@TCNATIVE_LIBTOOL_VERSION@

srcdir = @srcdir@
VPATH = @srcdir@

# this sucks, but it's the only way to add extra flags to the LT_COMPILE
INCLUDES = @CFLAGS@ @CPPFLAGS@ @TCNATIVE_INCLUDES@ @TCNATIVE_PRIV_INCLUDES@ @APR_INCLUDES@
TCNATIVE_LDFLAGS = @TCNATIVE_LDFLAGS@
TCNATIVE_LIBS = @TCNATIVE_LIBS@

TARGET_LIB = lib@TCNATIVE_LIBNAME@.la
EXTRA_OS_LINK=@EXTRA_OS_LINK@
TCNATIVE_PCFILE = tcnative-$(TCNATIVE_MAJOR_VERSION).pc
INSTALL = @INSTALL@
INSTALL_DATA = @INSTALL_DATA@

TARGETS = $(TARGET_LIB)

# bring in rules.mk for standard functionality
@INCLUDE_RULES@
@INCLUDE_OUTPUTS@

LINK          = $(LIBTOOL) $(LTFLAGS) --mode=link $(LT_LDFLAGS) $(COMPILE) -version-info $(TCNATIVE_LIBTOOL_VERSION) $(ALL_LDFLAGS) -o $@
CLEAN_SUBDIRS = test

CLEAN_TARGETS = .make.dirs
DISTCLEAN_TARGETS = config.cache config.log config.status libtool \
	build/rules.mk tcnative.pc
EXTRACLEAN_TARGETS = configure aclocal.m4 build-outputs.mk \
	build/apr_common.m4 build/find_apr.m4 build/install.sh \
	build/config.guess build/config.sub tcnative.spec

prefix=@prefix@
exec_prefix=@exec_prefix@
bindir=@bindir@
libdir=@libdir@
includedir=@includedir@
top_srcdir=@abs_srcdir@
top_blddir=@abs_builddir@


install: $(TARGET_LIB)
	$(APR_MKDIR) $(DESTDIR)$(includedir) $(DESTDIR)$(libdir)/pkgconfig \
		     $(DESTDIR)$(libdir) $(DESTDIR)$(bindir)
	$(INSTALL_DATA) tcnative.pc $(DESTDIR)$(libdir)/pkgconfig/$(TCNATIVE_PCFILE)
	list='$(INSTALL_SUBDIRS)'; for i in $$list; do \
		( cd $$i ; $(MAKE) DESTDIR=$(DESTDIR) install ); \
	done
	$(LIBTOOL) --mode=install $(INSTALL) -m 755 $(TARGET_LIB) $(DESTDIR)$(libdir)

$(TARGET_LIB): $(OBJECTS)
	$(LINK) @lib_target@ @TCNATIVE_LDFLAGS@ @TCNATIVE_LIBS@ @SSL_LIBS@

check: $(TARGET_LIB)
	(cd test && $(MAKE) check)
