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