]> pilppa.org Git - familiar-h63xx-build.git/blob - org.handhelds.familiar/packages/sqlite/sqlite-2.8.15/main.mk
OE tree imported from monotone branch org.openembedded.oz354fam083 at revision 8b12e3...
[familiar-h63xx-build.git] / org.handhelds.familiar / packages / sqlite / sqlite-2.8.15 / main.mk
1 ###############################################################################
2 # The following macros should be defined before this script is
3 # invoked:
4 #
5 # TOP              The toplevel directory of the source tree.  This is the
6 #                  directory that contains this "Makefile.in" and the
7 #                  "configure.in" script.
8 #
9 # BCC              C Compiler and options for use in building executables that
10 #                  will run on the platform that is doing the build.
11 #
12 # USLEEP           If the target operating system supports the "usleep()" system
13 #                  call, then define the HAVE_USLEEP macro for all C modules.
14 #
15 # THREADSAFE       If you want the SQLite library to be safe for use within a 
16 #                  multi-threaded program, then define the following macro
17 #                  appropriately:
18 #
19 # THREADLIB        Specify any extra linker options needed to make the library
20 #                  thread safe
21 #
22 # OPTS             Extra compiler command-line options.
23 #
24 # EXE              The suffix to add to executable files.  ".exe" for windows
25 #                  and "" for Unix.
26 #
27 # TCC              C Compiler and options for use in building executables that 
28 #                  will run on the target platform.  This is usually the same
29 #                  as BCC, unless you are cross-compiling.
30 #
31 # AR               Tools used to build a static library.
32 # RANLIB
33 #
34 # TCL_FLAGS        Extra compiler options needed for programs that use the
35 #                  TCL library.
36 #
37 # LIBTCL           Linker options needed to link against the TCL library.
38 #
39 # READLINE_FLAGS   Compiler options needed for programs that use the
40 #                  readline() library.
41 #
42 # LIBREADLINE      Linker options needed by programs using readline() must
43 #                  link against.
44 #
45 # ENCODING         "UTF8" or "ISO8859"
46 #
47 # Once the macros above are defined, the rest of this make script will
48 # build the SQLite library and testing tools.
49 ################################################################################
50
51 # This is how we compile
52 #
53 TCCX = $(TCC) $(OPTS) $(THREADSAFE) $(USLEEP) -I. -I$(TOP)/src
54
55 # Object files for the SQLite library.
56 #
57 LIBOBJ = attach.o auth.o btree.o btree_rb.o build.o copy.o date.o delete.o \
58          expr.o func.o hash.o insert.o \
59          main.o opcodes.o os.o pager.o parse.o pragma.o printf.o random.o \
60          select.o table.o tokenize.o trigger.o update.o util.o \
61          vacuum.o vdbe.o vdbeaux.o where.o
62
63 # All of the source code files.
64 #
65 SRC = \
66   $(TOP)/src/attach.c \
67   $(TOP)/src/auth.c \
68   $(TOP)/src/btree.c \
69   $(TOP)/src/btree.h \
70   $(TOP)/src/btree_rb.c \
71   $(TOP)/src/build.c \
72   $(TOP)/src/copy.c \
73   $(TOP)/src/date.c \
74   $(TOP)/src/delete.c \
75   $(TOP)/src/encode.c \
76   $(TOP)/src/expr.c \
77   $(TOP)/src/func.c \
78   $(TOP)/src/hash.c \
79   $(TOP)/src/hash.h \
80   $(TOP)/src/insert.c \
81   $(TOP)/src/main.c \
82   $(TOP)/src/os.c \
83   $(TOP)/src/pager.c \
84   $(TOP)/src/pager.h \
85   $(TOP)/src/parse.y \
86   $(TOP)/src/pragma.c \
87   $(TOP)/src/printf.c \
88   $(TOP)/src/random.c \
89   $(TOP)/src/select.c \
90   $(TOP)/src/shell.c \
91   $(TOP)/src/sqlite.h.in \
92   $(TOP)/src/sqliteInt.h \
93   $(TOP)/src/table.c \
94   $(TOP)/src/tokenize.c \
95   $(TOP)/src/trigger.c \
96   $(TOP)/src/update.c \
97   $(TOP)/src/util.c \
98   $(TOP)/src/vacuum.c \
99   $(TOP)/src/vdbe.c \
100   $(TOP)/src/vdbe.h \
101   $(TOP)/src/vdbeaux.c \
102   $(TOP)/src/vdbeInt.h \
103   $(TOP)/src/where.c
104
105 # Source code to the test files.
106 #
107 TESTSRC = \
108   $(TOP)/src/btree.c \
109   $(TOP)/src/func.c \
110   $(TOP)/src/os.c \
111   $(TOP)/src/pager.c \
112   $(TOP)/src/test1.c \
113   $(TOP)/src/test2.c \
114   $(TOP)/src/test3.c \
115   $(TOP)/src/test4.c \
116   $(TOP)/src/vdbe.c \
117   $(TOP)/src/md5.c
118
119 # Header files used by all library source files.
120 #
121 HDR = \
122    sqlite.h  \
123    $(TOP)/src/btree.h \
124    config.h \
125    $(TOP)/src/hash.h \
126    opcodes.h \
127    $(TOP)/src/os.h \
128    $(TOP)/src/sqliteInt.h  \
129    $(TOP)/src/vdbe.h \
130    parse.h
131
132 # Header files used by the VDBE submodule
133 #
134 VDBEHDR = \
135    $(HDR) \
136    $(TOP)/src/vdbeInt.h
137
138 # This is the default Makefile target.  The objects listed here
139 # are what get build when you type just "make" with no arguments.
140 #
141 all:    sqlite.h config.h libsqlite.so sqlite$(EXE)
142
143 # Generate the file "last_change" which contains the date of change
144 # of the most recently modified source code file
145 #
146 last_change:    $(SRC)
147         cat $(SRC) | grep '$$Id: ' | sort +4 | tail -1 \
148           | awk '{print $$5,$$6}' >last_change
149
150 libsqlite.so:   $(LIBOBJ)
151         $(CC) -shared -o libsqlite.so -Wl,-soname,libsqlite.so.0 $(LIBOBJ)
152
153 sqlite$(EXE):   $(TOP)/src/shell.c libsqlite.so sqlite.h
154         $(TCCX) $(READLINE_FLAGS) -o sqlite$(EXE) $(TOP)/src/shell.c \
155                 -lsqlite $(LIBREADLINE) $(THREADLIB)
156
157 sqlite_analyzer$(EXE):  $(TOP)/src/tclsqlite.c libsqlite.a $(TESTSRC) \
158                         $(TOP)/tool/spaceanal.tcl
159         sed \
160           -e '/^#/d' \
161           -e 's,\\,\\\\,g' \
162           -e 's,",\\",g' \
163           -e 's,^,",' \
164           -e 's,$$,\\n",' \
165           $(TOP)/tool/spaceanal.tcl >spaceanal_tcl.h
166         $(TCCX) $(TCL_FLAGS) -DTCLSH=2 -DSQLITE_TEST=1 -static -o \
167                 sqlite_analyzer$(EXE) $(TESTSRC) $(TOP)/src/tclsqlite.c \
168                 libsqlite.a $(LIBTCL)
169
170
171 # This target creates a directory named "tsrc" and fills it with
172 # copies of all of the C source code and header files needed to
173 # build on the target system.  Some of the C source code and header
174 # files are automatically generated.  This target takes care of
175 # all that automatic generation.
176 #
177 target_source:  $(SRC) $(VDBEHDR) opcodes.c
178         rm -rf tsrc
179         mkdir tsrc
180         cp $(SRC) $(VDBEHDR) tsrc
181         rm tsrc/sqlite.h.in tsrc/parse.y
182         cp parse.c opcodes.c tsrc
183
184 # Rules to build the LEMON compiler generator
185 #
186 lemon:  $(TOP)/tool/lemon.c $(TOP)/tool/lempar.c
187         $(BCC) -o lemon $(TOP)/tool/lemon.c
188         cp $(TOP)/tool/lempar.c .
189
190 btree.o:        $(TOP)/src/btree.c $(HDR) $(TOP)/src/pager.h
191         $(TCCX) -c $(TOP)/src/btree.c
192
193 btree_rb.o:     $(TOP)/src/btree_rb.c $(HDR)
194         $(TCCX) -c $(TOP)/src/btree_rb.c
195
196 build.o:        $(TOP)/src/build.c $(HDR)
197         $(TCCX) -c $(TOP)/src/build.c
198
199 main.o: $(TOP)/src/main.c $(HDR)
200         $(TCCX) -c $(TOP)/src/main.c
201
202 pager.o:        $(TOP)/src/pager.c $(HDR) $(TOP)/src/pager.h
203         $(TCCX) -c $(TOP)/src/pager.c
204
205 opcodes.o:      opcodes.c
206         $(TCCX) -c opcodes.c
207
208 opcodes.c:      $(TOP)/src/vdbe.c
209         echo '/* Automatically generated file.  Do not edit */' >opcodes.c
210         echo 'char *sqliteOpcodeNames[] = { "???", ' >>opcodes.c
211         grep '^case OP_' $(TOP)/src/vdbe.c | \
212           sed -e 's/^.*OP_/  "/' -e 's/:.*$$/", /' >>opcodes.c
213         echo '};' >>opcodes.c
214
215 opcodes.h:      $(TOP)/src/vdbe.h
216         echo '/* Automatically generated file.  Do not edit */' >opcodes.h
217         grep '^case OP_' $(TOP)/src/vdbe.c | \
218           sed -e 's/://' | \
219           awk '{printf "#define %-30s %3d\n", $$2, ++cnt}' >>opcodes.h
220
221 os.o:   $(TOP)/src/os.c $(HDR)
222         $(TCCX) -c $(TOP)/src/os.c
223
224 parse.o:        parse.c $(HDR)
225         $(TCCX) -c parse.c
226
227 parse.h:        parse.c
228
229 parse.c:        $(TOP)/src/parse.y lemon
230         cp $(TOP)/src/parse.y .
231         ./lemon parse.y
232
233 # The config.h file will contain a single #define that tells us how
234 # many bytes are in a pointer.  This only works if a pointer is the
235 # same size on the host as it is on the target.  If you are cross-compiling
236 # to a target with a different pointer size, you'll need to manually
237 # configure the config.h file.
238 #
239 config.h:       
240         echo '#include <stdio.h>' >temp.c
241         echo 'int main(){printf(' >>temp.c
242         echo '"#define SQLITE_PTR_SZ %d",sizeof(char*));' >>temp.c
243         echo 'exit(0);}' >>temp.c
244         $(BCC) -o temp temp.c
245         ./temp >config.h
246         echo >>config.h
247         rm -f temp.c temp
248
249 sqlite.h:       $(TOP)/src/sqlite.h.in 
250         sed -e s/--VERS--/`cat ${TOP}/VERSION`/ \
251             -e s/--ENCODING--/$(ENCODING)/ \
252                  $(TOP)/src/sqlite.h.in >sqlite.h
253
254 tokenize.o:     $(TOP)/src/tokenize.c $(HDR)
255         $(TCCX) -c $(TOP)/src/tokenize.c
256
257 trigger.o:      $(TOP)/src/trigger.c $(HDR)
258         $(TCCX) -c $(TOP)/src/trigger.c
259
260 util.o: $(TOP)/src/util.c $(HDR)
261         $(TCCX) -c $(TOP)/src/util.c
262
263 vacuum.o:       $(TOP)/src/vacuum.c $(HDR)
264         $(TCCX) -c $(TOP)/src/vacuum.c
265
266 vdbe.o: $(TOP)/src/vdbe.c $(VDBEHDR)
267         $(TCCX) -c $(TOP)/src/vdbe.c
268
269 vdbeaux.o:      $(TOP)/src/vdbeaux.c $(VDBEHDR)
270         $(TCCX) -c $(TOP)/src/vdbeaux.c
271
272 where.o:        $(TOP)/src/where.c $(HDR)
273         $(TCCX) -c $(TOP)/src/where.c
274
275 copy.o: $(TOP)/src/copy.c $(HDR)
276         $(TCCX) -c $(TOP)/src/copy.c
277
278 date.o: $(TOP)/src/date.c $(HDR)
279         $(TCCX) -c $(TOP)/src/date.c
280
281 delete.o:       $(TOP)/src/delete.c $(HDR)
282         $(TCCX) -c $(TOP)/src/delete.c
283
284 encode.o:       $(TOP)/src/encode.c
285         $(TCCX) -c $(TOP)/src/encode.c
286
287 expr.o: $(TOP)/src/expr.c $(HDR)
288         $(TCCX) -c $(TOP)/src/expr.c
289
290 func.o: $(TOP)/src/func.c $(HDR)
291         $(TCCX) -c $(TOP)/src/func.c
292
293 hash.o: $(TOP)/src/hash.c $(HDR)
294         $(TCCX) -c $(TOP)/src/hash.c
295
296 insert.o:       $(TOP)/src/insert.c $(HDR)
297         $(TCCX) -c $(TOP)/src/insert.c
298
299 random.o:       $(TOP)/src/random.c $(HDR)
300         $(TCCX) -c $(TOP)/src/random.c
301
302 select.o:       $(TOP)/src/select.c $(HDR)
303         $(TCCX) -c $(TOP)/src/select.c
304
305 table.o:        $(TOP)/src/table.c $(HDR)
306         $(TCCX) -c $(TOP)/src/table.c
307
308 update.o:       $(TOP)/src/update.c $(HDR)
309         $(TCCX) -c $(TOP)/src/update.c
310
311 tclsqlite.o:    $(TOP)/src/tclsqlite.c $(HDR)
312         $(TCCX) $(TCL_FLAGS) -c $(TOP)/src/tclsqlite.c
313
314 pragma.o:       $(TOP)/src/pragma.c $(HDR)
315         $(TCCX) $(TCL_FLAGS) -c $(TOP)/src/pragma.c
316
317 printf.o:       $(TOP)/src/printf.c $(HDR)
318         $(TCCX) $(TCL_FLAGS) -c $(TOP)/src/printf.c
319
320 attach.o:       $(TOP)/src/attach.c $(HDR)
321         $(TCCX) -c $(TOP)/src/attach.c
322
323 auth.o: $(TOP)/src/auth.c $(HDR)
324         $(TCCX) -c $(TOP)/src/auth.c
325
326 tclsqlite:      $(TOP)/src/tclsqlite.c libsqlite.a
327         $(TCCX) $(TCL_FLAGS) -DTCLSH=1 -o tclsqlite \
328                 $(TOP)/src/tclsqlite.c libsqlite.a $(LIBTCL)
329
330 testfixture$(EXE):      $(TOP)/src/tclsqlite.c libsqlite.a $(TESTSRC)
331         $(TCCX) $(TCL_FLAGS) -DTCLSH=1 -DSQLITE_TEST=1 -o testfixture$(EXE) \
332                 $(TESTSRC) $(TOP)/src/tclsqlite.c \
333                 libsqlite.a $(LIBTCL) $(THREADLIB)
334
335 fulltest:       testfixture$(EXE) sqlite$(EXE)
336         ./testfixture$(EXE) $(TOP)/test/all.test
337
338 test:   testfixture$(EXE) sqlite$(EXE)
339         ./testfixture$(EXE) $(TOP)/test/quick.test
340
341 index.html:     $(TOP)/www/index.tcl last_change
342         tclsh $(TOP)/www/index.tcl `cat $(TOP)/VERSION` >index.html
343
344 sqlite.html:    $(TOP)/www/sqlite.tcl
345         tclsh $(TOP)/www/sqlite.tcl >sqlite.html
346
347 c_interface.html:       $(TOP)/www/c_interface.tcl
348         tclsh $(TOP)/www/c_interface.tcl >c_interface.html
349
350 changes.html:   $(TOP)/www/changes.tcl
351         tclsh $(TOP)/www/changes.tcl >changes.html
352
353 lang.html:      $(TOP)/www/lang.tcl
354         tclsh $(TOP)/www/lang.tcl >lang.html
355
356 vdbe.html:      $(TOP)/www/vdbe.tcl
357         tclsh $(TOP)/www/vdbe.tcl >vdbe.html
358
359 arch.html:      $(TOP)/www/arch.tcl
360         tclsh $(TOP)/www/arch.tcl >arch.html
361
362 arch.png:       $(TOP)/www/arch.png
363         cp $(TOP)/www/arch.png .
364
365 opcode.html:    $(TOP)/www/opcode.tcl $(TOP)/src/vdbe.c
366         tclsh $(TOP)/www/opcode.tcl $(TOP)/src/vdbe.c >opcode.html
367
368 mingw.html:     $(TOP)/www/mingw.tcl
369         tclsh $(TOP)/www/mingw.tcl >mingw.html
370
371 tclsqlite.html: $(TOP)/www/tclsqlite.tcl
372         tclsh $(TOP)/www/tclsqlite.tcl >tclsqlite.html
373
374 speed.html:     $(TOP)/www/speed.tcl
375         tclsh $(TOP)/www/speed.tcl >speed.html
376
377 faq.html:       $(TOP)/www/faq.tcl
378         tclsh $(TOP)/www/faq.tcl >faq.html
379
380 formatchng.html:        $(TOP)/www/formatchng.tcl
381         tclsh $(TOP)/www/formatchng.tcl >formatchng.html
382
383 conflict.html:  $(TOP)/www/conflict.tcl
384         tclsh $(TOP)/www/conflict.tcl >conflict.html
385
386 download.html:  $(TOP)/www/download.tcl
387         tclsh $(TOP)/www/download.tcl >download.html
388
389 omitted.html:   $(TOP)/www/omitted.tcl
390         tclsh $(TOP)/www/omitted.tcl >omitted.html
391
392 datatypes.html: $(TOP)/www/datatypes.tcl
393         tclsh $(TOP)/www/datatypes.tcl >datatypes.html
394
395 quickstart.html:        $(TOP)/www/quickstart.tcl
396         tclsh $(TOP)/www/quickstart.tcl >quickstart.html
397
398 fileformat.html:        $(TOP)/www/fileformat.tcl
399         tclsh $(TOP)/www/fileformat.tcl >fileformat.html
400
401 nulls.html:     $(TOP)/www/nulls.tcl
402         tclsh $(TOP)/www/nulls.tcl >nulls.html
403
404
405 # Files to be published on the website.
406 #
407 DOC = \
408   index.html \
409   sqlite.html \
410   changes.html \
411   lang.html \
412   opcode.html \
413   arch.html \
414   arch.png \
415   vdbe.html \
416   c_interface.html \
417   mingw.html \
418   tclsqlite.html \
419   download.html \
420   speed.html \
421   faq.html \
422   formatchng.html \
423   conflict.html \
424   omitted.html \
425   datatypes.html \
426   quickstart.html \
427   fileformat.html \
428   nulls.html
429
430 doc:    $(DOC)
431         mkdir -p doc
432         mv $(DOC) doc
433
434 install:        sqlite libsqlite.a sqlite.h
435         mv sqlite /usr/bin
436         mv libsqlite.a /usr/lib
437         mv sqlite.h /usr/include
438
439 clean:  
440         rm -f *.o sqlite libsqlite.a sqlite.h opcodes.*
441         rm -f lemon lempar.c parse.* sqlite*.tar.gz
442         rm -f $(PUBLISH)
443         rm -f *.da *.bb *.bbg gmon.out
444         rm -rf tsrc