Home | History | Annotate | Download | only in src
      1 #!/usr/make
      2 #
      3 # Makefile for SQLITE on VxWorks
      4 
      5 ifeq ($(FORCPU),)
      6   FORCPU = SH32gnule
      7 endif
      8 
      9 TOOL_FAMILY = gnu
     10 
     11 include $(WIND_USR)/tool/gnu/make.$(FORCPU)
     12 
     13 #### The toplevel directory of the source tree.  This is the directory
     14 #    that contains this "Makefile.in" and the "configure.in" script.
     15 #
     16 TOP = .
     17 
     18 #### C Compiler and options for use in building executables that
     19 #    will run on the platform that is doing the build.
     20 #
     21 BCC = gcc -g -O2
     22 #BCC = /opt/ancic/bin/c89 -0
     23 
     24 #### If the target operating system supports the "usleep()" system
     25 #    call, then define the HAVE_USLEEP macro for all C modules.
     26 #
     27 USLEEP = 
     28 #USLEEP = -DHAVE_USLEEP=1
     29 
     30 #### If you want the SQLite library to be safe for use within a 
     31 #    multi-threaded program, then define the following macro
     32 #    appropriately:
     33 #
     34 THREADSAFE = -DSQLITE_THREADSAFE=1
     35 #THREADSAFE = -DSQLITE_THREADSAFE=0
     36 
     37 #### Specify any extra linker options needed to make the library
     38 #    thread safe
     39 #
     40 #THREADLIB = -lpthread
     41 THREADLIB = 
     42 
     43 #### Specify any extra libraries needed to access required functions.
     44 #
     45 ifeq ($(CPU),SH32) 
     46   # for SH4 shared library
     47   TLIBS_SHARED += -L$(WIND_USR)/lib/sh/SH32/commonle/PIC
     48 else 
     49   # for all other CPUs shared library
     50   TLIBS_SHARED += $(LD_LINK_PATH_ATEND) $(LD_PARTIAL_LAST_FLAGS)
     51 endif
     52 # for static library
     53 TLIBS += $(LD_LINK_PATH_ATEND) $(LD_PARTIAL_LAST_FLAGS)
     54 
     55 #### Leave SQLITE_DEBUG undefined for maximum speed.  Use SQLITE_DEBUG=1
     56 #    to check for memory leaks.  Use SQLITE_DEBUG=2 to print a log of all
     57 #    malloc()s and free()s in order to track down memory leaks.
     58 #    
     59 #    SQLite uses some expensive assert() statements in the inner loop.
     60 #    You can make the library go almost twice as fast if you compile
     61 #    with -DNDEBUG=1
     62 #
     63 #OPTS = -DSQLITE_DEBUG=2
     64 #OPTS = -DSQLITE_DEBUG=1
     65 #OPTS = 
     66 OPTS = -DNDEBUG=1 -DSQLITE_OS_UNIX=1 $(THREADSAFE)
     67 OPTS += -DSQLITE_OMIT_LOAD_EXTENSION=1
     68 OPTS += -DSQLITE_ENABLE_LOCKING_STYLE=1
     69 OPTS += -DSQLITE_THREAD_OVERRIDE_LOCK=0
     70 OPTS += -DSQLITE_ENABLE_COLUMN_METADATA=1
     71 OPTS += -DHAVE_FDATASYNC=1
     72 
     73 #### The suffix to add to executable files.  ".exe" for windows.
     74 #    Nothing for unix.
     75 #
     76 EXE = .vxe
     77 #EXE =
     78 
     79 #### C Compile and options for use in building executables that 
     80 #    will run on the target platform.  This is usually the same
     81 #    as BCC, unless you are cross-compiling.
     82 #
     83 #TCC = gcc -O6
     84 #TCC = gcc -g -O0 -Wall
     85 #TCC = gcc -g -O0 -Wall -fprofile-arcs -ftest-coverage
     86 #TCC = /opt/mingw/bin/i386-mingw32-gcc -O6
     87 TCC = $(CC) $(DEFINE_CC) -O2 -g -mrtp $(CC_ARCH_SPEC) -D_REENTRANT=1 -D_VX_CPU=_VX_$(CPU) -D_VX_TOOL_FAMILY=$(TOOL_FAMILY) -D_VX_TOOL=$(TOOL)
     88 TCC += -I$(WIND_USR)/h -I$(WIND_USR)/h/wrn/coreip
     89 #TCC = /opt/ansic/bin/c89 -O +z -Wl,-a,archive
     90 
     91 #TCC_SHARED = $(TCC) -fPIC
     92 TCC_SHARED = $(TCC)
     93 
     94 #### Tools used to build a static library.
     95 #
     96 #ARX = ar cr
     97 #ARX = /opt/mingw/bin/i386-mingw32-ar cr
     98 AR += cr
     99 #RANLIB = ranlib
    100 #RANLIB = /opt/mingw/bin/i386-mingw32-ranlib
    101 
    102 #MKSHLIB = gcc -shared
    103 #SO = so
    104 #SHPREFIX = lib
    105 MKSHLIB = $(CC) $(DEFINE_CC) -mrtp -shared $(CC_ARCH_SPEC) -D_VX_CPU=_VX_$(CPU) -D_VX_TOOL_FAMILY=$(TOOL_FAMILY) -D_VX_TOOL=$(TOOL)
    106 SO = so
    107 SHPREFIX = lib
    108 
    109 #### Extra compiler options needed for programs that use the TCL library.
    110 #
    111 #TCL_FLAGS =
    112 #TCL_FLAGS = -DSTATIC_BUILD=1
    113 TCL_FLAGS = -I/home/drh/tcltk/8.5linux
    114 #TCL_FLAGS = -I/home/drh/tcltk/8.5win -DSTATIC_BUILD=1
    115 #TCL_FLAGS = -I/home/drh/tcltk/8.3hpux
    116 
    117 #### Linker options needed to link against the TCL library.
    118 #
    119 #LIBTCL = -ltcl -lm -ldl
    120 LIBTCL = /home/drh/tcltk/8.5linux/libtcl8.5g.a -lm -ldl
    121 #LIBTCL = /home/drh/tcltk/8.5win/libtcl85s.a -lmsvcrt
    122 #LIBTCL = /home/drh/tcltk/8.3hpux/libtcl8.3.a -ldld -lm -lc
    123 
    124 #### Additional objects for SQLite library when TCL support is enabled.
    125 TCLOBJ =
    126 #TCLOBJ = tclsqlite.o
    127 
    128 #### Compiler options needed for programs that use the readline() library.
    129 #
    130 READLINE_FLAGS =
    131 #READLINE_FLAGS = -DHAVE_READLINE=1 -I/usr/include/readline
    132 
    133 #### Linker options needed by programs using readline() must link against.
    134 #
    135 LIBREADLINE =
    136 #LIBREADLINE = -static -lreadline -ltermcap
    137 
    138 #### Which "awk" program provides nawk compatibilty
    139 #
    140 # NAWK = nawk
    141 NAWK = awk
    142 
    143 
    144 #### Pasted and adapted main.mk file
    145 ###############################################################################
    146 # The following macros should be defined before this script is
    147 # invoked:
    148 #
    149 # TOP              The toplevel directory of the source tree.  This is the
    150 #                  directory that contains this "Makefile.in" and the
    151 #                  "configure.in" script.
    152 #
    153 # BCC              C Compiler and options for use in building executables that
    154 #                  will run on the platform that is doing the build.
    155 #
    156 # THREADLIB        Specify any extra linker options needed to make the library
    157 #                  thread safe
    158 #
    159 # OPTS             Extra compiler command-line options.
    160 #
    161 # EXE              The suffix to add to executable files.  ".exe" for windows
    162 #                  and "" for Unix.
    163 #
    164 # TCC              C Compiler and options for use in building executables that 
    165 #                  will run on the target platform.  This is usually the same
    166 #                  as BCC, unless you are cross-compiling.
    167 #
    168 # AR               Tools used to build a static library.
    169 # RANLIB
    170 #
    171 # TCL_FLAGS        Extra compiler options needed for programs that use the
    172 #                  TCL library.
    173 #
    174 # LIBTCL           Linker options needed to link against the TCL library.
    175 #
    176 # READLINE_FLAGS   Compiler options needed for programs that use the
    177 #                  readline() library.
    178 #
    179 # LIBREADLINE      Linker options needed by programs using readline() must
    180 #                  link against.
    181 #
    182 # NAWK             Nawk compatible awk program.  Older (obsolete?) solaris
    183 #                  systems need this to avoid using the original AT&T AWK.
    184 #
    185 # Once the macros above are defined, the rest of this make script will
    186 # build the SQLite library and testing tools.
    187 ################################################################################
    188 
    189 # This is how we compile
    190 #
    191 TCCX = $(TCC) $(OPTS) -I. -I$(TOP)/src -I$(TOP)
    192 TCCX_SHARED = $(TCC_SHARED) $(OPTS) -I. -I$(TOP)/src -I$(TOP) \
    193 	-I$(TOP)/ext/rtree -I$(TOP)/ext/icu -I$(TOP)/ext/fts3 \
    194 	-I$(TOP)/ext/async
    195 
    196 # Object files for the SQLite library.
    197 #
    198 LIBOBJ+= alter.o analyze.o attach.o auth.o \
    199          backup.o bitvec.o btmutex.o btree.o build.o \
    200          callback.o complete.o date.o delete.o expr.o fault.o \
    201          fts3.o fts3_expr.o fts3_hash.o fts3_icu.o fts3_porter.o \
    202          fts3_tokenizer.o fts3_tokenizer1.o \
    203          func.o global.o hash.o \
    204          icu.o insert.o journal.o legacy.o loadext.o \
    205          main.o malloc.o mem0.o mem1.o mem2.o mem3.o mem5.o \
    206          memjournal.o \
    207          mutex.o mutex_noop.o mutex_os2.o mutex_unix.o mutex_w32.o \
    208          notify.o opcodes.o os.o os_os2.o os_unix.o os_win.o \
    209          pager.o parse.o pcache.o pcache1.o pragma.o prepare.o printf.o \
    210          random.o resolve.o rowset.o rtree.o select.o status.o \
    211          table.o tokenize.o trigger.o \
    212          update.o util.o vacuum.o \
    213          vdbe.o vdbeapi.o vdbeaux.o vdbeblob.o vdbemem.o \
    214          walker.o where.o utf.o vtab.o
    215 
    216 
    217 
    218 # All of the source code files.
    219 #
    220 SRC = \
    221   $(TOP)/src/alter.c \
    222   $(TOP)/src/analyze.c \
    223   $(TOP)/src/attach.c \
    224   $(TOP)/src/auth.c \
    225   $(TOP)/src/backup.c \
    226   $(TOP)/src/bitvec.c \
    227   $(TOP)/src/btmutex.c \
    228   $(TOP)/src/btree.c \
    229   $(TOP)/src/btree.h \
    230   $(TOP)/src/btreeInt.h \
    231   $(TOP)/src/build.c \
    232   $(TOP)/src/callback.c \
    233   $(TOP)/src/complete.c \
    234   $(TOP)/src/ctime.c \
    235   $(TOP)/src/date.c \
    236   $(TOP)/src/delete.c \
    237   $(TOP)/src/expr.c \
    238   $(TOP)/src/fault.c \
    239   $(TOP)/src/func.c \
    240   $(TOP)/src/global.c \
    241   $(TOP)/src/hash.c \
    242   $(TOP)/src/hash.h \
    243   $(TOP)/src/hwtime.h \
    244   $(TOP)/src/insert.c \
    245   $(TOP)/src/journal.c \
    246   $(TOP)/src/legacy.c \
    247   $(TOP)/src/loadext.c \
    248   $(TOP)/src/main.c \
    249   $(TOP)/src/malloc.c \
    250   $(TOP)/src/mem0.c \
    251   $(TOP)/src/mem1.c \
    252   $(TOP)/src/mem2.c \
    253   $(TOP)/src/mem3.c \
    254   $(TOP)/src/mem5.c \
    255   $(TOP)/src/memjournal.c \
    256   $(TOP)/src/mutex.c \
    257   $(TOP)/src/mutex.h \
    258   $(TOP)/src/mutex_noop.c \
    259   $(TOP)/src/mutex_os2.c \
    260   $(TOP)/src/mutex_unix.c \
    261   $(TOP)/src/mutex_w32.c \
    262   $(TOP)/src/notify.c \
    263   $(TOP)/src/os.c \
    264   $(TOP)/src/os.h \
    265   $(TOP)/src/os_common.h \
    266   $(TOP)/src/os_os2.c \
    267   $(TOP)/src/os_unix.c \
    268   $(TOP)/src/os_win.c \
    269   $(TOP)/src/pager.c \
    270   $(TOP)/src/pager.h \
    271   $(TOP)/src/parse.y \
    272   $(TOP)/src/pcache.c \
    273   $(TOP)/src/pcache.h \
    274   $(TOP)/src/pcache1.c \
    275   $(TOP)/src/pragma.c \
    276   $(TOP)/src/prepare.c \
    277   $(TOP)/src/printf.c \
    278   $(TOP)/src/random.c \
    279   $(TOP)/src/resolve.c \
    280   $(TOP)/src/rowset.c \
    281   $(TOP)/src/select.c \
    282   $(TOP)/src/status.c \
    283   $(TOP)/src/shell.c \
    284   $(TOP)/src/sqlite.h.in \
    285   $(TOP)/src/sqlite3ext.h \
    286   $(TOP)/src/sqliteInt.h \
    287   $(TOP)/src/sqliteLimit.h \
    288   $(TOP)/src/table.c \
    289   $(TOP)/src/tclsqlite.c \
    290   $(TOP)/src/tokenize.c \
    291   $(TOP)/src/trigger.c \
    292   $(TOP)/src/utf.c \
    293   $(TOP)/src/update.c \
    294   $(TOP)/src/util.c \
    295   $(TOP)/src/vacuum.c \
    296   $(TOP)/src/vdbe.c \
    297   $(TOP)/src/vdbe.h \
    298   $(TOP)/src/vdbeapi.c \
    299   $(TOP)/src/vdbeaux.c \
    300   $(TOP)/src/vdbeblob.c \
    301   $(TOP)/src/vdbemem.c \
    302   $(TOP)/src/vdbeInt.h \
    303   $(TOP)/src/vtab.c \
    304   $(TOP)/src/walker.c \
    305   $(TOP)/src/where.c
    306 
    307 # Source code for extensions
    308 #
    309 SRC += \
    310   $(TOP)/ext/fts1/fts1.c \
    311   $(TOP)/ext/fts1/fts1.h \
    312   $(TOP)/ext/fts1/fts1_hash.c \
    313   $(TOP)/ext/fts1/fts1_hash.h \
    314   $(TOP)/ext/fts1/fts1_porter.c \
    315   $(TOP)/ext/fts1/fts1_tokenizer.h \
    316   $(TOP)/ext/fts1/fts1_tokenizer1.c
    317 SRC += \
    318   $(TOP)/ext/fts2/fts2.c \
    319   $(TOP)/ext/fts2/fts2.h \
    320   $(TOP)/ext/fts2/fts2_hash.c \
    321   $(TOP)/ext/fts2/fts2_hash.h \
    322   $(TOP)/ext/fts2/fts2_icu.c \
    323   $(TOP)/ext/fts2/fts2_porter.c \
    324   $(TOP)/ext/fts2/fts2_tokenizer.h \
    325   $(TOP)/ext/fts2/fts2_tokenizer.c \
    326   $(TOP)/ext/fts2/fts2_tokenizer1.c
    327 SRC += \
    328   $(TOP)/ext/fts3/fts3.c \
    329   $(TOP)/ext/fts3/fts3.h \
    330   $(TOP)/ext/fts3/fts3_expr.c \
    331   $(TOP)/ext/fts3/fts3_expr.h \
    332   $(TOP)/ext/fts3/fts3_hash.c \
    333   $(TOP)/ext/fts3/fts3_hash.h \
    334   $(TOP)/ext/fts3/fts3_icu.c \
    335   $(TOP)/ext/fts3/fts3_porter.c \
    336   $(TOP)/ext/fts3/fts3_tokenizer.h \
    337   $(TOP)/ext/fts3/fts3_tokenizer.c \
    338   $(TOP)/ext/fts3/fts3_tokenizer1.c
    339 SRC += \
    340   $(TOP)/ext/icu/sqliteicu.h \
    341   $(TOP)/ext/icu/icu.c 
    342 SRC += \
    343   $(TOP)/ext/rtree/rtree.h \
    344   $(TOP)/ext/rtree/rtree.c
    345 
    346 
    347 # Generated source code files
    348 #
    349 SRC += \
    350   keywordhash.h \
    351   opcodes.c \
    352   opcodes.h \
    353   parse.c \
    354   parse.h \
    355   sqlite3.h
    356 
    357 
    358 # Source code to the test files.
    359 #
    360 TESTSRC = \
    361   $(TOP)/src/test1.c \
    362   $(TOP)/src/test2.c \
    363   $(TOP)/src/test3.c \
    364   $(TOP)/src/test4.c \
    365   $(TOP)/src/test5.c \
    366   $(TOP)/src/test6.c \
    367   $(TOP)/src/test7.c \
    368   $(TOP)/src/test8.c \
    369   $(TOP)/src/test9.c \
    370   $(TOP)/src/test_autoext.c \
    371   $(TOP)/src/test_async.c \
    372   $(TOP)/src/test_backup.c \
    373   $(TOP)/src/test_btree.c \
    374   $(TOP)/src/test_config.c \
    375   $(TOP)/src/test_devsym.c \
    376   $(TOP)/src/test_func.c \
    377   $(TOP)/src/test_hexio.c \
    378   $(TOP)/src/test_journal.c \
    379   $(TOP)/src/test_malloc.c \
    380   $(TOP)/src/test_md5.c \
    381   $(TOP)/src/test_mutex.c \
    382   $(TOP)/src/test_onefile.c \
    383   $(TOP)/src/test_osinst.c \
    384   $(TOP)/src/test_pcache.c \
    385   $(TOP)/src/test_schema.c \
    386   $(TOP)/src/test_server.c \
    387   $(TOP)/src/test_tclvar.c \
    388   $(TOP)/src/test_thread.c \
    389   $(TOP)/src/test_vfs.c \
    390   $(TOP)/src/test_wsd.c \
    391 
    392 #TESTSRC += $(TOP)/ext/fts2/fts2_tokenizer.c
    393 #TESTSRC += $(TOP)/ext/fts3/fts3_tokenizer.c
    394 
    395 TESTSRC2 = \
    396   $(TOP)/src/attach.c $(TOP)/src/backup.c $(TOP)/src/btree.c                   \
    397   $(TOP)/src/build.c $(TOP)/src/ctime.c $(TOP)/src/date.c                      \
    398   $(TOP)/src/expr.c $(TOP)/src/func.c $(TOP)/src/insert.c $(TOP)/src/os.c      \
    399   $(TOP)/src/os_os2.c $(TOP)/src/os_unix.c $(TOP)/src/os_win.c                 \
    400   $(TOP)/src/pager.c $(TOP)/src/pragma.c $(TOP)/src/prepare.c                  \
    401   $(TOP)/src/printf.c $(TOP)/src/random.c $(TOP)/src/pcache.c                  \
    402   $(TOP)/src/pcache1.c $(TOP)/src/select.c $(TOP)/src/tokenize.c               \
    403   $(TOP)/src/utf.c $(TOP)/src/util.c $(TOP)/src/vdbeapi.c $(TOP)/src/vdbeaux.c \
    404   $(TOP)/src/vdbe.c $(TOP)/src/vdbemem.c $(TOP)/src/where.c parse.c            \
    405   $(TOP)/ext/fts3/fts3.c $(TOP)/ext/fts3/fts3_expr.c                           \
    406   $(TOP)/ext/fts3/fts3_tokenizer.c                                             \
    407   $(TOP)/ext/async/sqlite3async.c
    408 
    409 # Header files used by all library source files.
    410 #
    411 HDR = \
    412    $(TOP)/src/btree.h \
    413    $(TOP)/src/btreeInt.h \
    414    $(TOP)/src/hash.h \
    415    $(TOP)/src/hwtime.h \
    416    keywordhash.h \
    417    $(TOP)/src/mutex.h \
    418    opcodes.h \
    419    $(TOP)/src/os.h \
    420    $(TOP)/src/os_common.h \
    421    $(TOP)/src/pager.h \
    422    $(TOP)/src/pcache.h \
    423    parse.h  \
    424    sqlite3.h  \
    425    $(TOP)/src/sqlite3ext.h \
    426    $(TOP)/src/sqliteInt.h  \
    427    $(TOP)/src/sqliteLimit.h \
    428    $(TOP)/src/vdbe.h \
    429    $(TOP)/src/vdbeInt.h
    430 
    431 # Header files used by extensions
    432 #
    433 EXTHDR += \
    434   $(TOP)/ext/fts1/fts1.h \
    435   $(TOP)/ext/fts1/fts1_hash.h \
    436   $(TOP)/ext/fts1/fts1_tokenizer.h
    437 EXTHDR += \
    438   $(TOP)/ext/fts2/fts2.h \
    439   $(TOP)/ext/fts2/fts2_hash.h \
    440   $(TOP)/ext/fts2/fts2_tokenizer.h
    441 EXTHDR += \
    442   $(TOP)/ext/fts3/fts3.h \
    443   $(TOP)/ext/fts3/fts3_expr.h \
    444   $(TOP)/ext/fts3/fts3_hash.h \
    445   $(TOP)/ext/fts3/fts3_tokenizer.h
    446 EXTHDR += \
    447   $(TOP)/ext/rtree/rtree.h
    448 EXTHDR += \
    449   $(TOP)/ext/icu/sqliteicu.h
    450 
    451 # This is the default Makefile target.  The objects listed here
    452 # are what get build when you type just "make" with no arguments.
    453 #
    454 all:	sqlite3.h libsqlite3.a sqlite3$(EXE)
    455 
    456 libsqlite3.a:	$(LIBOBJ)
    457 	$(AR) libsqlite3.a $(LIBOBJ)
    458 	$(RANLIB) libsqlite3.a
    459 
    460 $(SHPREFIX)sqlite3.$(SO):	$(LIBOBJ)
    461 	$(MKSHLIB) -o $(SHPREFIX)sqlite3.$(SO) $(LIBOBJ) $(TLIBS_SHARED)
    462 
    463 sqlite3$(EXE):	$(TOP)/src/shell.c libsqlite3.a sqlite3.h
    464 	$(TCCX) $(READLINE_FLAGS) -o sqlite3$(EXE)      \
    465 		$(TOP)/src/shell.c                      \
    466 		$(LIBREADLINE) $(TLIBS) $(THREADLIB) -L. -lsqlite3
    467 
    468 # This target creates a directory named "tsrc" and fills it with
    469 # copies of all of the C source code and header files needed to
    470 # build on the target system.  Some of the C source code and header
    471 # files are automatically generated.  This target takes care of
    472 # all that automatic generation.
    473 #
    474 target_source:	$(SRC)
    475 	rm -rf tsrc
    476 	mkdir tsrc
    477 	cp -f $(SRC) tsrc
    478 	rm tsrc/sqlite.h.in tsrc/parse.y
    479 	touch target_source
    480 
    481 sqlite3.c:	target_source $(TOP)/tool/mksqlite3c.tcl
    482 	tclsh $(TOP)/tool/mksqlite3c.tcl
    483 	cp sqlite3.c tclsqlite3.c
    484 	cat $(TOP)/src/tclsqlite.c >>tclsqlite3.c
    485 
    486 fts2amal.c:	target_source $(TOP)/ext/fts2/mkfts2amal.tcl
    487 	tclsh $(TOP)/ext/fts2/mkfts2amal.tcl
    488 
    489 fts3amal.c:	target_source $(TOP)/ext/fts3/mkfts3amal.tcl
    490 	tclsh $(TOP)/ext/fts3/mkfts3amal.tcl
    491 
    492 # Rules to build the LEMON compiler generator
    493 #
    494 lemon:	$(TOP)/tool/lemon.c $(TOP)/src/lempar.c
    495 	$(BCC) -o lemon $(TOP)/tool/lemon.c
    496 	cp $(TOP)/src/lempar.c .
    497 
    498 # Rules to build individual *.o files from generated *.c files. This
    499 # applies to:
    500 #
    501 #     parse.o
    502 #     opcodes.o
    503 #
    504 %.o: %.c $(HDR)
    505 	$(TCCX_SHARED) -c $<
    506 
    507 # Rules to build individual *.o files from files in the src directory.
    508 #
    509 %.o: $(TOP)/src/%.c $(HDR)
    510 	$(TCCX_SHARED) -c $<
    511 
    512 tclsqlite.o:	$(TOP)/src/tclsqlite.c $(HDR)
    513 	$(TCCX_SHARED) $(TCL_FLAGS) -c $(TOP)/src/tclsqlite.c
    514 
    515 
    516 
    517 # Rules to build opcodes.c and opcodes.h
    518 #
    519 opcodes.c:	opcodes.h $(TOP)/mkopcodec.awk
    520 	sort -n -b -k 3 opcodes.h | $(NAWK) -f $(TOP)/mkopcodec.awk >opcodes.c
    521 
    522 opcodes.h:	parse.h $(TOP)/src/vdbe.c $(TOP)/mkopcodeh.awk
    523 	cat parse.h $(TOP)/src/vdbe.c | \
    524 		$(NAWK) -f $(TOP)/mkopcodeh.awk >opcodes.h
    525 
    526 # Rules to build parse.c and parse.h - the outputs of lemon.
    527 #
    528 parse.h:	parse.c
    529 
    530 parse.c:	$(TOP)/src/parse.y lemon $(TOP)/addopcodes.awk
    531 	cp $(TOP)/src/parse.y .
    532 	rm -f parse.h
    533 	./lemon $(OPTS) parse.y
    534 	mv parse.h parse.h.temp
    535 	awk -f $(TOP)/addopcodes.awk parse.h.temp >parse.h
    536 
    537 sqlite3.h:	$(TOP)/src/sqlite.h.in 
    538 	sed -e s/--VERS--/`cat ${TOP}/VERSION`/ \
    539 	    -e s/--VERSION-NUMBER--/`cat ${TOP}/VERSION | sed 's/[^0-9]/ /g' | $(NAWK) '{printf "%d%03d%03d",$$1,$$2,$$3}'`/ \
    540                  $(TOP)/src/sqlite.h.in >sqlite3.h
    541 
    542 keywordhash.h:	$(TOP)/tool/mkkeywordhash.c
    543 	$(BCC) -o mkkeywordhash $(OPTS) $(TOP)/tool/mkkeywordhash.c
    544 	./mkkeywordhash >keywordhash.h
    545 
    546 
    547 
    548 # Rules to build the extension objects.
    549 #
    550 icu.o:	$(TOP)/ext/icu/icu.c $(HDR) $(EXTHDR)
    551 	$(TCCX_SHARED) -DSQLITE_CORE -c $(TOP)/ext/icu/icu.c
    552 
    553 fts2.o:	$(TOP)/ext/fts2/fts2.c $(HDR) $(EXTHDR)
    554 	$(TCCX_SHARED) -DSQLITE_CORE -c $(TOP)/ext/fts2/fts2.c
    555 
    556 fts2_hash.o:	$(TOP)/ext/fts2/fts2_hash.c $(HDR) $(EXTHDR)
    557 	$(TCCX_SHARED) -DSQLITE_CORE -c $(TOP)/ext/fts2/fts2_hash.c
    558 
    559 fts2_icu.o:	$(TOP)/ext/fts2/fts2_icu.c $(HDR) $(EXTHDR)
    560 	$(TCCX_SHARED) -DSQLITE_CORE -c $(TOP)/ext/fts2/fts2_icu.c
    561 
    562 fts2_porter.o:	$(TOP)/ext/fts2/fts2_porter.c $(HDR) $(EXTHDR)
    563 	$(TCCX_SHARED) -DSQLITE_CORE -c $(TOP)/ext/fts2/fts2_porter.c
    564 
    565 fts2_tokenizer.o:	$(TOP)/ext/fts2/fts2_tokenizer.c $(HDR) $(EXTHDR)
    566 	$(TCCX_SHARED) -DSQLITE_CORE -c $(TOP)/ext/fts2/fts2_tokenizer.c
    567 
    568 fts2_tokenizer1.o:	$(TOP)/ext/fts2/fts2_tokenizer1.c $(HDR) $(EXTHDR)
    569 	$(TCCX_SHARED) -DSQLITE_CORE -c $(TOP)/ext/fts2/fts2_tokenizer1.c
    570 
    571 fts3.o:	$(TOP)/ext/fts3/fts3.c $(HDR) $(EXTHDR)
    572 	$(TCCX_SHARED) -DSQLITE_CORE -c $(TOP)/ext/fts3/fts3.c
    573 
    574 fts3_expr.o:	$(TOP)/ext/fts3/fts3_expr.c $(HDR) $(EXTHDR)
    575 	$(TCCX_SHARED) -DSQLITE_CORE -c $(TOP)/ext/fts3/fts3_expr.c
    576 
    577 fts3_hash.o:	$(TOP)/ext/fts3/fts3_hash.c $(HDR) $(EXTHDR)
    578 	$(TCCX_SHARED) -DSQLITE_CORE -c $(TOP)/ext/fts3/fts3_hash.c
    579 
    580 fts3_icu.o:	$(TOP)/ext/fts3/fts3_icu.c $(HDR) $(EXTHDR)
    581 	$(TCCX_SHARED) -DSQLITE_CORE -c $(TOP)/ext/fts3/fts3_icu.c
    582 
    583 fts3_porter.o:	$(TOP)/ext/fts3/fts3_porter.c $(HDR) $(EXTHDR)
    584 	$(TCCX_SHARED) -DSQLITE_CORE -c $(TOP)/ext/fts3/fts3_porter.c
    585 
    586 fts3_tokenizer.o:	$(TOP)/ext/fts3/fts3_tokenizer.c $(HDR) $(EXTHDR)
    587 	$(TCCX_SHARED) -DSQLITE_CORE -c $(TOP)/ext/fts3/fts3_tokenizer.c
    588 
    589 fts3_tokenizer1.o:	$(TOP)/ext/fts3/fts3_tokenizer1.c $(HDR) $(EXTHDR)
    590 	$(TCCX_SHARED) -DSQLITE_CORE -c $(TOP)/ext/fts3/fts3_tokenizer1.c
    591 
    592 rtree.o:	$(TOP)/ext/rtree/rtree.c $(HDR) $(EXTHDR)
    593 	$(TCCX_SHARED) -DSQLITE_CORE -c $(TOP)/ext/rtree/rtree.c
    594 
    595 
    596 # Rules for building test programs and for running tests
    597 #
    598 tclsqlite3:	$(TOP)/src/tclsqlite.c libsqlite3.a
    599 	$(TCCX_SHARED) $(TCL_FLAGS) -DTCLSH=1 -o tclsqlite3 \
    600 		$(TOP)/src/tclsqlite.c libsqlite3.a $(LIBTCL) $(THREADLIB)
    601 
    602 
    603 # Rules to build the 'testfixture' application.
    604 #
    605 TESTFIXTURE_FLAGS  = -DTCLSH=1 -DSQLITE_TEST=1 -DSQLITE_CRASH_TEST=1
    606 TESTFIXTURE_FLAGS += -DSQLITE_SERVER=1 -DSQLITE_PRIVATE="" -DSQLITE_CORE 
    607 
    608 testfixture$(EXE): $(TESTSRC2) libsqlite3.a $(TESTSRC) $(TOP)/src/tclsqlite.c
    609 	$(TCCX) $(TCL_FLAGS) $(TESTFIXTURE_FLAGS)                            \
    610 		$(TESTSRC) $(TESTSRC2) $(TOP)/src/tclsqlite.c                \
    611 		-o testfixture$(EXE) $(LIBTCL) $(THREADLIB) libsqlite3.a
    612 
    613 amalgamation-testfixture$(EXE): sqlite3.c $(TESTSRC) $(TOP)/src/tclsqlite.c
    614 	$(TCCX) $(TCL_FLAGS) $(TESTFIXTURE_FLAGS)                            \
    615 		$(TESTSRC) $(TOP)/src/tclsqlite.c sqlite3.c                  \
    616 		-o testfixture$(EXE) $(LIBTCL) $(THREADLIB)
    617 
    618 fts3-testfixture$(EXE): sqlite3.c fts3amal.c $(TESTSRC) $(TOP)/src/tclsqlite.c
    619 	$(TCCX) $(TCL_FLAGS) $(TESTFIXTURE_FLAGS)                            \
    620 	-DSQLITE_ENABLE_FTS3=1                                               \
    621 		$(TESTSRC) $(TOP)/src/tclsqlite.c sqlite3.c fts3amal.c       \
    622 		-o testfixture$(EXE) $(LIBTCL) $(THREADLIB)
    623 
    624 fulltest:	testfixture$(EXE) sqlite3$(EXE)
    625 	./testfixture$(EXE) $(TOP)/test/all.test
    626 
    627 soaktest:	testfixture$(EXE) sqlite3$(EXE)
    628 	./testfixture$(EXE) $(TOP)/test/all.test -soak=1
    629 
    630 test:	testfixture$(EXE) sqlite3$(EXE)
    631 	./testfixture$(EXE) $(TOP)/test/veryquick.test
    632 
    633 sqlite3_analyzer$(EXE):	$(TOP)/src/tclsqlite.c sqlite3.c $(TESTSRC) \
    634 			$(TOP)/tool/spaceanal.tcl
    635 	sed \
    636 	  -e '/^#/d' \
    637 	  -e 's,\\,\\\\,g' \
    638 	  -e 's,",\\",g' \
    639 	  -e 's,^,",' \
    640 	  -e 's,$$,\\n",' \
    641 	  $(TOP)/tool/spaceanal.tcl >spaceanal_tcl.h
    642 	$(TCCX) $(TCL_FLAGS)                  $(TESTFIXTURE_FLAGS)                                 \
    643 		-DTCLSH=2 -DSQLITE_TEST=1 -DSQLITE_DEBUG=1 -DSQLITE_PRIVATE="" \
    644 		$(TESTSRC) $(TOP)/src/tclsqlite.c sqlite3.c                    \
    645 		-o sqlite3_analyzer$(EXE)                                      \
    646 		$(LIBTCL) $(THREADLIB)
    647 
    648 TEST_EXTENSION = $(SHPREFIX)testloadext.$(SO)
    649 $(TEST_EXTENSION): $(TOP)/src/test_loadext.c
    650 	$(MKSHLIB) $(TOP)/src/test_loadext.c -o $(TEST_EXTENSION)
    651 
    652 extensiontest: testfixture$(EXE) $(TEST_EXTENSION)
    653 	./testfixture$(EXE) $(TOP)/test/loadext.test
    654 
    655 clean:	
    656 	rm -f *.o sqlite3$(EXE) libsqlite3.a sqlite3.h opcodes.*
    657 	rm -f lemon lempar.c parse.* sqlite*.tar.gz mkkeywordhash keywordhash.h
    658 	rm -f $(PUBLISH)
    659 	rm -f *.da *.bb *.bbg gmon.out
    660 	rm -rf tsrc target_source
    661 	rm -f testloadext.dll libtestloadext.so
    662 	rm -f sqlite3.c fts?amal.c tclsqlite3.c
    663 	rm -f $(SHPREFIX)sqlite3.$(SO)
    664