2015-08-15 03:50:16 -07:00
|
|
|
include config.mk
|
|
|
|
|
2015-09-10 02:08:46 -07:00
|
|
|
CFLAGS =-Wall -Werror $(MOSQUITTO_INC)
|
|
|
|
LIBS = $(MOSQUITTO_LIB) -lmosquitto
|
|
|
|
LIBS += -lcurl
|
2015-08-14 09:40:35 -07:00
|
|
|
|
2015-09-01 04:45:53 -07:00
|
|
|
TARGETS=
|
2015-08-27 14:42:18 -07:00
|
|
|
OTR_OBJS = json.o \
|
|
|
|
geo.o \
|
|
|
|
geohash.o \
|
|
|
|
mkpath.o \
|
|
|
|
base64.o \
|
|
|
|
misc.o \
|
|
|
|
util.o \
|
|
|
|
storage.o
|
|
|
|
|
2015-09-11 01:30:16 -07:00
|
|
|
CFLAGS += -DGHASHPREC=$(GHASHPREC)
|
|
|
|
|
2015-09-10 12:04:10 -07:00
|
|
|
ifeq ($(HAVE_PING),yes)
|
|
|
|
CFLAGS += -DHAVE_PING=1
|
|
|
|
endif
|
2015-09-14 23:35:58 -07:00
|
|
|
ifeq ($(HAVE_KILL),yes)
|
|
|
|
CFLAGS += -DHAVE_KILL=1
|
|
|
|
endif
|
2015-09-10 12:04:10 -07:00
|
|
|
|
2015-09-01 04:31:49 -07:00
|
|
|
ifeq ($(HAVE_LMDB),yes)
|
|
|
|
CFLAGS += -DHAVE_LMDB=1 -Imdb/
|
|
|
|
OTR_OBJS += gcache.o
|
2015-09-01 06:17:14 -07:00
|
|
|
LIBS += mdb/liblmdb.a -lpthread
|
2015-09-14 13:07:56 -07:00
|
|
|
TARGETS += mdb/liblmdb.a
|
2015-08-15 03:50:16 -07:00
|
|
|
endif
|
|
|
|
|
2015-08-27 14:42:18 -07:00
|
|
|
ifeq ($(HAVE_HTTP),yes)
|
|
|
|
CFLAGS += -DHAVE_HTTP=1
|
2015-08-29 06:41:07 -07:00
|
|
|
OTR_OBJS += mongoose.o http.o
|
2015-08-27 14:42:18 -07:00
|
|
|
LIBS += -lssl
|
|
|
|
endif
|
|
|
|
|
2015-09-11 01:35:11 -07:00
|
|
|
ifeq ($(JSON_INDENT),yes)
|
|
|
|
CFLAGS += -DJSON_INDENT="\" \""
|
|
|
|
else
|
|
|
|
CFLAGS += -DJSON_INDENT=NULL
|
|
|
|
endif
|
|
|
|
|
2015-09-11 02:07:01 -07:00
|
|
|
ifneq ($(APIKEY),)
|
|
|
|
CFLAGS += -DAPIKEY="\"$(APIKEY)\""
|
|
|
|
endif
|
|
|
|
|
2015-09-11 06:48:56 -07:00
|
|
|
CFLAGS += -DSTORAGEDEFAULT=\"$(STORAGEDEFAULT)\" -DDOCROOT=\"$(DOCROOT)\"
|
2015-09-10 03:17:14 -07:00
|
|
|
|
|
|
|
|
2015-08-15 03:50:16 -07:00
|
|
|
|
2015-09-01 04:45:53 -07:00
|
|
|
TARGETS += ot-recorder ocat ghashfind
|
2015-09-02 03:21:10 -07:00
|
|
|
|
2015-09-01 04:45:53 -07:00
|
|
|
all: $(TARGETS)
|
2015-08-14 09:40:35 -07:00
|
|
|
|
2015-08-30 11:26:36 -07:00
|
|
|
ot-recorder: ot-recorder.o $(OTR_OBJS)
|
2015-09-02 03:21:10 -07:00
|
|
|
$(CC) $(CFLAGS) -o ot-recorder ot-recorder.o $(OTR_OBJS) $(LIBS)
|
|
|
|
|
|
|
|
ocat: ocat.o $(OTR_OBJS)
|
|
|
|
$(CC) $(CFLAGS) -o ocat ocat.o $(OTR_OBJS) $(LIBS)
|
|
|
|
|
|
|
|
ghashfind: ghashfind.o $(OTR_OBJS)
|
|
|
|
$(CC) $(CFLAGS) -o ghashfind ghashfind.o $(OTR_OBJS) $(LIBS)
|
|
|
|
|
2015-08-14 09:40:35 -07:00
|
|
|
|
2015-09-11 02:07:01 -07:00
|
|
|
ot-recorder.o: ot-recorder.c storage.h util.h Makefile geo.h udata.h json.h http.h gcache.h config.mk
|
|
|
|
geo.o: geo.h geo.c udata.h Makefile config.mk
|
2015-08-15 07:27:19 -07:00
|
|
|
geohash.o: geohash.h geohash.c udata.h Makefile config.mk
|
2015-08-14 09:40:35 -07:00
|
|
|
base64.o: base64.h base64.c
|
2015-09-11 02:07:01 -07:00
|
|
|
gcache.o: gcache.c gcache.h json.h config.mk
|
2015-08-15 07:27:19 -07:00
|
|
|
misc.o: misc.c misc.h udata.h Makefile config.mk
|
2015-09-11 02:07:01 -07:00
|
|
|
http.o: http.c mongoose.h util.h http.h storage.h config.mk
|
2015-08-22 06:52:39 -07:00
|
|
|
util.o: util.c util.h Makefile config.mk
|
2015-09-11 02:07:01 -07:00
|
|
|
ghashfind.o: ghashfind.c util.h config.mk
|
2015-08-27 14:42:18 -07:00
|
|
|
mongoose.o: mongoose.c mongoose.h
|
2015-09-10 06:39:25 -07:00
|
|
|
ocat.o: ocat.c storage.h util.h config.mk version.h
|
2015-09-11 02:07:01 -07:00
|
|
|
storage.o: storage.c storage.h util.h gcache.h config.mk
|
2015-09-02 03:21:10 -07:00
|
|
|
|
2015-08-27 13:52:58 -07:00
|
|
|
|
2015-08-15 03:50:16 -07:00
|
|
|
clean:
|
|
|
|
rm -f *.o
|
|
|
|
clobber: clean
|
2015-09-14 11:54:05 -07:00
|
|
|
rm -f ot-recorder ocat ghashfind
|
2015-09-01 04:45:53 -07:00
|
|
|
|
|
|
|
mdb/liblmdb.a:
|
|
|
|
(cd mdb && make)
|
2015-09-01 05:29:11 -07:00
|
|
|
|
2015-09-11 05:13:10 -07:00
|
|
|
install: ot-recorder ocat
|
|
|
|
mkdir -p $(BUILDROOT)$(INSTALLDIR)/{bin,sbin}
|
2015-09-11 06:48:56 -07:00
|
|
|
mkdir -p $(BUILDROOT)$(STORAGEDEFAULT)
|
|
|
|
mkdir -p $(BUILDROOT)$(DOCROOT)
|
2015-09-14 05:08:59 -07:00
|
|
|
cp -R docroot/* $(BUILDROOT)$(DOCROOT)/
|
2015-09-11 05:13:10 -07:00
|
|
|
install --mode 0755 ot-recorder $(BUILDROOT)$(INSTALLDIR)/sbin
|
|
|
|
install --mode 0755 ocat $(BUILDROOT)$(INSTALLDIR)/bin
|