2012-09-03 23:46:12 +00:00
|
|
|
include config.mk
|
2012-09-17 09:18:20 +00:00
|
|
|
VALADIR=bindings/vala
|
2012-09-03 23:46:12 +00:00
|
|
|
|
|
|
|
PWD=$(shell pwd)
|
2015-10-27 03:29:30 +00:00
|
|
|
PFX=${DESTDIR}${PREFIX}
|
2013-08-26 01:17:29 +00:00
|
|
|
HGFILES=`find sdb-${SDBVER} -type f | grep -v hg | grep -v swp`
|
2014-03-06 01:31:31 +00:00
|
|
|
MKDIR=mkdir
|
2012-09-03 23:46:12 +00:00
|
|
|
|
2015-07-13 13:22:37 +00:00
|
|
|
all: pkgconfig src/sdb_version.h
|
2013-04-01 03:52:21 +00:00
|
|
|
${MAKE} -C src
|
2015-05-24 21:30:13 +00:00
|
|
|
ifeq ($(BUILD_MEMCACHE),1)
|
2013-04-01 03:52:21 +00:00
|
|
|
${MAKE} -C memcache
|
2015-05-25 22:59:39 +00:00
|
|
|
endif
|
2016-10-20 19:12:52 +00:00
|
|
|
|
|
|
|
vala:
|
2012-09-03 23:46:12 +00:00
|
|
|
ifneq (${HAVE_VALA},)
|
2012-09-17 09:18:20 +00:00
|
|
|
cd ${VALADIR} && ${MAKE}
|
|
|
|
cd ${VALADIR}/types && ${MAKE}
|
2016-10-20 19:12:52 +00:00
|
|
|
else
|
|
|
|
@echo Nothing to do.
|
2012-09-03 23:46:12 +00:00
|
|
|
endif
|
|
|
|
|
2014-11-14 14:49:34 +00:00
|
|
|
.PHONY: test sdb.js pkgconfig
|
2014-01-14 01:57:21 +00:00
|
|
|
test:
|
|
|
|
${MAKE} -C test
|
|
|
|
|
2014-12-12 00:38:27 +00:00
|
|
|
asan:
|
2015-07-13 13:22:37 +00:00
|
|
|
${MAKE} src/sdb_version.h
|
2016-10-20 19:12:52 +00:00
|
|
|
${MAKE} -C src CC="gcc -fsanitize=address" all
|
2014-12-12 00:38:27 +00:00
|
|
|
|
2014-11-14 14:49:34 +00:00
|
|
|
pkgconfig:
|
2014-11-19 21:50:54 +00:00
|
|
|
[ -d pkgconfig ] && ${MAKE} -C pkgconfig || true
|
2014-11-14 14:49:34 +00:00
|
|
|
|
2015-07-13 13:22:37 +00:00
|
|
|
src/sdb_version.h:
|
|
|
|
echo '#define SDB_VERSION "${SDBVER}"' > src/sdb_version.h
|
2012-09-03 23:46:12 +00:00
|
|
|
|
2014-07-02 22:01:46 +00:00
|
|
|
CFILES=cdb.c buffer.c cdb_make.c ls.c ht.c sdb.c num.c base64.c
|
|
|
|
CFILES+=json.c ns.c lock.c util.c disk.c query.c array.c fmt.c main.c
|
|
|
|
EMCCFLAGS=-O2 -s EXPORTED_FUNCTIONS="['_sdb_querys','_sdb_new0']"
|
2013-04-05 01:09:54 +00:00
|
|
|
#EMCCFLAGS+=--embed-file sdb.data
|
2015-07-13 13:22:37 +00:00
|
|
|
sdb.js: src/sdb_version.h
|
2014-07-02 22:01:46 +00:00
|
|
|
cd src ; emcc ${EMCCFLAGS} -I. -o ../sdb.js ${CFILES}
|
|
|
|
|
2013-05-13 23:53:52 +00:00
|
|
|
clean:
|
2015-07-13 13:22:37 +00:00
|
|
|
rm -f src/sdb_version.h
|
2012-09-03 23:46:12 +00:00
|
|
|
cd src && ${MAKE} clean
|
2013-03-13 10:58:36 +00:00
|
|
|
cd memcache && ${MAKE} clean
|
|
|
|
cd test && ${MAKE} clean
|
2013-04-30 23:43:35 +00:00
|
|
|
ifneq (${HAVE_VALA},)
|
2012-09-17 09:18:20 +00:00
|
|
|
cd ${VALADIR} && ${MAKE} clean
|
2013-04-30 23:43:35 +00:00
|
|
|
endif
|
2012-09-03 23:46:12 +00:00
|
|
|
|
|
|
|
dist:
|
2015-10-27 03:29:30 +00:00
|
|
|
rm -f sdb-${SDBVER}.tar.gz
|
|
|
|
rm -rf sdb-${SDBVER}
|
|
|
|
git clone . sdb-${SDBVER}
|
|
|
|
rm -rf sdb-${SDBVER}/.git*
|
|
|
|
tar czvf sdb-${SDBVER}.tar.gz sdb-${SDBVER}
|
|
|
|
pub sdb-${SDBVER}.tar.gz
|
|
|
|
rm -rf sdb-${SDBVER}
|
2012-09-03 23:46:12 +00:00
|
|
|
|
2015-05-24 21:30:13 +00:00
|
|
|
w32dist:
|
2015-10-27 03:29:30 +00:00
|
|
|
rm -f sdb-${SDBVER}.zip
|
|
|
|
rm -rf sdb-${SDBVER}
|
|
|
|
mkdir -p sdb-${SDBVER}
|
|
|
|
cp src/sdb.exe sdb-${SDBVER}
|
|
|
|
zip -r sdb-${SDBVER}.zip sdb-${SDBVER}
|
|
|
|
rm -rf sdb-${SDBVER}
|
2015-05-24 21:30:13 +00:00
|
|
|
|
2012-09-03 23:46:12 +00:00
|
|
|
install-dirs:
|
2015-10-27 03:29:30 +00:00
|
|
|
$(INSTALL_DIR) ${DESTDIR}${MANDIR} ${DESTDIR}${LIBDIR}/pkgconfig ${DESTDIR}${BINDIR}
|
|
|
|
$(INSTALL_DIR) ${DESTDIR}${DATADIR}/vala/vapi ${DESTDIR}${INCDIR}/sdb
|
2012-09-03 23:46:12 +00:00
|
|
|
|
2015-07-13 13:22:37 +00:00
|
|
|
INCFILES=src/sdb.h src/sdb_version.h src/cdb.h src/ht.h src/types.h
|
2014-02-05 15:36:03 +00:00
|
|
|
INCFILES+=src/ls.h src/cdb_make.h src/buffer.h src/config.h
|
|
|
|
|
2014-11-14 14:49:34 +00:00
|
|
|
install: pkgconfig install-dirs
|
2015-10-27 03:29:30 +00:00
|
|
|
$(INSTALL_MAN) src/sdb.1 ${DESTDIR}${MANDIR}
|
|
|
|
$(INSTALL_LIB) src/libsdb.${EXT_SO} ${DESTDIR}${LIBDIR}
|
2017-05-24 23:57:10 +00:00
|
|
|
$(INSTALL_DATA) src/libsdb.a ${DESTDIR}${LIBDIR}
|
2015-07-13 14:02:28 +00:00
|
|
|
-if [ "$(EXT_SO)" != "$(SOVER)" ]; then \
|
2015-10-27 03:29:30 +00:00
|
|
|
cd ${DESTDIR}${LIBDIR} ; \
|
2015-07-13 14:02:28 +00:00
|
|
|
mv libsdb.$(EXT_SO) libsdb.$(SOVER) ; \
|
|
|
|
ln -s libsdb.$(SOVER) libsdb.$(EXT_SO) ; \
|
2015-10-16 10:54:44 +00:00
|
|
|
ln -s libsdb.$(SOVER) libsdb.$(EXT_SO).$(SOVERSION) ; \
|
2015-05-25 22:59:39 +00:00
|
|
|
fi
|
2015-10-27 03:29:30 +00:00
|
|
|
$(INSTALL_DATA) $(INCFILES) ${DESTDIR}${INCDIR}/sdb
|
|
|
|
$(INSTALL_PROGRAM) src/sdb ${DESTDIR}${BINDIR}
|
2015-05-25 22:59:39 +00:00
|
|
|
ifeq ($(BUILD_MEMCACHE),1)
|
2017-05-24 23:57:10 +00:00
|
|
|
$(INSTALL_DATA) memcache/libmcsdb.a ${DESTDIR}${LIBDIR}
|
2015-10-27 03:29:30 +00:00
|
|
|
$(INSTALL_DATA) memcache/mcsdb.h ${DESTDIR}${INCDIR}/sdb
|
|
|
|
$(INSTALL_PROGRAM) memcache/mcsdbd ${DESTDIR}${BINDIR}
|
|
|
|
$(INSTALL_PROGRAM) memcache/mcsdbc ${DESTDIR}${BINDIR}
|
|
|
|
$(INSTALL_DATA) pkgconfig/mcsdb.pc ${DESTDIR}${LIBDIR}/pkgconfig
|
2015-05-25 22:59:39 +00:00
|
|
|
endif
|
2015-10-27 03:29:30 +00:00
|
|
|
$(INSTALL_DATA) pkgconfig/sdb.pc ${DESTDIR}${LIBDIR}/pkgconfig
|
2012-09-03 23:46:12 +00:00
|
|
|
ifneq (${HAVE_VALA},)
|
2017-09-30 16:34:19 +00:00
|
|
|
test -f ${VALADIR}/types/sdbtypes.h || $(MAKE) -C $(VALADIR)/types
|
2015-10-27 03:29:30 +00:00
|
|
|
$(INSTALL_DATA) ${VALADIR}/sdb.vapi ${DESTDIR}${DATADIR}/vala/vapi
|
|
|
|
cd ${VALADIR}/types && ${MAKE} install DESTDIR=${DESTDIR} PREFIX=${PREFIX}
|
2015-05-25 22:59:39 +00:00
|
|
|
ifeq ($(BUILD_MEMCACHE),1)
|
2015-10-27 03:29:30 +00:00
|
|
|
$(INSTALL_DATA) ${VALADIR}/mcsdb.vapi ${DESTDIR}${DATADIR}/vala/vapi
|
2015-05-25 22:59:39 +00:00
|
|
|
endif
|
2012-09-03 23:46:12 +00:00
|
|
|
endif
|
|
|
|
|
|
|
|
deinstall uninstall:
|
2015-10-27 03:29:30 +00:00
|
|
|
rm -rf ${DESTDIR}${INCDIR}/sdb
|
|
|
|
rm -f ${DESTDIR}${BINDIR}/sdb
|
|
|
|
rm -f ${DESTDIR}${BINDIR}/mcsdbc
|
|
|
|
rm -f ${DESTDIR}${BINDIR}/mcsdbd
|
|
|
|
rm -f ${DESTDIR}${LIBDIR}/libsdb.*
|
2017-05-24 23:57:10 +00:00
|
|
|
rm -f ${DESTDIR}${LIBDIR}/libmcsdb.a
|
2015-10-27 03:29:30 +00:00
|
|
|
rm -f ${DESTDIR}${LIBDIR}/pkgconfig/sdb.pc
|
|
|
|
rm -f ${DESTDIR}${LIBDIR}/pkgconfig/mcsdb.pc
|
|
|
|
rm -f ${DESTDIR}${MANDIR}/sdb.1
|
2012-09-03 23:46:12 +00:00
|
|
|
ifneq (${HAVE_VALA},)
|
2015-10-27 03:29:30 +00:00
|
|
|
rm -f ${DESTDIR}${DATADIR}/vala/vapi/sdb.vapi
|
|
|
|
rm -f ${DESTDIR}${DATADIR}/vala/vapi/mcsdb.vapi
|
|
|
|
cd ${VALADIR}/types && ${MAKE} uninstall DESTDIR=${DESTDIR} PREFIX=${PREFIX}
|
2012-09-03 23:46:12 +00:00
|
|
|
endif
|
|
|
|
|
|
|
|
symstall: install-dirs
|
2015-10-27 03:29:30 +00:00
|
|
|
cd src ; for a in libsdb.* ; do \
|
|
|
|
ln -fs ${PWD}/src/$$a ${DESTDIR}${LIBDIR}/$$a ; done
|
|
|
|
ln -fs ${PWD}/src/sdb.1 ${DESTDIR}${MANDIR}/sdb.1
|
|
|
|
ln -fs ${PWD}/src/sdb ${DESTDIR}${BINDIR}
|
|
|
|
ln -fs ${PWD}/src/sdb.h ${DESTDIR}${INCDIR}/sdb
|
|
|
|
ln -fs ${PWD}/src/sdb_version.h ${DESTDIR}${INCDIR}/sdb
|
|
|
|
ln -fs ${PWD}/src/cdb.h ${DESTDIR}${INCDIR}/sdb
|
|
|
|
ln -fs ${PWD}/src/ht.h ${DESTDIR}${INCDIR}/sdb
|
|
|
|
ln -fs ${PWD}/src/types.h ${DESTDIR}${INCDIR}/sdb
|
|
|
|
ln -fs ${PWD}/src/ls.h ${DESTDIR}${INCDIR}/sdb
|
|
|
|
ln -fs ${PWD}/src/cdb_make.h ${DESTDIR}${INCDIR}/sdb
|
|
|
|
ln -fs ${PWD}/src/buffer.h ${DESTDIR}${INCDIR}/sdb
|
|
|
|
ln -fs ${PWD}/src/config.h ${DESTDIR}${INCDIR}/sdb
|
|
|
|
ln -fs ${PWD}/bindings/vala/sdb.pc ${DESTDIR}${LIBDIR}/pkgconfig
|
|
|
|
ln -fs ${PWD}/bindings/vala/mcsdb.pc ${DESTDIR}${LIBDIR}/pkgconfig
|
2012-09-03 23:46:12 +00:00
|
|
|
ifneq (${HAVE_VALA},)
|
2015-10-27 03:29:30 +00:00
|
|
|
$(MKDIR) -p ${DESTDIR}$(VAPIDIR)
|
|
|
|
ln -fs ${PWD}/bindings/vala/sdb.vapi ${DESTDIR}$(VAPIDIR)
|
|
|
|
ln -fs ${PWD}/bindings/vala/mcsdb.vapi ${DESTDIR}$(VAPIDIR)
|
|
|
|
ln -fs ${PWD}/bindings/vala/sdb.vapi ${DESTDIR}$(VAPIDIR)
|
|
|
|
ln -fs ${PWD}/bindings/vala/mcsdb.vapi ${DESTDIR}$(VAPIDIR)
|
|
|
|
cd ${VALADIR}/types && ${MAKE} symstall DESTDIR=${DESTDIR} PREFIX=${PREFIX}
|
2012-09-03 23:46:12 +00:00
|
|
|
endif
|
|
|
|
|
2013-04-01 03:52:21 +00:00
|
|
|
# windows compiler prefix
|
2015-05-11 23:36:42 +00:00
|
|
|
# travis/debian
|
2013-04-01 03:52:21 +00:00
|
|
|
WCP=i386-mingw32
|
2015-05-11 23:36:42 +00:00
|
|
|
# mxe
|
2015-04-01 00:07:29 +00:00
|
|
|
#WCP=i686-pc-mingw32
|
2013-04-01 03:52:21 +00:00
|
|
|
|
2015-07-13 13:22:37 +00:00
|
|
|
w32: src/sdb_version.h
|
2013-04-01 03:52:21 +00:00
|
|
|
cd src ; \
|
2015-10-27 03:29:30 +00:00
|
|
|
${MAKE} OS=w32 WCP=${WCP} CC=${WCP}-gcc AR=${WCP}-ar RANLIB=${WCP}-ranlib sdb.exe
|
2013-04-01 03:52:21 +00:00
|
|
|
|
2015-03-30 23:31:35 +00:00
|
|
|
# ios toolchain
|
|
|
|
IOS_CC=$(shell xcrun --sdk iphoneos --find clang) -isysroot $(shell xcrun --sdk iphoneos --show-sdk-path) -arch armv7 -arch arm64
|
|
|
|
IOS_AR=$(shell xcrun --sdk iphoneos --find ar)
|
|
|
|
IOS_RL=$(shell xcrun --sdk iphoneos --find ranlib)
|
2015-07-13 13:22:37 +00:00
|
|
|
ios: src/sdb_version.h
|
2015-03-30 23:31:35 +00:00
|
|
|
${MAKE} OS=Darwin ARCH=arm CC="${IOS_CC}" AR="${IOS_AR}" RANLIB="${IOS_RL}" HAVE_VALA= all
|
|
|
|
|
|
|
|
.PHONY: all ${VALADIR} clean dist w32 ios
|
2013-04-01 03:52:21 +00:00
|
|
|
.PHONY: install-dirs install uninstall deinstall symstall
|