## texk/web2c/luatexdir/am/luatex.am: Makefile fragment for luaTeX.
##
## Copyright (C) 2009-2013 Peter Breitenlohner <tex-live@tug.org>
## You may freely use, modify and/or distribute this file.

## luaTeX
##
if LUATEX
bin_PROGRAMS += luatex
if WIN32
noinst_PROGRAMS += call_luatex
install_exe_links += install-luatex-links
uninstall_exe_links += uninstall-luatex-links
else !WIN32
bin_links += luatex$(EXEEXT):texlua luatex$(EXEEXT):texluac
endif !WIN32
endif LUATEX
EXTRA_PROGRAMS += luatex

# Force Automake to use CXXLD for linking
nodist_EXTRA_luatex_SOURCES = dummy.cxx

luatex_CPPFLAGS = $(AM_CPPFLAGS) $(ZLIB_INCLUDES) $(LIBPNG_INCLUDES)
luatex_CPPFLAGS += $(POPPLER_INCLUDES) $(LUA_INCLUDES) -I$(srcdir)/libmd5
luatex_CPPFLAGS += -I$(srcdir)/luatexdir -I$(srcdir)/mplibdir
luatex_CPPFLAGS += -Dextra_version_info=`date +-%Y%m%d%H`
luatex_CPPFLAGS += -I$(srcdir)/synctexdir -DSYNCTEX_ENGINE_H='<synctex-luatex.h>'
luatex_CXXFLAGS = $(WARNING_CXXFLAGS)

luatex_ldadd = libluatex.a libff.a libluamisc.a libluasocket.a $(LUA_LIBS)
luatex_ldadd += libmd5.a libmplib.a $(CAIRO_LIBS) $(PIXMAN_LIBS)
luatex_ldadd += $(ZZIPLIB_LIBS) $(LIBPNG_LIBS) $(ZLIB_LIBS) $(POPPLER_LIBS)

luatex_LDFLAGS = -export-dynamic

luatex_LDADD = $(luatex_ldadd) $(LDADD) $(LIBADD_DLOPEN) $(lua_socketlibs)

luatex_DEPENDENCIES = $(proglib) $(KPATHSEA_DEPEND) libluatex.a
luatex_DEPENDENCIES += $(LIBPNG_DEPEND) $(ZLIB_DEPEND) $(POPPLER_DEPEND)
luatex_DEPENDENCIES += libmd5.a libmplib.a

$(luatex_OBJECTS): libluatex.a

luatex_SOURCES = luatexdir/luatex_svnversion.h luatexdir/luatex.c luatexdir/luatex.h

EXTRA_DIST += luatexdir/getluatexsvnversion.sh

call_luatex_CPPFLAGS = -DEXEPROG=\"luatex.exe\"
nodist_call_luatex_SOURCES = callexe.c
call_luatex_LDADD =

.PHONY: install-luatex-links uninstall-luatex-links
if WIN32
install-luatex-links: call_luatex$(EXEEXT)
	$(INSTALL_PROGRAM) call_luatex$(EXEEXT) $(DESTDIR)$(bindir)/texlua$(EXEEXT)
	$(INSTALL_PROGRAM) call_luatex$(EXEEXT) $(DESTDIR)$(bindir)/texluac$(EXEEXT)
uninstall-luatex-links:
	rm -f $(DESTDIR)$(bindir)/texlua$(EXEEXT)
	rm -f $(DESTDIR)$(bindir)/texluac$(EXEEXT)
endif WIN32

# luaTeX Tests
#
luatex_tests = luatexdir/luatex.test

EXTRA_DIST += $(luatex_tests)

if LUATEX
TESTS += $(luatex_tests)
endif LUATEX

