</p> 关于linux下编译 C代码部分说明:
2 X' R$ t: o! K 对于linux不同版本,可能会导致libJNativeCpp.so不同
& G, h: \3 \: Q 原带的libJNativeCpp.so 是在glic2.4下编译的
) w0 ~4 K7 ?6 A9 ~# m* C+ F 为了适应glic2.3的情况,重新编译了libJNativeCpp.so,在for gcc3.4.6 glibc 2.3下。
) |0 Q. ^# u6 t4 I+ T 编译办法:
2 P7 O4 d& T8 U; U" T$ e+ E8 _ 在JNative-1.3.2-src\JNativeCpp\Release目录下6 R# T. a# ~5 L
1、备份calls.o和 asm_io.o这两个Object文件
! d- M# y) I0 L 2、make clean9 @0 H9 i$ m( x
3、恢复到当前目录calls.o和 asm_io.o这两个Object文件
- r3 b, o2 a9 d) k 4、make
6 O! u' N! n' }' k/ Z 目前已经修改了Release目录下的makefile和subdir.mk文件,使得在make clean的时候不删除calls.o和 asm_io.o两个文件
- v( G: a! x; Q- F4 K& m- I) a 附:linux 动态库搜索路径:) |# j% c" b$ x h; [9 ^ v
export LD_LIBRARY_PATH=`pwd`:$LD_LIBRARY_PATH
2 w" d0 [6 [! Q+ s S# o4 g. l7 E1 s makefile 文件* {1 J. j' f' B) w
################################################################################7 i E5 V! H+ c: _1 v
# Automatically-generated file. Do not edit!+ |* n9 g, w/ s; Q. T P; S
################################################################################
r7 s$ h) h/ f+ ]. x% }7 Z1 D -include ../makefile.init
* J# W( ~6 c9 x# X& N8 F RM := rm -rf" ^& A2 H m0 _: d9 x: s8 o4 y
# All of the sources participating in the build are defined here
: P/ y/ n1 C" [# o5 w# ~, s5 o -include sources.mk9 u8 W, @# W( o# n0 ]
-include subdir.mk
/ t: v% @7 H$ ]6 O2 X -include objects.mk/ g. @" |" p# a2 S, B( u' Z
ifneq ($(MAKECMDGOALS),clean)
$ }( S% w. }( \& x ifneq ($(strip $(C++_DEPS)),)+ d. p# @; ^$ X: q) u+ J% D( O+ O
-include $(C++_DEPS)4 c* k! [9 R5 e0 |! P
endif
* l1 t' Q N! o6 l6 Z6 A, A) ? ifneq ($(strip $(CC_DEPS)),). X# R) R, l5 M
-include $(CC_DEPS) a" |8 l0 |! K( M* r; v
endif
; c7 Y d3 |& h; E, W ifneq ($(strip $(C_DEPS)),)
% n$ v$ v* `$ N5 k9 B, x -include $(C_DEPS): L9 }" P) ~8 \6 a$ A
endif* f: }! R+ {- q8 b I
ifneq ($(strip $(CPP_DEPS)),)
, ~4 U" N+ `" W. c' I" s% E -include $(CPP_DEPS)
) O$ J9 L. R4 g* U9 l endif
* I! W3 e) Z) p4 }- Q8 r- [ ifneq ($(strip $(CXX_DEPS)),)
, B5 z j4 v& _3 C2 s" R -include $(CXX_DEPS)
. i, C) T/ @# s* t; s0 B7 \ endif, C# s0 e. _+ B; K
ifneq ($(strip $(C_UPPER_DEPS)),). w8 C5 \ k* i, G% G* a7 I
-include $(C_UPPER_DEPS)* k( M+ d& \0 J. K+ P2 S
endif
' f) r* ~5 u c* B endif& X/ s# k9 g7 s+ n* X! o
-include ../makefile.defs
( a0 r. z4 r9 S Y& `+ u, y' O, O # Add inputs and outputs from these tool invocations to the build variables+ k1 q8 U$ T$ V/ I% v! e, ^& F
# All Target# \. l2 ]6 A6 T, H( o
all: libJNativeCpp.so
0 G8 t/ I( y# ?! h0 {% @- H# T # Tool invocations
! j- E1 g( G. \2 y y libJNativeCpp.so: $(OBJS) $(OBJS_ASM) $(USER_OBJS)6 b! d2 A; a5 d- |9 s% o
@echo ''Building target: $@''
; r% p; y. Y; @# J) G o @echo ''Invoking: GCC C++ Linker''3 ~5 S8 y4 |, {; _( j9 G/ f
g++ -shared -o"libJNativeCpp.so" $(OBJS) $(OBJS_ASM) $(USER_OBJS) $(LIBS)& e: X3 u; m; }" m' S; [
@echo ''Finished building target: $@''7 M5 T0 ~$ F& e% B3 ?. H* d( q5 P9 s
@echo '' ''
; M% H$ n$ T4 v # Other Targets
5 Q G- a7 |5 D, c clean:
# _- V7 W( M0 P2 o' b7 A -$(RM) $(OBJS)$(C++_DEPS)$(CC_DEPS)$(C_DEPS)$(CPP_DEPS)$(LIBRARIES)$(CXX_DEPS)$(C_UPPER_DEPS) libJNativeCpp.so
- N4 I7 x8 p5 P, N, e: l; n1 Q -@echo '' ''
9 N6 [% n# ?. R z" j5 u .PHONY: all clean dependents+ E# R9 M2 E) K) \8 J
.SECONDARY:
" X) a/ s9 T* m- Y& G -include ../makefile.targets
4 F" g% U4 U: W1 o5 @$ @) k" z8 _& Z5 j. c7 U* u$ c
subdir.mk 文件 |