# applications
EXAMPLES = examples/megacli examples/megasimplesync


if BUILD_FUSE_EXAMPLE
EXAMPLES += examples/linux/megafuse
endif

if BUILD_EXAMPLES
bin_PROGRAMS += $(EXAMPLES)
endif

# depends on libmega
$(EXAMPLES): $(top_builddir)/src/libmega.la


# rules
examples_megacli_SOURCES = examples/megacli.cpp
examples_megaclidir=examples
noinst_HEADERS = examples/megacli.h
examples_megasimplesync_SOURCES = examples/megasimplesync.cpp

if WIN32

examples_megacli_CXXFLAGS = -D_WIN32=1 -Iinclude/ -Iinclude/mega/win32 $(FI_CXXFLAGS) $(PDF_CXXFLAGS) $(ICU_CXXFLAGS) $(RL_CXXFLAGS) $(ZLIB_CXXFLAGS) $(LIBUV_CXXFLAGS) $(LIBRAW_CXXFLAGS) $(LIBMEDIAINFO_CXXFLAGS) $(FFMPEG_CXXFLAGS) $(LIBCURL_FLAGS) $(CRYPTO_CXXFLAGS) $(DB_CXXFLAGS) $(WINHTTP_CXXFLAGS) $(SODIUM_CXXFLAGS) $(PCRE_CXXFLAGS)
examples_megacli_LDADD = $(PDF_LDFLAGS) $(PDF_LIBS) $(ICU_LDFLAGS) $(ICU_LIBS) $(FI_LDFLAGS) $(FI_LIBS) $(RL_LDFLAGS) $(RL_LIBS) $(ZLIB_LDFLAGS) $(ZLIB_LIBS) $(LIBUV_LDFLAGS) $(LIBUV_LIBS)  $(LIBRAW_LDFLAGS) $(LIBRAW_LIBS) $(LIBMEDIAINFO_LDFLAGS) $(LIBMEDIAINFO_LIBS) $(CRYPTO_LDFLAGS) $(CRYPTO_LIBS) $(DB_LDFLAGS) $(DB_LIBS) $(WINHTTP_LDFLAGS) $(WINHTTP_LIBS) $(TERMCAP_LDFLAGS) $(TERMCAP_LIBS) $(top_builddir)/src/libmega.la $(LIBS_EXTRA) $(FFMPEG_LDFLAGS) $(FFMPEG_LIBS) $(PCRE_LDFLAGS) $(PCRE_LIBS)

examples_megasimplesync_CXXFLAGS = -D_WIN32=1 -Iinclude/ -Iinclude/mega/win32 $(FI_CXXFLAGS) $(PDF_CXXFLAGS) $(ICU_CXXFLAGS) $(ZLIB_CXXFLAGS) $(LIBUV_CXXFLAGS)  $(LIBRAW_CXXFLAGS) $(LIBMEDIAINFO_CXXFLAGS) $(FFMPEG_CXXFLAGS) $(CRYPTO_CXXFLAGS) $(DB_CXXFLAGS) $(WINHTTP_CXXFLAGS) $(SODIUM_CXXFLAGS) $(PCRE_CXXFLAGS)
examples_megasimplesync_LDADD = $(PDF_LDFLAGS) $(PDF_LIBS) $(ICU_LDFLAGS) $(ICU_LIBS) $(FI_LDFLAGS) $(FI_LIBS) $(ZLIB_LDFLAGS) $(ZLIB_LIBS) $(LIBUV_LDFLAGS) $(LIBUV_LIBS) $(LIBRAW_LDFLAGS) $(LIBRAW_LIBS) $(LIBMEDIAINFO_LDFLAGS) $(LIBMEDIAINFO_LIBS) $(CRYPTO_LDFLAGS) $(CRYPTO_LIBS) $(DB_LDFLAGS) $(DB_LIBS) $(WINHTTP_LDFLAGS) $(WINHTTP_LIBS)  $(top_builddir)/src/libmega.la $(LIBS_EXTRA) $(FFMPEG_LDFLAGS) $(FFMPEG_LIBS) $(PCRE_LDFLAGS) $(PCRE_LIBS)
else

examples_megacli_CXXFLAGS = $(PDF_CXXFLAGS) $(ICU_CXXFLAGS) $(FI_CXXFLAGS) $(RL_CXXFLAGS) $(ZLIB_CXXFLAGS) $(CARES_FLAGS) $(LIBCURL_FLAGS) $(CRYPTO_CXXFLAGS) $(DB_CXXFLAGS) $(SODIUM_CXXFLAGS) $(LIBSSL_FLAGS) $(PCRE_CXXFLAGS)
examples_megacli_LDADD = $(PDF_LDFLAGS) $(PDF_LIBS) $(ICU_LDFLAGS) $(ICU_LIBS) $(FI_LDFLAGS) $(FI_LIBS) $(RL_LDFLAGS) $(RL_LIBS) $(LIBUV_LDFLAGS) $(LIBUV_LIBS) $(LIBRAW_LDFLAGS) $(LIBRAW_LIBS) $(LIBMEDIAINFO_LDFLAGS) $(LIBMEDIAINFO_LIBS) $(CRYPTO_LDFLAGS) $(CRYPTO_LIBS) $(CARES_LDFLAGS) $(CARES_LIBS) $(LIBCURL_LIBS) $(DB_LDFLAGS) $(DB_LIBS) $(LIBSSL_LDFLAGS) $(LIBSSL_LIBS) $(TERMCAP_LDFLAGS) $(TERMCAP_LIBS) $(PCRE_LDFLAGS) $(PCRE_LIBS) $(top_builddir)/src/libmega.la $(FFMPEG_LDFLAGS) $(FFMPEG_LIBS)  $(ZLIB_LDFLAGS) $(ZLIB_LIBS)

examples_megasimplesync_CXXFLAGS = $(PDF_CXXFLAGS) $(ICU_CXXFLAGS) $(FI_CXXFLAGS) $(ZLIB_CXXFLAGS) $(LIBUV_CXXFLAGS) $(LIBRAW_CXXFLAGS) $(LIBMEDIAINFO_CXXFLAGS) $(FFMPEG_CXXFLAGS) $(CARES_FLAGS) $(LIBCURL_FLAGS) $(CRYPTO_CXXFLAGS) $(DB_CXXFLAGS) $(SODIUM_CXXFLAGS) $(LIBSSL_FLAGS) $(PCRE_CXXFLAGS)
examples_megasimplesync_LDADD = $(PDF_LDFLAGS) $(PDF_LIBS) $(ICU_LDFLAGS) $(ICU_LIBS) $(FI_LDFLAGS) $(FI_LIBS) $(LIBUV_LDFLAGS) $(LIBUV_LIBS) $(LIBRAW_LDFLAGS) $(LIBRAW_LIBS) $(LIBMEDIAINFO_LDFLAGS) $(LIBMEDIAINFO_LIBS) $(CRYPTO_LDFLAGS) $(CRYPTO_LIBS) $(CARES_LDFLAGS) $(CARES_LIBS) $(LIBCURL_LIBS) $(DB_LDFLAGS) $(DB_LIBS) $(LIBSSL_LDFLAGS) $(LIBSSL_LIBS) $(PCRE_LDFLAGS) $(PCRE_LIBS) $(top_builddir)/src/libmega.la $(FFMPEG_LDFLAGS) $(FFMPEG_LIBS)  $(ZLIB_LDFLAGS) $(ZLIB_LIBS)

if BUILD_FUSE_EXAMPLE
examples_linux_megafuse_SOURCES =  examples/linux/megafuse.cpp
examples_linux_megafuse_CXXFLAGS =  $(FUSE_CXXFLAGS)
examples_linux_megafuse_LDADD =  $(top_builddir)/src/libmega.la $(FUSE_LDFLAGS) $(FUSE_LIBS)
endif

endif

if ENABLE_STATIC
if ! DARWIN
examples_megacli_CXXFLAGS += -static
examples_megacli_LDFLAGS = -Wl,-static -all-static
examples_megasimplesync_LDFLAGS = -Wl,-static -all-static
endif

endif
