This repository has been archived on 2023-08-20. You can view files and clone it, but cannot push or open issues or pull requests.
yap-6.3/packages/jpl/Makefile.in
2015-10-13 08:17:51 +01:00

197 lines
5.8 KiB
Makefile
Executable File

################################################################
# @configure_input@
#
# Build JPL. Building JPL for Unix currently relies on the following
# assumptions:
#
# * $JAVA_HOME points to the JDK top directory
# * $PATH includes $JAVA_HOME/bin
# * ELF Dynamic Linker semantics
#
# Author: Jan Wielemaker, based on shell-scripts from Paul Singleton.
################################################################
PACKAGE=jpl
PKGCFLAGS=@JPLCFLAGS@
PKGLDFLAGS=@JPLLDFLAGS@
include ../Makefile.defs
LIBS=@LIBS@
JAVA_HOME=@JAVA_HOME@
JAVAC=@JAVAC@
JAVACFLAGS=@JAVACFLAGS@
JAVA=@JAVA@
JUNIT=@JUNIT@
JAVALIBS=@JAVALIBS@
LIBPL= $(srcdir)/jpl.pl
LIBJPL= @LIBJPL@.@SO@
TARGETS= $(LIBJPL)
OBJ= src/c/jpl.o
# YAP has some extra hacks that need to be compiled in.
ifeq (@PROLOG_SYSTEM@,yap)
src/c/jpl.o: $(srcdir)/src/c/jpl.c $(srcdir)/src/c/hacks.c
$(CC) -c $(CFLAGS) $(srcdir)/src/c/jpl.c -o src/c/jpl.o
endif
all: $(TARGETS) jpl.jar exjava-compile jpl_doc
# linking order counts here: otherwise libjpl.so will not remember
# it needs libYap.so
@LIBJPL@.@SO@: $(OBJ)
$(LD) $(LDSOFLAGS) -o $@ $(OBJ) $(LIBS) $(JAVALIBS) $(LIBPLEMBED)
if [ -r @LIBJPL@.@SO@ ]; then \
rm -f @LIBJPL@.jnilib && ln -s @LIBJPL@.@SO@ @LIBJPL@.jnilib ; \
fi
jpl.jar::
(cd src/java && $(MAKE) jpl_jar)
jpl_doc::
(cd src/java && $(MAKE) jpl_doc)
################################################################
# Verify the package
################################################################
check: check_pl check_java
check_pl: jpltest.jar
$(PL) -q -f test_jpl.pl -g run_tests,halt -t 'halt(1)'
check_java: jpltest.jar
JUNIT=$(JUNIT) JAVA=$(JAVA) JAVA_PRELOAD=$(JAVA_PRELOAD) $(srcdir)/test-java.sh
jpltest.jar:
(cd src/java && $(MAKE) test_jar)
################################################################
# Installation
################################################################
DOCDIRS= $(srcdir) $(srcdir)/java_api \
$(srcdir)/java_api/javadoc $(srcdir)/java_api/javadoc/jpl \
$(srcdir)/java_api/javadoc/jpl/class-use \
$(srcdir)/java_api/javadoc/jpl/fli \
$(srcdir)/java_api/javadoc/jpl/fli/class-use \
$(srcdir)/java_api/javadoc/resources \
$(srcdir)/prolog_api \
$(srcdir)/prolog_api/overview
DOCFILES= $(shell cd $(srcdir)/docs && find . -name '*.html' -o -name '*.gif' -o -name '*.jpg')
EXPL= $(PKGEXDIR)/jpl/prolog
EXPLS= jpl_colour_choose_demo.pl \
jpl_jlist_demo.pl \
jpl_midi_demo.pl \
jpl_table_demo.pl \
jpl_text_entry_demo.pl \
jpl_versions_demo.pl
EXJAVA= $(PKGEXDIR)/jpl/java
EXJAVAS= Exceptions Exceptions2 Family FamilyMT Test Test2 Time \
Versions Zahed SemWeb
install: all $(LIBPL)
mkdir -p $(DESTDIR)$(SOLIBDIR)
for f in $(TARGETS); do \
$(INSTALL_PROGRAM) "$$f" "$(DESTDIR)$(SOLIBDIR)"; \
done
ifeq (@SO@,dylib)
(cd $(DESTDIR)$(SOLIBDIR) && ln -sf @LIBJPL@.@SO@ @LIBJPL@.jnilib)
endif
mkdir -p $(DESTDIR)$(PLLIBDIR)
mkdir -p $(DESTDIR)$(PLLIBDIR)/jpl
for f in $(LIBPL); do \
$(INSTALL_DATA) $$f $(DESTDIR)$(PLLIBDIR); \
done
$(INSTALL_DATA) jpl.jar $(DESTDIR)$(PLLIBDIR)/jpl
$(PL) -f none -g make -t halt
mkdir -p "$(DESTDIR)$(PLLIBDIR)"
for f in $(LIBPL); do \
$(INSTALL_DATA) $$f $(DESTDIR)$(PLLIBDIR); \
done
$(MKINDEX)
install-examples::
expl-install exjava-install
ln-install::
@$(MAKE) INSTALL_DATA='../ln-install' install
rpm-install: install html-install
html-install:: expl-install exjava-install
mkdir -p $(DESTDIR)$(PKGDOCDIR)/jpl
@printf "Creating directories "
@for d in $(DOCDIRS); do \
mkdir -p $(DESTDIR)$(PKGDOCDIR)/jpl/$$d; printf "."; \
done
@echo "ok"
@printf "Copying documentation files "
@for f in $(DOCFILES); do \
$(INSTALL_DATA) docs/$$f $(DESTDIR)$(PKGDOCDIR)/jpl/$$f; printf "."; \
done
@echo "ok"
expl-install::
echo "Installing Prolog examples"
mkdir -p $(DESTDIR)$(EXPL)
@for f in $(EXPLS) README; do \
$(INSTALL_DATA) $(srcdir)/examples/prolog/$$f $(DESTDIR)$(EXPL)/$$f; \
done
exjava-compile: jpl.jar
echo "Compiling Java examples"
for d in $(EXJAVAS); do \
if [ ! -f examples/java/$$d/$$d.class ]; then \
echo $$d; \
mkdir -p examples/java/$$d; \
(cd examples/java/$$d && "$(JAVAC)" $(JAVACFLAGS) -d . -classpath "../../../jpl.jar" $(srcdir)/examples/java/$$d/$$d.java); \
fi; \
done
exjava-install: exjava-compile
echo "Installing Java examples"
mkdir -p "$(DESTDIR)$(EXJAVA)"
$(INSTALL_DATA) $(srcdir)/examples/java/README "$(DESTDIR)$(EXJAVA)"
$(INSTALL_DATA) $(srcdir)/examples/java/env.@CMDEXT@ "$(DESTDIR)$(EXJAVA)"
for d in $(EXJAVAS); do \
mkdir -p $(DESTDIR)$(EXJAVA)/$$d; \
$(INSTALL_SCRIPT) $(srcdir)/examples/java/$$d/run.@CMDEXT@ "$(DESTDIR)$(EXJAVA)/$$d" ;\
$(INSTALL_DATA) $(srcdir)/examples/java/$$d/README "$(DESTDIR)$(EXJAVA)/$$d" ;\
$(INSTALL_DATA) $(srcdir)/examples/java/$$d/$$d.java "$(DESTDIR)$(EXJAVA)/$$d" ;\
for f in $(srcdir)/examples/java/$$d/*.pl; do \
$(INSTALL_DATA) "$$f" "$(DESTDIR)$(EXJAVA)/$$d"; \
done ;\
$(INSTALL_DATA) examples/java/$$d/$$d*.class $(DESTDIR)$(EXJAVA)/$$d ;\
done
$(INSTALL_DATA) $(srcdir)/examples/java/SemWeb/test.rdf "$(DESTDIR)$(EXJAVA)/SemWeb"
pdf-install::
mkdir -p $(DESTDIR)$(PKGDOCDIR)
$(INSTALL) -m 644 $(DOC).pdf "$(DESTDIR)$(PKGDOCDIR)"
uninstall::
(cd $(PLBASE)/lib/$(PLARCH) && rm -f $(TARGETS))
(cd $(PLBASE)/library && rm -f $(LIBPL))
$(PL) -f none -g make -t halt
################################################################
# Clean
################################################################
clean:
rm -f $(OBJ) *~ *.o *% a.out core config.log
rm -f TestJPL.class
find examples/java -name '*.class' -delete
(cd src/java && $(MAKE) clean)
distclean: clean
rm -rf autom4te.cache
rm -f $(TARGETS) config.cache config.h config.status Makefile
rm -f $(DOC).aux $(DOC).log $(DOC).out $(DOC).toc
rm -rf html
(cd src/java && $(MAKE) distclean)