- Timestamp:
- Dec 13, 2013 9:07:53 AM (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
pjproject/branches/projects/pjsua2/pjsip-apps/src/swig/java/Makefile
r4670 r4691 1 1 include ../../../../build.mak 2 2 3 ifneq ($(findstring "$(TARGET_NAME)","darwin"),"") 3 ifneq ($(findstring android,$(TARGET_NAME)),) 4 OS=android 5 else 6 ifneq ($(findstring darwin,$(TARGET_NAME)),) 4 7 OS=darwin 8 endif 5 9 endif 6 10 7 11 OUT_DIR=output 8 12 ifeq ($(OS),Windows_NT) 9 LIBPJSUA2_SO=$(OUT_DIR)/pjsua2.dll13 LIBPJSUA2_SO=$(OUT_DIR)/pjsua2.dll 10 14 else 11 15 ifeq ($(OS),darwin) 12 16 LIBPJSUA2_SO=$(OUT_DIR)/libpjsua2.jnilib 13 17 else 14 LIBPJSUA2_SO=$(OUT_DIR)/libpjsua2.so 18 ifeq ($(OS),android) 19 LIBPJSUA2_SO=android/libs/armeabi/libpjsua2.so 20 else 21 LIBPJSUA2_SO=$(OUT_DIR)/libpjsua2.so 22 endif 15 23 endif 16 24 endif … … 33 41 JAVA_BIN := $(JAVA_HOME) 34 42 endif 35 #$(error $(JAVA_BIN))36 43 endif 37 44 38 45 # OS specific 39 46 ifeq ($(OS),Windows_NT) 40 MY_JNI_LDFLAGS = -L$(MY_JDK)/lib -Wl,--kill-at 41 MY_JNI_LIB = $(OUT_DIR)/pjsua2.dll 47 MY_JNI_LDFLAGS = -L$(MY_JDK)/lib -Wl,--kill-at 42 48 else 43 MY_JNI_LDFLAGS = -L$(MY_JDK)/lib 44 ifneq ($(OS),darwin) 45 MY_JNI_LDFLAGS := $(MY_JNI_LDFLAGS) -Wl,-soname,pjsua2.so 49 MY_JNI_CFLAGS = -fPIC 50 MY_JNI_LDFLAGS = -L$(MY_JDK)/lib 51 ifeq ($(OS),darwin) 52 MY_JNI_LDFLAGS := $(MY_JNI_LDFLAGS) -Wl,-soname,pjsua2.so 46 53 endif 47 MY_JNI_LIB = $(OUT_DIR)/libpjsua2.so 48 MY_JNI_CFLAGS := -fPIC $(MY_JNI_CFLAGS) 54 ifeq ($(OS),android) 55 MY_JNI_CFLAGS := $(MY_JNI_CFLAGS) -D__ANDROID__ 56 endif 49 57 endif 50 58 … … 60 68 endif 61 69 MY_JNI_CFLAGS := $(MY_JNI_CFLAGS) -I$(MY_JDK)/include -I$(MY_JDK)/include/win32 \ 62 -I$(MY_JDK)/include/linux -I.70 -I$(MY_JDK)/include/linux -I. 63 71 64 72 # Build settings 65 73 MY_CFLAGS = $(PJ_CFLAGS) $(MY_JNI_CFLAGS) 66 MY_LDFLAGS = $(PJ_LDFLAGS) -lpjsua2-$(TARGET_NAME) $(PJ_LDLIBS) $(MY_JNI_LDFLAGS) -static-libstdc++ 74 MY_LDFLAGS = $(PJ_LDFLAGS) -lpjsua2-$(TARGET_NAME) $(PJ_LDLIBS) $(MY_JNI_LDFLAGS) 75 MY_PACKAGE_NAME = org.pjsip.pjsua2 76 ifeq ($(OS),android) 77 MY_PACKAGE_PATH = android/src/$(subst .,/,$(MY_PACKAGE_NAME)) 78 else 79 MY_PACKAGE_PATH = $(OUT_DIR)/$(subst .,/,$(MY_PACKAGE_NAME)) 80 endif 67 81 68 82 .PHONY: all java install uninstall … … 71 85 72 86 $(LIBPJSUA2_SO): $(OUT_DIR)/pjsua2_wrap.o 73 g++-shared -o $(LIBPJSUA2_SO) $(OUT_DIR)/pjsua2_wrap.o $(MY_CFLAGS) $(MY_LDFLAGS)87 $(PJ_CXX) -shared -o $(LIBPJSUA2_SO) $(OUT_DIR)/pjsua2_wrap.o $(MY_CFLAGS) $(MY_LDFLAGS) 74 88 75 89 $(OUT_DIR)/pjsua2_wrap.o: $(OUT_DIR)/pjsua2_wrap.cpp Makefile 76 g++-c $(OUT_DIR)/pjsua2_wrap.cpp -o $(OUT_DIR)/pjsua2_wrap.o $(MY_CFLAGS) $(MY_LDFLAGS)90 $(PJ_CXX) -c $(OUT_DIR)/pjsua2_wrap.cpp -o $(OUT_DIR)/pjsua2_wrap.o $(MY_CFLAGS) $(MY_LDFLAGS) 77 91 78 92 $(OUT_DIR)/pjsua2_wrap.cpp: ../pjsua2.i ../symbols.i $(SRCS) 79 swig $(SWIG_FLAGS) -java -o $(OUT_DIR)/pjsua2_wrap.cpp ../pjsua2.i 93 mkdir -p $(MY_PACKAGE_PATH) 94 swig $(SWIG_FLAGS) -java -package $(MY_PACKAGE_NAME) -outdir $(MY_PACKAGE_PATH) -o $(OUT_DIR)/pjsua2_wrap.cpp ../pjsua2.i 80 95 81 96 clean distclean realclean: 82 rm -rf $( OUT_DIR)/pjsua2_wrap.cpp $(OUT_DIR)/pjsua2_wrap.o $(LIBPJSUA2_SO) $(OUT_DIR)/*.java $(OUT_DIR)/*.class97 rm -rf $(LIBPJSUA2_SO) $(OUT_DIR)/* $(MY_PACKAGE_PATH)/*.java $(MY_PACKAGE_PATH)/*.class 83 98 84 java: output/Error.class output/test.class99 java: $(MY_PACKAGE_PATH)/Error.class $(MY_PACKAGE_PATH)/test.class 85 100 86 output/Error.class: output/Error.java87 $(MY_JAVAC) -d $(OUT_DIR) $( OUT_DIR)/*.java101 $(MY_PACKAGE_PATH)/Error.class: $(MY_PACKAGE_PATH)/Error.java 102 $(MY_JAVAC) -d $(OUT_DIR) $(MY_PACKAGE_PATH)/*.java 88 103 89 output/test.class: test.java104 $(MY_PACKAGE_PATH)/test.class: test.java 90 105 $(MY_JAVAC) -d $(OUT_DIR) -classpath "$(OUT_DIR)" test.java 91 106 … … 93 108 @# Need to specify classpath and library path, alternatively, they can be set via 94 109 @# CLASSPATH and java.library.path env settings 95 $(MY_JAVA) -cp $(OUT_DIR)-Djava.library.path="$(OUT_DIR)" test110 $(MY_JAVA) -cp "$(OUT_DIR);$(MY_PACKAGE_PATH)" -Djava.library.path="$(OUT_DIR)" test 96 111 97 112 install:
Note: See TracChangeset
for help on using the changeset viewer.