a我考网

 找回密码
 立即注册

QQ登录

只需一步,快速开始

扫一扫,访问微社区

查看: 78|回复: 0

[综合辅导] linux认证:ucLinux下sqlite数据库移植全攻略(2)

[复制链接]
发表于 2012-8-4 12:07:07 | 显示全部楼层 |阅读模式
linux认证:ucLinux下sqlite数据库移植全攻略(2)
: T0 a; U9 y$ r2 ]5 G7 p- z( L; _1 y0 G+ P

$ {1 ~" m' T% u$ k& c; a4、romfs
. X6 S4 s7 P2 d% I2 L将:3 I* I+ t( }2 g5 @; V% R1 F6 [6 Q: ^
install: sqlite libsqlite.a sqlite.h
( p6 H' I5 g% q4 k5 Qmv sqlite /usr/bin
$ M, M8 T% E8 J3 T" Y7 @mv libsqlite.a /usr/lib* n& G) @9 z) z# d3 L0 S
mv sqlite.h /usr/include
$ {( b* `" ~+ W) Q+ g- E替换为:
4 K( q. {# _4 X8 M: \romfs: sqlite7 q# ^! O5 Q: k7 u
$(ROMFSINST) /bin/sqlite
9 w9 g8 u) M; Y; D: I5 ?即去掉make install项,加上make romfs项。 这个很重要,这将在romfs的/bin目录下生成sqlite。
" H4 S* L/ D' T" @1 Y9 {0 u5、clean
# o6 f5 Y( Z/ a7 ], W0 v* v将:
- C$ M) o3 V5 {1 L3 ^clean:: s' v4 e/ Z- e! K- e
rm -f *.o sqlite libsqlite.a sqlite.h opcodes.*
8 m' D! h4 G8 p1 x- Erm -f lemon lempar.c parse.* sqlite*.tar.gz
6 [& Z: o5 O% \# S+ m1 B; Qrm -f $(PUBLISH)
1 a! h- x0 \% Y  Trm -f *.da *.bb *.bbg gmon.out
, B" h3 f8 B, [* R& K- G) nrm -rf tsrc
6 H' z9 p  Q( s- h+ b" C, Z替换为:, }5 c9 O6 e$ ~" u
clean:
- Z  b. ]) y9 z4 m5 i7 s) b3 nrm -f *.o sqlite libsqlite.a sqlite.h opcodes.* sqlite.gdb, x8 }. a; a& ]) c8 j. T* t. `- _
rm -f $(PUBLISH)5 {+ g- R" w2 l  j/ N5 r
rm -f *.da *.bb *.bbg gmon.out
4 M; W4 c& e# L& g7 i  v2 ^8 nrm -rf tsrc1 V2 y8 b) s; K
distclean: clean
! _* p# f2 s! {: X+ `* Mrm -f lemon lempar.c parse.* sqlite*.tar.gz, @6 r# |) s. X6 D3 P# D5 G
rm -f config.h
) n9 f5 f" S) t8 [% C即增加make distclean项。' q  S; I8 [$ m8 ]! d" s' Q
二、在sqlite下增加Makefile文件
6 [7 o& U. ~' N! L* L在sqlite目录下应该没有Makefile文件,而只是有一个sqlite/Makefile.linux-gcc文件。我们要移植sqlite到uclinux,那么就要自己写一个合适的Makefile。
, D0 G; n8 X* O" F/ g$ J内容如下:
( P" e" `, v4 W* M===========Makefile内容开始===========
# f, \0 Y# P2 l) e* \#!/usr/make. R" f: d$ w: s
#7 {' W; P3 o& X$ `) P9 E! y9 E8 Y: e3 o
# Makefile for SQLITE0 H7 V9 Q# A! p) i* j0 u
#
* p# L; O0 }( j- |" h  M  I/ f# This is a template makefile for SQLite. Most people prefer to
% n" d6 s8 M  ?( V' X7 P; y8 B, z# use the autoconf generated “configure” script to generate the8 _, r" G' C/ ]4 i8 m
# makefile automatically. But that does not work for everybody
/ N" i+ r+ R5 v, u/ S0 K# and in every situation. If you are having problems with the
% I0 K7 Y6 @* M2 \# “configure” script, you might want to try this makefile as an  h9 F/ p& u0 p1 h( n( t" b5 O3 h
# alternative. Create a copy of this file, edit the parameters
& b# S% M' c+ s" U8 x4 H# below and type “make”。+ s+ e& ~0 v8 }& G' Y& z
#3 D5 J- e9 T; l! s3 Y
#### The toplevel directory of the source tree. This is the directory5 Y$ U9 \& X' m8 C4 {  p
# that contains this “Makefile.in” and the “configure.in” script." V# L% \* L8 ]) @. f7 s
#
  D; I# B5 k+ e7 y2 g0 _TOP = 。
4 t9 T) {6 j) r. y  m: U& j5 a#### C Compiler and options for use in building executables that- D7 u+ e* r; V5 z  ?* q' i, _
# will run on the platform that is doing the build.
* K' X. ~3 p. w  J& w. _#; l+ e% V  P# u; {5 S+ Q
BCC = gcc -g -O26 J) B% a- N: k
#BCC = /opt/ancic/bin/c89 -0
1 k5 c$ i) u9 d  r2 I7 I" Z8 a+ U#### If the target operating system supports the “usleep()” system
& C1 O! W" P& y) e: m6 y; _# call, then define the HAVE_USLEEP macro for all C modules.3 b; [) X+ D" r+ c. E) Q( b1 ^" ~
5 z% {8 x7 }' E5 `0 K; E. H

9 L5 O& D% p0 Y7 N0 t#
, D) V1 y# G1 g1 m/ u$ u# A( x#USLEEP =
7 p0 k- V2 O3 A2 |' \8 VUSLEEP = -DHAVE_USLEEP=1- c4 e! g0 k& m' @9 s5 F
#### If you want the SQLite library to be safe for use within a
$ A+ {, b$ w7 r* B+ a# multi-threaded program, then define the following macro
; Z: U! J' D6 v) o' Q# appropriately:
! g: I2 s( d9 A. F2 D' z#0 X8 C( C5 W% m9 @1 z7 @1 [% O
#THREADSAFE = -DTHREADSAFE=13 c) s) c- S! ~/ a/ Z
THREADSAFE = -DTHREADSAFE=0
; d7 {5 p! u" @7 [( D1 v) ?#### Specify any extra linker options needed to make the library$ R; K; L4 i& [4 s
# thread safe/ G( S) ?4 M( N+ Z$ f
#
/ F8 T# p8 G4 h/ \#THREADLIB = -lpthread5 }* g8 }# M' k' [
THREADLIB =
3 m; Q5 \+ k/ D$ z5 S$ f& B) S0 b$ o# f#### Leave MEMORY_DEBUG undefined for maximum speed. Use MEMORY_DEBUG=1
( K3 H1 p( s9 b3 n: V# to check for memory leaks. Use MEMORY_DEBUG=2 to print a log of all
- d; j9 {+ |3 q) r* D. E# malloc()s and free()s in order to track down memory leaks.6 {% m3 W# n3 l0 l1 ?
#
" }' Z9 }2 C/ x' y- z# SQLite uses some expensive assert() statements in the inner loop.0 T! B. M* _8 C+ s
# You can make the library go almost twice as fast if you compile' i; E' V8 b  B# D9 z# S5 F
# with -DNDEBUG=19 @$ w' S; U7 Y* j1 z% e
#  M$ Q6 ^; H$ l, r/ g
#OPTS = -DMEMORY_DEBUG=2
* s% Q" T& `' ^3 D* _#OPTS = -DMEMORY_DEBUG=1
" t: t) h: H6 i8 z, N* Q#OPTS = -DNDEBUG=1( n3 z3 f- A, [. n) X( m
OPTS = -DMEMORY_DEBUG=1) I7 P3 c% o0 s% ]4 @
#### The suffix to add to executable files. “.exe” for windows.
) b6 n" U$ k3 Z% y+ J; p! q; P# Nothing for unix.6 N9 @# [, f# E7 r1 G4 @3 \( S
#
: C8 W) a$ x0 P#EXE = .exe3 y9 f  I% ]# p$ J
EXE =: M. N& A5 p# d( `
#### C Compile and options for use in building executables that
7 [) k0 u& a4 _# will run on the target platform. This is usually the same8 O- p$ n  h2 x: X1 i( N$ B  ~
# as BCC, unless you are cross-compiling.) j& G+ N6 b' i+ `' O* Z8 B$ J$ a* j
#! K, ?# X* c* o$ A3 ?( R
TCC = $(CROSS)gcc
' d6 o' \8 \+ i: O& eFLTFLAGS += -s 12000& c6 Y5 M* l* l! l+ [* M0 [0 f* u
#TCC = gcc -g -O0 -Wall
: |- d6 @  m/ F3 N$ N* |#TCC = gcc -g -O0 -Wall -fprofile-arcs -ftest-coverage3 I% r2 ~8 b6 i8 P2 f7 M) a
#TCC = /opt/mingw/bin/i386-mingw32-gcc -O63 T! {7 R' l( E" a- {3 }
#TCC = /opt/ansic/bin/c89 -O +z -Wl,-a,archive0 O1 s: k0 E. q9 L
#### Tools used to build a static library.- W# g, _8 S! O
#
0 V) j) F! f: P. j5 nAR = $(CROSS)ar cr
5 y! A: v5 K9 y/ t5 F( r1 S#AR = /opt/mingw/bin/i386-mingw32-ar cr9 r) C+ ]+ M2 ?2 b# G
RANLIB = $(CROSS)ranlib
% a% [6 w  }8 T9 g' q8 G5 A$ m8 ~#RANLIB = /opt/mingw/bin/i386-mingw32-ranlib
2 u1 Y9 K! k. f2 b$ o' s! t#### Extra compiler options needed for programs that use the TCL library.! W1 k$ ^. E9 b9 z% _
#0 w2 A/ b4 V! h
#TCL_FLAGS =
, p! [; X& i) _& ?7 P8 R. K. c#TCL_FLAGS = -DSTATIC_BUILD=1# c: ^1 U4 F& b4 v$ K# d) {4 g$ N+ j/ h$ ?
#TCL_FLAGS = -I/home/drh/tcltk/8.4linux: ]* D7 x7 B% t( i
#TCL_FLAGS = -I/home/drh/tcltk/8.4win -DSTATIC_BUILD=1: m$ ~$ o3 a& i/ `
#TCL_FLAGS = -I/home/drh/tcltk/8.3hpux$ b9 j9 }! E% d; a7 t5 `: [
#### Linker options needed to link against the TCL library.
- N% x: t/ I1 |+ u#
3 x; V0 C, x6 e. J) ?+ z! m#LIBTCL = -ltcl -lm -ldl
# P% Q( g8 {  ^' m: ^$ y; n#LIBTCL = /home/drh/tcltk/8.4linux/libtcl8.4g.a -lm -ldl6 M0 O/ s# R, V6 M( s
#LIBTCL = /home/drh/tcltk/8.4win/libtcl84s.a -lmsvcrt
4 {. r2 _. D4 e: X: u; T#LIBTCL = /home/drh/tcltk/8.3hpux/libtcl8.3.a -ldld -lm -lc
) ^8 b: i  |1 F0 s+ Z. Y3 B#### Compiler options needed for programs that use the readline() library.7 F5 s; f; h' [: A) O; l2 v
#
1 d+ A4 l$ }- j. B9 Q5 R7 WREADLINE_FLAGS =
9 s1 e7 G" w3 M, [% A* Q3 \  U#READLINE_FLAGS = -DHAVE_READLINE=1 -I/usr/include/readline* |# N& c8 a6 a3 [2 }8 E) @" b
#### Linker options needed by programs using readline() must link against.+ {9 O- M) F( ^5 K! i
#8 u9 n% S0 T) M. M& Q
#LIBREADLINE =/ a- q5 j& C5 ?5 j% ~+ |
#LIBREADLINE = -static -lreadline -ltermcap0 X+ s7 M+ B5 S* l
#### Should the database engine assume text is coded as UTF-8 or iso8859?
6 T2 C, i( m$ @. L#
& W, o: C7 N5 a# _6 z# ENCODING = UTF8! o; I! Z2 ^4 g9 h- L) Y+ s5 d: S% g# E
ENCODING = ISO88595 u6 H6 J9 J  i: d
# You should not have to change anything below this line  a, U3 k8 u3 Z* a, u
###############################################################################) s  F) h: h4 d( t" A" a6 O
include $(TOP)/main.mk
+ Z) K$ W! {+ X1 s5 p3 i% n===========Makefile内容结束===========
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

Archiver|手机版|小黑屋|Woexam.Com ( 湘ICP备18023104号 )

GMT+8, 2024-5-4 15:55 , Processed in 0.208434 second(s), 21 queries .

Powered by Discuz! X3.4 Licensed

© 2001-2017 Comsenz Inc.

快速回复 返回顶部 返回列表