SQLite

Artifact [f5e807375d]
Login

Artifact f5e807375d080405b757239762db8f3b4124e08a:


#!/usr/make
#
# Makefile for SQLITE

# The toplevel directory of the source tree
#
TOP = @srcdir@

# C Compiler and options for use in building executables that
# will run on the platform that is doing the build.
#
BCC = @BUILD_CC@ @BUILD_CFLAGS@

# C Compile and options for use in building executables that 
# will run on the target platform.
#
TCC = @TARGET_CC@ @TARGET_CFLAGS@ -I. -I${TOP}/src

# Tools used to build a static library.
#
AR = @TARGET_AR@
RANLIB = @TARGET_RANLIB@

# Compiler options needed for programs that use the GDBM library.
#
GDBM_FLAGS = @TARGET_GDBM_INC@

# The library that programs using GDBM must link against.
#
LIBGDBM = @TARGET_GDBM_LIBS@

# Compiler options needed for programs that use the TCL library.
#
TCL_FLAGS = @TARGET_TCL_INC@

# The library that programs using TCL must link against.
#
LIBTCL = @TARGET_TCL_LIBS@

# Compiler options needed for programs that use the readline() library.
#
READLINE_FLAGS = -DHAVE_READLINE=@TARGET_HAVE_READLINE@ @TARGET_READLINE_INC@

# The library that programs using readline() must link against.
#
LIBREADLINE = @TARGET_READLINE_LIBS@

# Object files for the SQLite library.
#
LIBOBJ = build.o dbbe.o main.o parse.o tokenize.o util.o vdbe.o where.o

# This is the default Makefile target.  The objects listed here
# are what get build when you type just "make" with no arguments.
#
all:	libsqlite.a sqlite.h sqlite 

libsqlite.a:	$(LIBOBJ)
	$(AR) libsqlite.a $(LIBOBJ)
	$(RANLIB) libsqlite.a

sqlite:	$(TOP)/src/shell.c libsqlite.a sqlite.h
	$(TCC) $(READLINE_FLAGS) -o sqlite $(TOP)/src/shell.c \
		libsqlite.a $(LIBGDBM) $(LIBREADLINE)

# Rules to build the LEMON compiler generator
#
lemon:	$(TOP)/tool/lemon.c $(TOP)/tool/lempar.c
	$(BCC) -o lemon $(TOP)/tool/lemon.c
	cp $(TOP)/tool/lempar.c .

# Header files used by all library source files.
#
HDR = \
   $(TOP)/src/sqlite.h  \
   $(TOP)/src/sqliteInt.h  \
   $(TOP)/src/dbbe.h  \
   $(TOP)/src/vdbe.h  \
   parse.h

build.o:	$(TOP)/src/build.c $(HDR)
	$(TCC) $(GDBM_FLAGS) -c $(TOP)/src/build.c

dbbe.o:	$(TOP)/src/dbbe.c $(HDR)
	$(TCC) $(GDBM_FLAGS) -c $(TOP)/src/dbbe.c

main.o:	$(TOP)/src/main.c $(HDR)
	$(TCC) $(GDBM_FLAGS) -c $(TOP)/src/main.c

parse.o:	parse.c $(HDR)
	$(TCC) $(GDBM_FLAGS) -c parse.c

parse.h:	parse.c

parse.c:	$(TOP)/src/parse.y lemon
	cp $(TOP)/src/parse.y .
	./lemon parse.y

sqlite.h:	$(TOP)/src/sqlite.h
	cp $(TOP)/src/sqlite.h .

tokenize.o:	$(TOP)/src/tokenize.c $(HDR)
	$(TCC) $(GDBM_FLAGS) -c $(TOP)/src/tokenize.c

util.o:	$(TOP)/src/util.c $(HDR)
	$(TCC) $(GDBM_FLAGS) -c $(TOP)/src/util.c

vdbe.o:	$(TOP)/src/vdbe.c $(HDR)
	$(TCC) $(GDBM_FLAGS) -c $(TOP)/src/vdbe.c

where.o:	$(TOP)/src/where.c $(HDR)
	$(TCC) $(GDBM_FLAGS) -c $(TOP)/src/where.c

gdbmdump:	$(TOP)/tool/gdbmdump.c
	$(TCC) $(GDBM_FLAGS) -o gdbmdump $(TOP)/tool/gdbmdump.c $(LIBGDBM)

tclsqlite:	$(TOP)/src/tclsqlite.c libsqlite.a
	$(TCC) $(TCL_FLAGS) -DTCLSH=1 -o tclsqlite \
		$(TOP)/src/tclsqlite.c libsqlite.a $(LIBGDBM) $(LIBTCL)

regression:	tclsqlite
	for i in $(TOP)/test/*.test; do ./tclsqlite $$i; done


TARBALL = \
  sqlite/COPYRIGHT \
  sqlite/doc/*.html \
  sqlite/src/*.h \
  sqlite/src/*.c \
  sqlite/tool/*.c \
  sqlite/tool/*.awk \
  sqlite/configure \
  sqlite/*.in

sqlite.tar.gz:	
	pwd=`pwd`; cd $(TOP)/..; tar czf $$pwd/sqlite.tar.gz $(TARBALL)

all.tar.gz:	
	pwd=`pwd`; cd $(TOP)/..; tar czf $$pwd/all.tar.gz sqlite

index.html:	$(TOP)/www/index.tcl sqlite.tar.gz all.tar.gz
	tclsh $(TOP)/www/index.tcl >index.html

sqlite.html:	$(TOP)/www/sqlite.tcl
	tclsh $(TOP)/www/sqlite.tcl >sqlite.html

c_interface.html:	$(TOP)/www/c_interface.tcl
	tclsh $(TOP)/www/c_interface.tcl >c_interface.html

# Files to be published on the website.
#
PUBLISH = \
  sqlite.tar.gz \
  all.tar.gz \
  index.html \
  sqlite.html \
  c_interface.html

website:	$(PUBLISH)

publish:	$(PUBLISH)
	scp $(PUBLISH) hwaci@oak.he.net:public_html/sw/sqlite

clean:	
	rm -f *.o sqlite libsqlite.a sqlite.h
	rm -f lemon lempar.c parse.* sqlite.tar.gz
	rm -f $(PUBLISH)