OPTIONAL_COMPILE_DIR = 
OPTIONAL_DIST_DIR =
OPTIONAL_LIB = 

if ENABLE_DEPRECATED
OPTIONAL_COMPILE_DIR += deprecated
OPTIONAL_LIB += deprecated/libdeprecated.la
else
OPTIONAL_DIST_DIR += deprecated
endif

SUBDIRS = \
	include \
	foreign \
	arithmetic \
	resample \
	colour \
	conversion \
	convolution \
	$(OPTIONAL_COMPILE_DIR) \
	freqfilt \
	histogram \
	draw \
	iofuncs \
	morphology \
	mosaicing \
	create 
	.

lib_LTLIBRARIES = libvips.la

# empty means default to C linking
libvips_la_SOURCES = 

# make sure we link the top-level with c++
nodist_EXTRA_libvips_la_SOURCES = resample/dummy2.cc

# DLLs need dependant libs there too ... put @VIPS_LIBS@ at the end
libvips_la_LIBADD = \
	resample/libresample.la \
	arithmetic/libarithmetic.la \
	colour/libcolour.la \
	conversion/libconversion.la \
	convolution/libconvolution.la \
	$(OPTIONAL_LIB) \
	foreign/libforeign.la \
	freqfilt/libfreqfilt.la \
	histogram/libhistogram.la \
	draw/libdraw.la \
	iofuncs/libiofuncs.la \
	morphology/libmorphology.la \
	mosaicing/libmosaicing.la \
	create/libcreate.la \
	@VIPS_LIBS@

libvips_la_LDFLAGS = \
	-no-undefined \
	-version-info @LIBRARY_CURRENT@:@LIBRARY_REVISION@:@LIBRARY_AGE@ 

EXTRA_DIST = \
	$(OPTIONAL_DIST_DIR)

CLEANFILES = 

install-exec-hook:
	echo '/* This file is autogenerated, do not edit. */' > soname.h && \
	. ./libvips.la && \
	echo "#define VIPS_SONAME \"$$dlname\"" >> soname.h && \
	cp soname.h $(DESTDIR)$(pkgincludedir) && \
	rm soname.h

-include $(INTROSPECTION_MAKEFILE)
INTROSPECTION_GIRS =
INTROSPECTION_SCANNER_ARGS = --add-include-path=$(srcdir)
INTROSPECTION_COMPILER_ARGS = --includedir=$(srcdir)

if HAVE_INTROSPECTION

AM_CPPFLAGS = \
	      -I${top_srcdir}/libvips/include \
	      @VIPS_CFLAGS@ \
	      @VIPS_INCLUDES@ \
	      @INTROSPECTION_CFLAGS@ 
AM_LDFLAGS = \
	     @INTROSPECTION_LIBS@ \
	     @LDFLAGS@ 
LDADD = @INTROSPECTION_LIBS@ @VIPS_CFLAGS@ libvips.la @VIPS_LIBS@ 

noinst_PROGRAMS = \
	introspect$(EXEEXT)
introspect_SOURCES = \
	introspect.c

# we can't get the _SOURCES lists from the subdirs directly, we get passed it
# by configure instead
introspection_sources = @vips_introspection_sources@

# we make the vips8 API
Vips-8.0.gir: introspect$(EXEEXT)
Vips_8_0_gir_INCLUDES = GObject-2.0
Vips_8_0_gir_CFLAGS = $(INCLUDES) -I${top_srcdir}/libvips/include
Vips_8_0_gir_LIBS = libvips.la
Vips_8_0_gir_FILES = $(introspection_sources)
INTROSPECTION_GIRS += Vips-8.0.gir

# don't use
#   --warn-all --verbose
# too annoying
Vips_8_0_gir_SCANNERFLAGS = \
	--program=./introspect$(EXEEXT) \
	--identifier-prefix=Vips \
	--identifier-prefix=vips \
	--symbol-prefix=vips \
	--c-include=vips/vips.h

girdir = $(datadir)/gir-1.0
gir_DATA = $(INTROSPECTION_GIRS)

typelibdir = $(libdir)/girepository-1.0
typelib_DATA = $(INTROSPECTION_GIRS:.gir=.typelib)

CLEANFILES += $(gir_DATA) $(typelib_DATA)
endif
