1c5c4113dSnw141292# 2*dc20a302Sas200622# Copyright 2008 Sun Microsystems, Inc. All rights reserved. 3c5c4113dSnw141292# Use is subject to license terms. 4c5c4113dSnw141292# 5c5c4113dSnw141292#ident "%Z%%M% %I% %E% SMI" 6c5c4113dSnw141292# 7c5c4113dSnw141292 8c5c4113dSnw141292SQLITE_VERSION = 2.8.15-repcached 9c5c4113dSnw141292 10c5c4113dSnw141292LIBRARY = libsqlite.a 11c5c4113dSnw141292RELOC = $(LIBRARY:%.a=%.o) 12c5c4113dSnw141292 13c5c4113dSnw141292VERS = .1 14c5c4113dSnw141292OBJECTS = \ 15c5c4113dSnw141292 attach.o \ 16c5c4113dSnw141292 auth.o \ 17c5c4113dSnw141292 btree.o \ 18c5c4113dSnw141292 btree_rb.o \ 19c5c4113dSnw141292 build.o \ 20c5c4113dSnw141292 copy.o \ 21c5c4113dSnw141292 date.o \ 22c5c4113dSnw141292 delete.o \ 23c5c4113dSnw141292 encode.o \ 24c5c4113dSnw141292 expr.o \ 25c5c4113dSnw141292 func.o \ 26c5c4113dSnw141292 hash.o \ 27c5c4113dSnw141292 insert.o \ 28c5c4113dSnw141292 main.o \ 29c5c4113dSnw141292 opcodes.o \ 30c5c4113dSnw141292 os.o \ 31c5c4113dSnw141292 pager.o \ 32c5c4113dSnw141292 parse.o \ 33c5c4113dSnw141292 pragma.o \ 34c5c4113dSnw141292 printf.o \ 35c5c4113dSnw141292 random.o \ 36c5c4113dSnw141292 select.o \ 37c5c4113dSnw141292 table.o \ 38c5c4113dSnw141292 tokenize.o \ 39c5c4113dSnw141292 trigger.o \ 40c5c4113dSnw141292 update.o \ 41c5c4113dSnw141292 util.o \ 42c5c4113dSnw141292 vacuum.o \ 43c5c4113dSnw141292 vdbe.o \ 44c5c4113dSnw141292 vdbeaux.o \ 45c5c4113dSnw141292 where.o 46c5c4113dSnw141292 47c5c4113dSnw141292include $(SRC)/lib/Makefile.lib 48c5c4113dSnw141292 49c5c4113dSnw141292SRCDIR = ../src 50c5c4113dSnw141292TOOLDIR = ../tool 51*dc20a302Sas200622$(DYNLIB) := LDLIBS += -lc 52*dc20a302Sas200622LIBS = $(RELOC) $(LINTLIB) $(DYNLIB) 53c5c4113dSnw141292 54c5c4113dSnw141292$(LINTLIB) := SRCS = $(LINTSRC) 55c5c4113dSnw141292 56c5c4113dSnw141292SRCS = \ 57c5c4113dSnw141292 $(SRCDIR)/attach.c \ 58c5c4113dSnw141292 $(SRCDIR)/auth.c \ 59c5c4113dSnw141292 $(SRCDIR)/btree.c \ 60c5c4113dSnw141292 $(SRCDIR)/btree_rb.c \ 61c5c4113dSnw141292 $(SRCDIR)/build.c \ 62c5c4113dSnw141292 $(SRCDIR)/copy.c \ 63c5c4113dSnw141292 $(SRCDIR)/date.c \ 64c5c4113dSnw141292 $(SRCDIR)/delete.c \ 65c5c4113dSnw141292 $(SRCDIR)/encode.c \ 66c5c4113dSnw141292 $(SRCDIR)/expr.c \ 67c5c4113dSnw141292 $(SRCDIR)/func.c \ 68c5c4113dSnw141292 $(SRCDIR)/hash.c \ 69c5c4113dSnw141292 $(SRCDIR)/insert.c \ 70c5c4113dSnw141292 $(SRCDIR)/main.c \ 71c5c4113dSnw141292 opcodes.c \ 72c5c4113dSnw141292 $(SRCDIR)/os.c \ 73c5c4113dSnw141292 $(SRCDIR)/pager.c \ 74c5c4113dSnw141292 parse.c \ 75c5c4113dSnw141292 $(SRCDIR)/pragma.c \ 76c5c4113dSnw141292 $(SRCDIR)/printf.c \ 77c5c4113dSnw141292 $(SRCDIR)/random.c \ 78c5c4113dSnw141292 $(SRCDIR)/select.c \ 79c5c4113dSnw141292 $(SRCDIR)/table.c \ 80c5c4113dSnw141292 $(SRCDIR)/tokenize.c \ 81c5c4113dSnw141292 $(SRCDIR)/update.c \ 82c5c4113dSnw141292 $(SRCDIR)/util.c \ 83c5c4113dSnw141292 $(SRCDIR)/vacuum.c \ 84c5c4113dSnw141292 $(SRCDIR)/vdbe.c \ 85c5c4113dSnw141292 $(SRCDIR)/vdbeaux.c \ 86c5c4113dSnw141292 $(SRCDIR)/where.c \ 87c5c4113dSnw141292 $(SRCDIR)/trigger.c 88c5c4113dSnw141292 89c5c4113dSnw141292MYCPPFLAGS = -D_REENTRANT -DTHREADSAFE=1 -DHAVE_USLEEP=1 -I. -I.. -I$(SRCDIR) 90c5c4113dSnw141292CPPFLAGS += $(MYCPPFLAGS) 91c5c4113dSnw141292 92*dc20a302Sas200622MAPFILES = ../mapfile-sqlite 93c5c4113dSnw141292 94c5c4113dSnw141292# Header files used by all library source files. 95c5c4113dSnw141292# 96c5c4113dSnw141292HDR = \ 97c5c4113dSnw141292 $(SRCDIR)/btree.h \ 98c5c4113dSnw141292 $(SRCDIR)/config.h \ 99c5c4113dSnw141292 $(SRCDIR)/hash.h \ 100c5c4113dSnw141292 opcodes.h \ 101c5c4113dSnw141292 $(SRCDIR)/os.h \ 102c5c4113dSnw141292 parse.h \ 103c5c4113dSnw141292 ../sqlite.h \ 104c5c4113dSnw141292 $(SRCDIR)/sqliteInt.h \ 105c5c4113dSnw141292 $(SRCDIR)/vdbe.h \ 106c5c4113dSnw141292 $(SRCDIR)/vdbeInt.h 107c5c4113dSnw141292 108c5c4113dSnw141292# 109c5c4113dSnw141292# Sources used for test harness 110c5c4113dSnw141292# 111c5c4113dSnw141292TESTSRC = \ 112c5c4113dSnw141292 $(SRCDIR)/tclsqlite.c \ 113c5c4113dSnw141292 $(SRCDIR)/btree.c \ 114c5c4113dSnw141292 $(SRCDIR)/func.c \ 115c5c4113dSnw141292 $(SRCDIR)/os.c \ 116c5c4113dSnw141292 $(SRCDIR)/pager.c \ 117c5c4113dSnw141292 $(SRCDIR)/test1.c \ 118c5c4113dSnw141292 $(SRCDIR)/test2.c \ 119c5c4113dSnw141292 $(SRCDIR)/test3.c \ 120c5c4113dSnw141292 $(SRCDIR)/md5.c 121c5c4113dSnw141292 122c5c4113dSnw141292TESTOBJS = $(TESTSRC:$(SRCDIR)/%.c=%.o) 123c5c4113dSnw141292 124c5c4113dSnw141292TESTCLEAN = $(TESTOBJS) test.db test.tcl test1.bt test2.db testdb 125c5c4113dSnw141292 126c5c4113dSnw141292# 127c5c4113dSnw141292# Native variants 128c5c4113dSnw141292# 129c5c4113dSnw141292NATIVERELOC = $(RELOC:%.o=%-native.o) 130c5c4113dSnw141292NATIVEPROGS = lemon-build testfixture 131c5c4113dSnw141292NATIVEOBJS = lemon.o $(OBJS:%.o=%-native.o) 132c5c4113dSnw141292 133c5c4113dSnw141292NATIVETARGETS = $(NATIVEPROGS) $(NATIVEOBJS) $(NATIVERELOC) 134c5c4113dSnw141292 135c5c4113dSnw141292$(NATIVETARGETS) := CC = $(NATIVECC) 136c5c4113dSnw141292$(NATIVETARGETS) := LD = $(NATIVELD) 137c5c4113dSnw141292$(NATIVETARGETS) := CFLAGS = $(NATIVE_CFLAGS) 138c5c4113dSnw141292$(NATIVETARGETS) := CPPFLAGS = $(MYCPPFLAGS) 139c5c4113dSnw141292$(NATIVETARGETS) := LDFLAGS = 140c5c4113dSnw141292$(NATIVETARGETS) := LDLIBS = -lc 141c5c4113dSnw141292 142c5c4113dSnw141292$(OBJS) := CFLAGS += $(CTF_FLAGS) 143c5c4113dSnw141292$(OBJS) := CTFCONVERT_POST = $(CTFCONVERT_O) 144c5c4113dSnw141292 145c5c4113dSnw141292TCLBASE = /usr/sfw 146c5c4113dSnw141292TCLVERS = tcl8.3 147c5c4113dSnw141292 148c5c4113dSnw141292testfixture := MYCPPFLAGS += -I$(TCLBASE)/include -DTCLSH -DSQLITE_TEST=1 149c5c4113dSnw141292# 150c5c4113dSnw141292# work around compiler issues 151c5c4113dSnw141292# 152c5c4113dSnw141292testfixture := CFLAGS += \ 153c5c4113dSnw141292 -erroff=E_ARRAY_OF_INCOMPLETE \ 154c5c4113dSnw141292 -erroff=E_ARG_INCOMPATIBLE_WITH_ARG 155c5c4113dSnw141292 156c5c4113dSnw141292testfixture := LDLIBS += -R$(TCLBASE)/lib -L$(TCLBASE)/lib -l$(TCLVERS) -lm -ldl 157c5c4113dSnw141292 158c5c4113dSnw141292CLEANFILES += \ 159c5c4113dSnw141292 $(RELOC) \ 160c5c4113dSnw141292 $(LINTLIB) \ 161c5c4113dSnw141292 $(NATIVETARGETS) \ 162c5c4113dSnw141292 $(TESTCLEAN) \ 163c5c4113dSnw141292 lemon \ 164c5c4113dSnw141292 lemon.o \ 165c5c4113dSnw141292 lempar.c \ 166c5c4113dSnw141292 opcodes.c \ 167c5c4113dSnw141292 opcodes.h \ 168c5c4113dSnw141292 parse_tmp.c \ 169c5c4113dSnw141292 parse_tmp.h \ 170c5c4113dSnw141292 parse_tmp.out \ 171c5c4113dSnw141292 parse_tmp.y \ 172c5c4113dSnw141292 parse.c \ 173c5c4113dSnw141292 parse.h 174c5c4113dSnw141292 175c5c4113dSnw141292ENCODING = ISO8859 176c5c4113dSnw141292 177c5c4113dSnw141292LINTSRC= ../llib-lsqlite 178c5c4113dSnw141292 179c5c4113dSnw141292 180c5c4113dSnw141292.PARALLEL: $(OBJS) $(OBJS:%.o=%-native.o) 181c5c4113dSnw141292.KEEP_STATE: 182c5c4113dSnw141292 183c5c4113dSnw141292# This is the default Makefile target. The objects listed here 184c5c4113dSnw141292# are what get build when you type just "make" with no arguments. 185c5c4113dSnw141292# 186c5c4113dSnw141292all: $(LIBS) 187c5c4113dSnw141292install: all $(ROOTLIBDIR)/$(RELOC) $(ROOTLIBDIR)/$(NATIVERELOC) \ 188c5c4113dSnw141292 $(ROOTLIBDIR)/llib-lsqlite.ln 189c5c4113dSnw141292 190c5c4113dSnw141292$(ROOTLIBDIR)/$(RELOC) := FILEMODE= 644 191c5c4113dSnw141292$(ROOTLIBDIR)/$(NATIVERELOC) := FILEMODE= 644 192c5c4113dSnw141292$(ROOTLIBDIR)/llib-lsqlite.ln := FILEMODE= 644 193c5c4113dSnw141292 194c5c4113dSnw141292$(ROOTLIBDIR)/%: % 195c5c4113dSnw141292 $(INS.file) 196c5c4113dSnw141292 197c5c4113dSnw141292$(OBJS) $(OBJS:%.o=%-native.o): $(HDR) 198c5c4113dSnw141292 199c5c4113dSnw141292native: $(NATIVERELOC) 200c5c4113dSnw141292 201c5c4113dSnw141292$(RELOC): objs .WAIT $(OBJS) 202*dc20a302Sas200622 $(LD) -r $(MAPFILES:%=-M%) -o $(RELOC) $(OBJS) 203c5c4113dSnw141292 $(CTFMERGE) -t -f -L VERSION -o $(RELOC) $(OBJS) 204c5c4113dSnw141292 205c5c4113dSnw141292$(NATIVERELOC): objs .WAIT $(OBJS:%.o=%-native.o) 206*dc20a302Sas200622 $(LD) -r $(MAPFILES:%=-M%) -o $(NATIVERELOC) $(OBJS:%.o=%-native.o) 207c5c4113dSnw141292 208c5c4113dSnw141292opcodes.h: $(SRCDIR)/vdbe.c 209c5c4113dSnw141292 @echo "Generating $@"; \ 210c5c4113dSnw141292 $(RM) -f $@ ; \ 211c5c4113dSnw141292 echo '/* Automatically generated file. Do not edit */' > $@ ; \ 212c5c4113dSnw141292 grep '^case OP_' $(SRCDIR)/vdbe.c | \ 213c5c4113dSnw141292 sed -e 's/://' | \ 214c5c4113dSnw141292 awk '{printf "#define %-30s %3d\n", $$2, ++cnt}' >> $@ 215c5c4113dSnw141292 216c5c4113dSnw141292opcodes.c: $(SRCDIR)/vdbe.c 217c5c4113dSnw141292 @echo "Generating $@"; \ 218c5c4113dSnw141292 $(RM) -f $@ ; \ 219c5c4113dSnw141292 echo '/* Automatically generated file. Do not edit */' > $@ ; \ 220c5c4113dSnw141292 echo 'char *sqliteOpcodeNames[] = { "???", ' >> $@ ; \ 221c5c4113dSnw141292 grep '^case OP_' $(SRCDIR)/vdbe.c | \ 222c5c4113dSnw141292 sed -e 's/^.*OP_/ "/' -e 's/:.*$$/", /' >> $@ ; \ 223c5c4113dSnw141292 echo '};' >> $@ 224c5c4113dSnw141292 225c5c4113dSnw141292# 226c5c4113dSnw141292# We use a recursive invocation because otherwise pmake always rebuilds 227c5c4113dSnw141292# everything, due to multiple expansions of "foo := A += B". 228c5c4113dSnw141292# 229c5c4113dSnw141292lemon: FRC 230c5c4113dSnw141292 $(MAKE) lemon-build 231c5c4113dSnw141292 232c5c4113dSnw141292lemon-build: lemon.o $(TOOLDIR)/lempar.c 233c5c4113dSnw141292 $(LINK.c) -o lemon lemon.o 234c5c4113dSnw141292 $(RM) lempar.c 235c5c4113dSnw141292 $(LN) -s $(TOOLDIR)/lempar.c lempar.c 236c5c4113dSnw141292 $(RM) lemon-build 237c5c4113dSnw141292 $(CP) lemon lemon-build 238c5c4113dSnw141292 239c5c4113dSnw141292testfixture: FRC 240c5c4113dSnw141292 @if [ -f $(TCLBASE)/include/tcl.h ]; then \ 241c5c4113dSnw141292 unset SUNPRO_DEPENDENCIES; \ 242c5c4113dSnw141292 echo $(LINK.c) -o testfixture $(TESTSRC) $(LIBRARY) $(LDLIBS) ;\ 243c5c4113dSnw141292 exec $(LINK.c) -o testfixture $(TESTSRC) $(LIBRARY) $(LDLIBS) ;\ 244c5c4113dSnw141292 else \ 245c5c4113dSnw141292 echo "$(TCLBASE)/include/tcl.h: not found."; \ 246c5c4113dSnw141292 exit 1; \ 247c5c4113dSnw141292 fi 248c5c4113dSnw141292 249c5c4113dSnw141292parse_tmp.out: $(SRCDIR)/parse.y lemon 250c5c4113dSnw141292 $(RM) parse_tmp.y 251c5c4113dSnw141292 $(CP) $(SRCDIR)/parse.y parse_tmp.y 252c5c4113dSnw141292 ./lemon parse_tmp.y 253c5c4113dSnw141292 254c5c4113dSnw141292parse.h: parse_tmp.out 255c5c4113dSnw141292 $(CP) parse_tmp.h parse.h 256c5c4113dSnw141292 257c5c4113dSnw141292parse.c: parse_tmp.out 258c5c4113dSnw141292 $(CP) parse_tmp.c parse.c 259c5c4113dSnw141292 260c5c4113dSnw141292objs/%-native.o: $(SRCDIR)/%.c 261c5c4113dSnw141292 $(COMPILE.c) -o $@ $< 262c5c4113dSnw141292 $(POST_PROCESS_O) 263c5c4113dSnw141292 264c5c4113dSnw141292objs/%-native.o: %.c 265c5c4113dSnw141292 $(COMPILE.c) -o $@ $< 266c5c4113dSnw141292 $(POST_PROCESS_O) 267c5c4113dSnw141292 268c5c4113dSnw141292objs/parse-native.o: parse.c 269c5c4113dSnw141292 $(COMPILE.c) -o $@ parse.c 270c5c4113dSnw141292 $(POST_PROCESS_O) 271c5c4113dSnw141292 272c5c4113dSnw141292objs/%.o: %.c 273c5c4113dSnw141292 $(COMPILE.c) -o $@ $< 274c5c4113dSnw141292 $(POST_PROCESS_O) 275c5c4113dSnw141292 276c5c4113dSnw141292%.o: $(SRCDIR)/%.c 277c5c4113dSnw141292 $(COMPILE.c) -o $@ $< 278c5c4113dSnw141292 $(POST_PROCESS_O) 279c5c4113dSnw141292 280c5c4113dSnw141292%.o: $(TOOLDIR)/%.c 281c5c4113dSnw141292 $(COMPILE.c) -o $@ $< 282c5c4113dSnw141292 $(POST_PROCESS_O) 283c5c4113dSnw141292 284c5c4113dSnw141292include $(SRC)/lib/Makefile.targ 285c5c4113dSnw141292 286c5c4113dSnw141292FRC: 287