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