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