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