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