xref: /titanic_51/usr/src/lib/libsqlite/Makefile.com (revision 7b07063d906859b2be1e88791f801b3c96e432f6)
1c5c4113dSnw141292#
2dc20a302Sas200622# Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
3c5c4113dSnw141292# Use is subject to license terms.
4*7b07063dSIgor Kozhukhov# Copyright 2015 Igor Kozhukhov <ikozhukhov@gmail.com>
5c5c4113dSnw141292#
6c5c4113dSnw141292
791d7f85eSGordon Ross# Make the SO name unlikely to conflict with any other
891d7f85eSGordon Ross# libsqlite that might also be found on the system.
991d7f85eSGordon RossLIBRARY = libsqlite-sys.a
10c5c4113dSnw141292
1191d7f85eSGordon RossVERS = .2.8.15
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
4791d7f85eSGordon Ross# install this library in the root filesystem
4891d7f85eSGordon Rossinclude $(SRC)/lib/Makefile.rootfs
498f954993Samw
50c5c4113dSnw141292SRCDIR = ../src
51c5c4113dSnw141292TOOLDIR = ../tool
52dc20a302Sas200622$(DYNLIB) := LDLIBS += -lc
5391d7f85eSGordon RossLIBS = $(DYNLIB) $(LINTLIB) $(NATIVERELOC)
54c5c4113dSnw141292
5591d7f85eSGordon Ross$(LINTLIB) :=	SRCS = ../$(LINTSRC)
56c5c4113dSnw141292
5791d7f85eSGordon Ross# generated sources
5891d7f85eSGordon RossGENSRC = opcodes.c parse.c
5991d7f85eSGordon Ross
6091d7f85eSGordon Ross# all sources
61c5c4113dSnw141292SRCS = \
6291d7f85eSGordon Ross	$(GENSRC) \
63c5c4113dSnw141292	$(SRCDIR)/attach.c	\
64c5c4113dSnw141292	$(SRCDIR)/auth.c	\
65c5c4113dSnw141292	$(SRCDIR)/btree.c	\
66c5c4113dSnw141292	$(SRCDIR)/btree_rb.c	\
67c5c4113dSnw141292	$(SRCDIR)/build.c	\
68c5c4113dSnw141292	$(SRCDIR)/copy.c	\
69c5c4113dSnw141292	$(SRCDIR)/date.c	\
70c5c4113dSnw141292	$(SRCDIR)/delete.c	\
71c5c4113dSnw141292	$(SRCDIR)/encode.c	\
72c5c4113dSnw141292	$(SRCDIR)/expr.c	\
73c5c4113dSnw141292	$(SRCDIR)/func.c	\
74c5c4113dSnw141292	$(SRCDIR)/hash.c	\
75c5c4113dSnw141292	$(SRCDIR)/insert.c	\
76c5c4113dSnw141292	$(SRCDIR)/main.c	\
77c5c4113dSnw141292	$(SRCDIR)/os.c		\
78c5c4113dSnw141292	$(SRCDIR)/pager.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
967014882cSRichard LoweCERRWARN += -_gcc=-Wno-implicit-function-declaration
977014882cSRichard LoweCERRWARN += -_gcc=-Wno-uninitialized
987014882cSRichard LoweCERRWARN += -_gcc=-Wno-unused-function
997014882cSRichard LoweCERRWARN += -_gcc=-Wno-unused-label
1007014882cSRichard Lowe
101dc20a302Sas200622MAPFILES = ../mapfile-sqlite
102c5c4113dSnw141292
10391d7f85eSGordon Ross# headers generated here
10491d7f85eSGordon RossGENHDR = opcodes.h parse.h
10591d7f85eSGordon Ross
106c5c4113dSnw141292# Header files used by all library source files.
107c5c4113dSnw141292#
108c5c4113dSnw141292HDR = \
10991d7f85eSGordon Ross	$(GENHDR) \
110c5c4113dSnw141292	$(SRCDIR)/btree.h	\
111c5c4113dSnw141292	$(SRCDIR)/config.h	\
112c5c4113dSnw141292	$(SRCDIR)/hash.h	\
113c5c4113dSnw141292	$(SRCDIR)/os.h		\
114c5c4113dSnw141292	../sqlite.h		\
115c5c4113dSnw141292	$(SRCDIR)/sqliteInt.h	\
116c5c4113dSnw141292	$(SRCDIR)/vdbe.h	\
117c5c4113dSnw141292	$(SRCDIR)/vdbeInt.h
118c5c4113dSnw141292
119c5c4113dSnw141292#
120c5c4113dSnw141292# Sources used for test harness
121c5c4113dSnw141292#
122c5c4113dSnw141292TESTSRC = \
123c5c4113dSnw141292	$(SRCDIR)/tclsqlite.c	\
124c5c4113dSnw141292	$(SRCDIR)/btree.c	\
125c5c4113dSnw141292	$(SRCDIR)/func.c	\
126c5c4113dSnw141292	$(SRCDIR)/os.c		\
127c5c4113dSnw141292	$(SRCDIR)/pager.c	\
128c5c4113dSnw141292	$(SRCDIR)/test1.c	\
129c5c4113dSnw141292	$(SRCDIR)/test2.c	\
130c5c4113dSnw141292	$(SRCDIR)/test3.c	\
131c5c4113dSnw141292	$(SRCDIR)/md5.c
132c5c4113dSnw141292
133c5c4113dSnw141292TESTOBJS = $(TESTSRC:$(SRCDIR)/%.c=%.o)
134c5c4113dSnw141292
135c5c4113dSnw141292TESTCLEAN = $(TESTOBJS) test.db test.tcl test1.bt test2.db testdb
136c5c4113dSnw141292
137c5c4113dSnw141292#
13891d7f85eSGordon Ross# Native variant (needed by cmd/configd)
139c5c4113dSnw141292#
14091d7f85eSGordon RossNATIVERELOC = libsqlite-native.o
14191d7f85eSGordon RossNATIVEPROGS = testfixture
14291d7f85eSGordon RossNATIVEOBJS = $(OBJS:%.o=%-native.o)
143c5c4113dSnw141292
144c5c4113dSnw141292NATIVETARGETS = $(NATIVEPROGS) $(NATIVEOBJS) $(NATIVERELOC)
145c5c4113dSnw141292
146c5c4113dSnw141292$(NATIVETARGETS) :=	CC = $(NATIVECC)
147c5c4113dSnw141292$(NATIVETARGETS) :=	LD = $(NATIVELD)
148c5c4113dSnw141292$(NATIVETARGETS) :=	CFLAGS = $(NATIVE_CFLAGS)
149c5c4113dSnw141292$(NATIVETARGETS) :=	CPPFLAGS = $(MYCPPFLAGS)
150c5c4113dSnw141292$(NATIVETARGETS) :=	LDFLAGS =
151c5c4113dSnw141292$(NATIVETARGETS) :=	LDLIBS = -lc
152c5c4113dSnw141292
153c5c4113dSnw141292$(OBJS) :=		CFLAGS += $(CTF_FLAGS)
154c5c4113dSnw141292$(OBJS) :=		CTFCONVERT_POST = $(CTFCONVERT_O)
155c5c4113dSnw141292
156c5c4113dSnw141292TCLBASE = /usr/sfw
157c5c4113dSnw141292TCLVERS = tcl8.3
158c5c4113dSnw141292
159c5c4113dSnw141292testfixture := MYCPPFLAGS += -I$(TCLBASE)/include -DTCLSH -DSQLITE_TEST=1
160c5c4113dSnw141292#
161c5c4113dSnw141292# work around compiler issues
162c5c4113dSnw141292#
163c5c4113dSnw141292testfixture := CFLAGS += \
164c5c4113dSnw141292	-erroff=E_ARRAY_OF_INCOMPLETE \
165c5c4113dSnw141292	-erroff=E_ARG_INCOMPATIBLE_WITH_ARG
166c5c4113dSnw141292
167c5c4113dSnw141292testfixture := LDLIBS += -R$(TCLBASE)/lib -L$(TCLBASE)/lib -l$(TCLVERS) -lm -ldl
168c5c4113dSnw141292
169c5c4113dSnw141292CLEANFILES += \
170c5c4113dSnw141292	$(NATIVETARGETS) \
171c5c4113dSnw141292	$(TESTCLEAN)	\
172c5c4113dSnw141292	lemon		\
173c5c4113dSnw141292	lemon.o		\
174c5c4113dSnw141292	lempar.c	\
175c5c4113dSnw141292	opcodes.c	\
176c5c4113dSnw141292	opcodes.h	\
177c5c4113dSnw141292	parse_tmp.c	\
178c5c4113dSnw141292	parse_tmp.h	\
179c5c4113dSnw141292	parse_tmp.out	\
180c5c4113dSnw141292	parse_tmp.y	\
181c5c4113dSnw141292	parse.c		\
182c5c4113dSnw141292	parse.h
183c5c4113dSnw141292
184c5c4113dSnw141292ENCODING  = ISO8859
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)
19491d7f85eSGordon Rossinstall:	all \
19591d7f85eSGordon Ross		$(ROOTLIBDIR)/$(DYNLIB) \
19691d7f85eSGordon Ross		$(ROOTLIBDIR)/$(LINTLIB) \
19791d7f85eSGordon Ross		$(ROOTLIBDIR)/$(NATIVERELOC)
198c5c4113dSnw141292
19991d7f85eSGordon Rosslint:
20091d7f85eSGordon Ross
20191d7f85eSGordon Rossall_h: $(GENHDR)
20291d7f85eSGordon Ross
203c5c4113dSnw141292$(ROOTLIBDIR)/$(NATIVERELOC)	:= FILEMODE= 644
20491d7f85eSGordon Ross$(ROOTLINTDIR)/$(LINTLIB)	:= FILEMODE= 644
205c5c4113dSnw141292
20691d7f85eSGordon Ross$(ROOTLINK): $(ROOTLIBDIR) $(ROOTLIBDIR)/$(DYNLIB)
2078f954993Samw	$(INS.liblink)
2088f954993Samw
20991d7f85eSGordon Ross$(ROOTLINTDIR)/%: ../%
21091d7f85eSGordon Ross	$(INS.file)
211c5c4113dSnw141292
212c5c4113dSnw141292native: $(NATIVERELOC)
213c5c4113dSnw141292
214c5c4113dSnw141292$(NATIVERELOC):	objs .WAIT $(OBJS:%.o=%-native.o)
21591d7f85eSGordon Ross	$(LD) -r -o $(NATIVERELOC) $(OBJS:%.o=%-native.o)
216c5c4113dSnw141292
217c5c4113dSnw141292opcodes.h: $(SRCDIR)/vdbe.c
218c5c4113dSnw141292	@echo "Generating $@"; \
219c5c4113dSnw141292	 $(RM) -f $@ ; \
220c5c4113dSnw141292	 echo '/* Automatically generated file.  Do not edit */' > $@ ; \
221c5c4113dSnw141292	 grep '^case OP_' $(SRCDIR)/vdbe.c | \
222c5c4113dSnw141292	    sed -e 's/://' | \
223*7b07063dSIgor Kozhukhov	    $(AWK) '{printf "#define %-30s %3d\n", $$2, ++cnt}' >> $@
224c5c4113dSnw141292
225c5c4113dSnw141292opcodes.c: $(SRCDIR)/vdbe.c
226c5c4113dSnw141292	@echo "Generating $@"; \
227c5c4113dSnw141292	 $(RM) -f $@ ; \
228c5c4113dSnw141292	 echo '/* Automatically generated file.  Do not edit */' > $@ ; \
229c5c4113dSnw141292	 echo 'char *sqliteOpcodeNames[] = { "???", ' >> $@ ; \
230c5c4113dSnw141292	 grep '^case OP_' $(SRCDIR)/vdbe.c | \
231c5c4113dSnw141292	    sed -e 's/^.*OP_/  "/' -e 's/:.*$$/", /' >> $@ ; \
232c5c4113dSnw141292	 echo '};' >> $@
233c5c4113dSnw141292
234c5c4113dSnw141292testfixture: FRC
235c5c4113dSnw141292	@if [ -f $(TCLBASE)/include/tcl.h ]; then \
236c5c4113dSnw141292		unset SUNPRO_DEPENDENCIES; \
237c5c4113dSnw141292		echo $(LINK.c) -o testfixture $(TESTSRC) $(LIBRARY) $(LDLIBS) ;\
238c5c4113dSnw141292		exec $(LINK.c) -o testfixture $(TESTSRC) $(LIBRARY) $(LDLIBS) ;\
239c5c4113dSnw141292	else \
240c5c4113dSnw141292		echo "$(TCLBASE)/include/tcl.h: not found."; \
241c5c4113dSnw141292		exit 1; \
242c5c4113dSnw141292	fi
243c5c4113dSnw141292
24491d7f85eSGordon Rossparse.h parse.c : $(SRCDIR)/parse.y $(TOOLDIR)/lemon.c $(TOOLDIR)/lempar.c
24591d7f85eSGordon Ross	-$(RM) parse_tmp.y lempar.c
246c5c4113dSnw141292	$(CP) $(SRCDIR)/parse.y parse_tmp.y
24791d7f85eSGordon Ross	$(CP) $(TOOLDIR)/lempar.c lempar.c
24891d7f85eSGordon Ross	$(NATIVECC) -o lemon $(TOOLDIR)/lemon.c
249c5c4113dSnw141292	./lemon parse_tmp.y
25091d7f85eSGordon Ross	-$(RM) parse.c parse.h
251c5c4113dSnw141292	$(CP) parse_tmp.h parse.h
252c5c4113dSnw141292	$(CP) parse_tmp.c parse.c
253c5c4113dSnw141292
25491d7f85eSGordon Rossobjs/%-native.o: $(SRCDIR)/%.c $(GENHDR)
255c5c4113dSnw141292	$(COMPILE.c) -o $@ $<
256c5c4113dSnw141292	$(POST_PROCESS_O)
257c5c4113dSnw141292
25891d7f85eSGordon Rossobjs/%-native.o: %.c $(GENHDR)
259c5c4113dSnw141292	$(COMPILE.c) -o $@ $<
260c5c4113dSnw141292	$(POST_PROCESS_O)
261c5c4113dSnw141292
26291d7f85eSGordon Rossobjs/parse-native.o: parse.c $(GENHDR)
263c5c4113dSnw141292	$(COMPILE.c) -o $@ parse.c
264c5c4113dSnw141292	$(POST_PROCESS_O)
265c5c4113dSnw141292
26691d7f85eSGordon Rossobjs/%.o pics/%.o: $(SRCDIR)/%.c $(GENHDR)
267c5c4113dSnw141292	$(COMPILE.c) -o $@ $<
268c5c4113dSnw141292	$(POST_PROCESS_O)
269c5c4113dSnw141292
27091d7f85eSGordon Rossobjs/%.o pics/%.o: %.c $(GENHDR)
271c5c4113dSnw141292	$(COMPILE.c) -o $@ $<
272c5c4113dSnw141292	$(POST_PROCESS_O)
273c5c4113dSnw141292
27491d7f85eSGordon Ross# need direct rules for generated files
27591d7f85eSGordon Rossobjs/opcodes.o pics/opcodes.o: opcodes.c $(GENHDR)
27691d7f85eSGordon Ross	$(COMPILE.c) -o $@ opcodes.c
27791d7f85eSGordon Ross	$(POST_PROCESS_O)
27891d7f85eSGordon Ross
27991d7f85eSGordon Rossobjs/parse.o pics/parse.o: parse.c $(GENHDR)
28091d7f85eSGordon Ross	$(COMPILE.c) -o $@ parse.c
281c5c4113dSnw141292	$(POST_PROCESS_O)
282c5c4113dSnw141292
283c5c4113dSnw141292include $(SRC)/lib/Makefile.targ
284c5c4113dSnw141292
285c5c4113dSnw141292FRC:
286