| 1 |
# Makefile 2 |
| 2 |
#*************************************************************************** |
| 3 |
# |
| 4 |
# Java development root directory. |
| 5 |
# |
| 6 |
# (C) 1999 Jacob Dreyer - Geotechnical Software Services |
| 7 |
# [email protected] - http://geosoft.no |
| 8 |
# |
| 9 |
# Modifications Copyright (C) 2001, 2004 Robert Grimm |
| 10 |
# [email protected] |
| 11 |
# |
| 12 |
# This program is free software; you can redistribute it and/or |
| 13 |
# modify it under the terms of the GNU General Public License |
| 14 |
# as published by the Free Software Foundation; either version 2 |
| 15 |
# of the License, or (at your option) any later version. |
| 16 |
# |
| 17 |
# This program is distributed in the hope that it will be useful, |
| 18 |
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 19 |
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 20 |
# GNU General Public License for more details. |
| 21 |
# |
| 22 |
# You should have received a copy of the GNU General Public License |
| 23 |
# along with this program; if not, write to the Free Software |
| 24 |
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
| 25 |
# |
| 26 |
#*************************************************************************** |
| 27 |
|
| 28 |
|
| 29 |
#*************************************************************************** |
| 30 |
# |
| 31 |
# This section describes the current package. |
| 32 |
# |
| 33 |
# o PACKAGE - The complete package name. |
| 34 |
# o PACKAGE_LOC - Same as PACKAGE but with "/"s instead of "."s. |
| 35 |
# o SOURCE - List of the source files. Remember extension. |
| 36 |
# o JNI_SOURCE - Files from SOURCE that are to be built with the JAVAH |
| 37 |
# compiler. |
| 38 |
# o JAR_EXTRAS - None-class files and directories that are to be bundled |
| 39 |
# into the jar archive. |
| 40 |
# |
| 41 |
#*************************************************************************** |
| 42 |
|
| 43 |
PACKAGE = xtc.lang.blink.agent |
| 44 |
PACKAGE_LOC = xtc/lang/blink/agent |
| 45 |
SOURCE = $(wildcard *.java) |
| 46 |
JNI_SOURCE = |
| 47 |
JAR_EXTRAS = |
| 48 |
|
| 49 |
#*************************************************************************** |
| 50 |
# |
| 51 |
# Include common part of makefile |
| 52 |
# |
| 53 |
#*************************************************************************** |
| 54 |
|
| 55 |
ifdef JAVA_DEV_ROOT |
| 56 |
include $(JAVA_DEV_ROOT)/Makerules |
| 57 |
|
| 58 |
JAVAC_OPTIONS = -target 1.5 -g -Xlint:unchecked -d $(CLASS_DIR) -sourcepath $(SOURCE_DIR) |
| 59 |
|
| 60 |
parsers : |
| 61 |
|
| 62 |
analyzers : |
| 63 |
|
| 64 |
documentation : |
| 65 |
|
| 66 |
endif |
| 67 |
|
| 68 |
# The following is for generating shared library files |
| 69 |
ifdef JAVA_HOME |
| 70 |
AGENT_DLL=$(JAVA_DEV_ROOT)/bin/$(DLL_PREFIX)jinn$(JNI_DLL_SUFFIX) |
| 71 |
AGENT_SOURCES=Agent.java AgentVariable.java |
| 72 |
AGENT_CLASS_DIR=$(JAVA_DEV_ROOT)/classes/xtc/lang/blink/agent/ |
| 73 |
AGENT_CLASSES=$(addprefix $(AGENT_CLASS_DIR),$(patsubst \ |
| 74 |
%.java,%.class,$(AGENT_SOURCES))) |
| 75 |
AGENT_C_SOURCE_FILES=agent.c agent_main.c common.c state.c \ |
| 76 |
j2c_proxy.c c2j_proxy.c agent_class.c options.c java_method.c jnicheck.c hashtable.c hashtable_itr.c |
| 77 |
OSTYPE = $(shell echo $$OSTYPE) |
| 78 |
ifneq (,$(findstring linux,$(OSTYPE))) |
| 79 |
DLL_CC = gcc -lm -lperfctr -Wall -g -shared -I $(JAVA_HOME)/include -I $(JAVA_HOME)/include/linux -o |
| 80 |
DLL_PREFIX = lib |
| 81 |
DLL_SUFFIX = .so |
| 82 |
JNI_DLL_SUFFIX = $(DLL_SUFFIX) |
| 83 |
else |
| 84 |
ifeq ($(OSTYPE),cygwin) |
| 85 |
DLL_CC = gcc -Wall -mno-cygwin -Wall -Wl,--add-stdcall-alias -shared -g -I $(JAVA_HOME)/include -I $(JAVA_HOME)/include/win32 -o |
| 86 |
DLL_PREFIX = |
| 87 |
DLL_SUFFIX = .dll |
| 88 |
JNI_DLL_SUFFIX = $(DLL_SUFFIX) |
| 89 |
else |
| 90 |
ifeq ($(OSTYPE),win32) |
| 91 |
DLL_CC = cl /Zi /LD /I $(JAVA_HOME)/include /I $(JAVA_HOME)/include/win32 /Fe |
| 92 |
DLL_PREFIX = |
| 93 |
DLL_SUFFIX = .dll |
| 94 |
JNI_DLL_SUFFIX = $(DLL_SUFFIX) |
| 95 |
endif |
| 96 |
endif |
| 97 |
endif |
| 98 |
endif |
| 99 |
|
| 100 |
ifdef DLL_CC |
| 101 |
.PHONY: agent |
| 102 |
agent: $(AGENT_DLL) |
| 103 |
|
| 104 |
$(AGENT_DLL): $(AGENT_C_SOURCE_FILES) $(AGENT_CLASSES) |
| 105 |
$(DLL_CC)$@ $(AGENT_C_SOURCE_FILES) |
| 106 |
|
| 107 |
c2j_proxy.c: classes GenerateJNIFunctionProxy.java |
| 108 |
java -ea xtc.lang.blink.agent.GenerateJNIFunctionProxy -o c2j_proxy.c |
| 109 |
|
| 110 |
agent_class.c: $(AGENT_CLASSES) classes |
| 111 |
java -ea xtc.lang.blink.agent.GenerateHardcodedJavaClass \ |
| 112 |
-h agent_class.h -o agent_class.c \ |
| 113 |
class_agent $(AGENT_CLASS_DIR)/Agent.class \ |
| 114 |
class_agent_variable $(AGENT_CLASS_DIR)/AgentVariable.class \ |
| 115 |
class_agent_jni_assertion_failure $(AGENT_CLASS_DIR)/JNIAssertionFailure.class |
| 116 |
|
| 117 |
cleanagent: |
| 118 |
rm -f $(AGENT_DLL) $(AGENT_CLASSES) |
| 119 |
else |
| 120 |
agent: |
| 121 |
ifdef JAVA_HOME |
| 122 |
@echo agent does not yet support $(OSTYPE) |
| 123 |
else |
| 124 |
@echo agent requires setting JAVA_HOME. |
| 125 |
endif |
| 126 |
endif |