Makefile 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. # $Id$
  2. #
  3. #
  4. # WARNING: do not run this directly, it should be run by the master Makefile
  5. include ../../Makefile.defs
  6. auto_gen=
  7. NAME=app_java.so
  8. #DEFS += -DEXTRA_DEBUG
  9. DIST = $(shell if [ -f "/etc/redhat-release" ]; then cat /etc/redhat-release | sed "s/.*\([0-9]\)\.[0-9].*/\1/g"; fi)
  10. ifeq ($(DIST),6)
  11. JVM_PATH = $(shell dirname `find /usr/lib/jvm/java/ -name "libjvm.so"`)
  12. DEFS += $(shell pkg-config libgcj-4.4 --cflags)
  13. LIBS += $(shell pkg-config libgcj-4.4 --cflags) -L$(JVM_PATH) -ljvm
  14. else
  15. # try to detect JAVA_HOME
  16. JAVA_HOME ?= $(shell readlink -f /usr/bin/javac | sed "s:bin/javac::")
  17. DEFS += $(shell pkg-config libgcj --cflags) -I$(JAVA_HOME)/include
  18. LIBS += $(shell pkg-config libgcj --libs) -L$(JAVA_HOME)/lib -ljvm
  19. # On Debian 7.5 there is a bug with JAVA_HOME detection.
  20. # $(shell readlink -f /usr/bin/javac | sed "s:bin/javac::") points to perl wrapper script (/usr/bin/gcj-wrapper-4.7)
  21. # whereas the real compiler is at /usr/bin/gcj-4.7. As the result, JAVA_HOME will not be a directory, that is incorrect.
  22. # At this point I don't see any universal method as explicit setting this variable at the compile phase.
  23. # -- ez
  24. ifeq ($(shell [ -d "${JAVA_HOME}" -a -f "$(JAVA_HOME)/include/jni.h" -a -f "$(JAVA_HOME)/lib/libjvm.so" ] && echo 1 || echo 0),0)
  25. $(error Can't locate Java Development Kit. You have to specify environment JAVA_HOME to build app_java)
  26. endif
  27. ifeq ($(OS), freebsd)
  28. LIBS+=-pthread
  29. endif
  30. ifeq ($(OS), linux)
  31. DEFS += -I$(JAVA_HOME)/include/linux
  32. endif
  33. endif
  34. # disable optimisation for segfaults debugging
  35. INCLUDE += -O0 -g
  36. INCLUDES += -O0 -g
  37. DEFS+=-DKAMAILIO_MOD_INTERFACE
  38. include ../../Makefile.modules