summaryrefslogtreecommitdiff
path: root/lib/libsqlite3/Makefile
blob: 3b01e1659ea6f8f0176e4d5b1adfe1ef7ea33943 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
# $OpenBSD: Makefile,v 1.7 2012/06/04 09:21:22 espie Exp $

.include <bsd.own.mk>

.if defined(NOPIC)
CPPFLAGS +=	-DSQLITE_OMIT_LOAD_EXTENSION=1
.endif

CPPFLAGS +=	-I${.OBJDIR} -I${.CURDIR}/tsrc -I${.CURDIR}/src \
		-I${.CURDIR}/ext/rtree -I${.CURDIR}/ext/fts3
LIB = sqlite3

.PATH: ${.CURDIR}/tsrc ${.CURDIR}/src ${.CURDIR}/ext/fts3 ${.CURDIR}/ext/rtree

SRCS =	alter.c analyze.c attach.c auth.c \
        backup.c bitvec.c btmutex.c btree.c build.c \
        callback.c complete.c ctime.c date.c delete.c \
        expr.c fault.c fkey.c \
        fts3.c fts3_aux.c fts3_expr.c fts3_hash.c fts3_icu.c fts3_porter.c \
        fts3_snippet.c fts3_tokenizer.c fts3_tokenizer1.c fts3_write.c \
        func.c global.c hash.c \
        insert.c journal.c legacy.c loadext.c \
        main.c malloc.c mem1.c \
        memjournal.c \
        mutex.c mutex_noop.c mutex_unix.c \
        notify.c opcodes.c os.c os_unix.c \
        pager.c parse.c pcache.c pcache1.c pragma.c prepare.c printf.c \
        random.c resolve.c rowset.c rtree.c select.c status.c \
        table.c tokenize.c trigger.c \
        update.c util.c vacuum.c \
        vdbe.c vdbeapi.c vdbeaux.c vdbeblob.c vdbemem.c vdbesort.c \
        vdbetrace.c wal.c walker.c where.c utf.c vtab.c

# so that it works with NO THREADS
SRCS +=	pthread_stub.c

#	mem3.c mem5.c

FEATURE_FLAGS =	-DSQLITE_ENABLE_COLUMN_METADATA \
		-DSQLITE_ENABLE_RTREE \
		-DSQLITE_ENABLE_UNLOCK_NOTIFY \
		-DSQLITE_ENABLE_FTS3

CPPFLAGS += 	$(FEATURE_FLAGS) -DSQLITE_THREADSAFE=1 \
		-DHAVE_STDINT_H=1 -DHAVE_INTTYPES_H=1 \
		-DHAVE_GMTIME_R=1 \
		-DHAVE_LOCALTIME_R=1 \
		-DHAVE_USLEEP=1 \
		-DHAVE_STRERROR_R=1 \
		-DSQLITE_TEMP_STORE=1 \
		-DSQLITE_SOUNDEX=1 \
		-DSQLITE_HAVE_ISNAN=1 \
		-DSQLITE_OS_UNIX=1 \
		-DSQLITE_CORE \
		-DHAVE_UINT32_T=1 -DHAVE_UINT16_T=1 -DHAVE_INT16_T=1 \
		-DHAVE_UINT8_T=1 -DHAVE_INT8_T=1

FILES = sqlite3.h sqlite3ext.h

opcodes.c: opcodes.h ${.CURDIR}/mkopcodec.awk
	sort -n -b -k 3 opcodes.h | awk -f ${.CURDIR}/mkopcodec.awk >opcodes.c


opcodes.h: parse.h ${.CURDIR}/src/vdbe.c \
    ${.CURDIR}/mkopcodeh.awk
	cat parse.h ${.CURDIR}/src/vdbe.c | \
	    awk -f ${.CURDIR}/mkopcodeh.awk >$@

beforedepend: opcodes.h keywordhash.h

keywordhash.h: mkkeywordhash
	${.OBJDIR}/mkkeywordhash >$@

mkkeywordhash: tool/mkkeywordhash.c
	${HOSTCC} ${LDSTATIC} -o $@ $< ${LDADD}

lemon: tool/lemon.c
	${HOSTCC} ${LDSTATIC} -o $@ $< ${LDADD}

parse.c: parse.y lemon
	ln -sf ${.CURDIR}/src/parse.y
	ln -sf ${.CURDIR}/src/lempar.c # XXX tweaked parser
	${.OBJDIR}/lemon ${FEATURE_FLAGS} parse.y
	mv parse.h parse.h.temp
	awk -f ${.CURDIR}/addopcodes.awk parse.h.temp >parse.h
	rm parse.h.temp

parse.h: parse.c

tokenize.o tokenize.po tokenize.so: keywordhash.h

CLEANFILES += mkkeywordhash opcodes.c opcodes.h keywordhash.h \
	parse.* lemon lempar.c
	
beforeinstall:
	${INSTALL} ${INSTALL_COPY} -o root -g ${SHAREGRP} \
	    -m ${SHAREMODE} ${.CURDIR}/sqlite3.pc ${DESTDIR}/usr/lib/pkgconfig/

includes:
	@for i in ${FILES}; do \
	    cmp -s ${.CURDIR}/src/$$i ${DESTDIR}/usr/include/$$i || \
		${INSTALL} ${INSTALL_COPY} -m 444 ${.CURDIR}/src/$$i ${DESTDIR}/usr/include/$$i; \
	done

.PHONY: header
header:
	cd ${.CURDIR} && perl tsrc/header_regen VERSION src/sqlite.h.in src/sqlite3.h

.include <bsd.lib.mk>

${OBJS} ${GOBJS} ${POBJS} ${SOBJS}: opcodes.h parse.h