recorder/Makefile

111 lines
2.4 KiB
Makefile
Raw Normal View History

2015-08-15 03:50:16 -07:00
include config.mk
2015-09-10 02:08:46 -07:00
CFLAGS =-Wall -Werror $(MOSQUITTO_INC)
2015-09-15 02:24:17 -07:00
LIBS = $(MORELIBS) $(MOSQUITTO_LIB) -lmosquitto
2015-09-10 02:08:46 -07:00
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 \
listsort.o
2015-08-27 14:42:18 -07:00
CFLAGS += -DGHASHPREC=$(GHASHPREC)
2015-09-28 10:04:37 -07:00
ifeq ($(WITH_PING),yes)
CFLAGS += -DWITH_PING=1
endif
2015-09-19 07:11:53 -07:00
ifeq ($(WITH_LUA),yes)
CFLAGS += -DWITH_LUA=1 $(LUA_CFLAGS)
LIBS += $(LUA_LIBS)
OTR_OBJS += hooks.o
endif
2015-09-28 10:04:37 -07:00
ifeq ($(WITH_KILL),yes)
CFLAGS += -DWITH_KILL=1
endif
2015-10-22 02:21:52 -07:00
ifeq ($(WITH_RONLY),yes)
CFLAGS += -DWITH_RONLY=1
WITH_LMDB = yes
endif
2015-09-28 10:04:37 -07:00
ifeq ($(WITH_LMDB),yes)
CFLAGS += -DWITH_LMDB=1 -Imdb/
2015-09-01 04:31:49 -07:00
OTR_OBJS += gcache.o
2015-09-01 06:17:14 -07:00
LIBS += mdb/liblmdb.a -lpthread
TARGETS += mdb/liblmdb.a
2015-08-15 03:50:16 -07:00
endif
2015-09-28 10:04:37 -07:00
ifeq ($(WITH_HTTP),yes)
CFLAGS += -DWITH_HTTP=1
2015-08-29 06:41:07 -07:00
OTR_OBJS += mongoose.o http.o
2015-08-27 14:42:18 -07:00
endif
2015-09-11 01:35:11 -07:00
ifeq ($(JSON_INDENT),yes)
CFLAGS += -DJSON_INDENT="\" \""
else
CFLAGS += -DJSON_INDENT=NULL
endif
ifneq ($(APIKEY),)
CFLAGS += -DAPIKEY="\"$(APIKEY)\""
endif
2015-10-20 07:26:01 -07:00
2015-09-11 06:48:56 -07:00
CFLAGS += -DSTORAGEDEFAULT=\"$(STORAGEDEFAULT)\" -DDOCROOT=\"$(DOCROOT)\"
2015-08-15 03:50:16 -07:00
2015-09-15 07:14:15 -07:00
TARGETS += ot-recorder ocat
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-09-29 00:20:09 -07:00
ot-recorder: recorder.o $(OTR_OBJS)
$(CC) $(CFLAGS) -o ot-recorder recorder.o $(OTR_OBJS) $(LIBS)
2015-09-02 03:21:10 -07:00
ocat: ocat.o $(OTR_OBJS)
$(CC) $(CFLAGS) -o ocat ocat.o $(OTR_OBJS) $(LIBS)
$(OTR_OBJS): config.mk Makefile
2015-08-14 09:40:35 -07:00
2015-09-29 00:20:09 -07:00
recorder.o: recorder.c storage.h util.h Makefile geo.h udata.h json.h http.h gcache.h config.mk hooks.h
geo.o: geo.h geo.c udata.h
geohash.o: geohash.h geohash.c udata.h
2015-08-14 09:40:35 -07:00
base64.o: base64.h base64.c
gcache.o: gcache.c gcache.h json.h
misc.o: misc.c misc.h udata.h
http.o: http.c mongoose.h util.h http.h storage.h
util.o: util.c util.h
2015-08-27 14:42:18 -07:00
mongoose.o: mongoose.c mongoose.h
2015-10-20 07:26:01 -07:00
ocat.o: ocat.c storage.h util.h version.h config.mk Makefile
storage.o: storage.c storage.h util.h gcache.h listsort.h
2015-09-25 08:43:17 -07:00
hooks.o: hooks.c udata.h hooks.h util.h version.h gcache.h
listsort.o: listsort.c listsort.h
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-15 07:14:15 -07:00
rm -f ot-recorder ocat
2015-09-01 04:45:53 -07:00
mdb/liblmdb.a:
(cd mdb && make)
2015-09-11 05:13:10 -07:00
install: ot-recorder ocat
2015-09-15 02:32:17 -07:00
mkdir -p $(DESTDIR)$(INSTALLDIR)/bin
mkdir -p $(DESTDIR)$(INSTALLDIR)/sbin
2015-09-15 02:21:45 -07:00
mkdir -p $(DESTDIR)$(DOCROOT)
cp -R docroot/* $(DESTDIR)$(DOCROOT)/
install -m 0755 ot-recorder $(DESTDIR)$(INSTALLDIR)/sbin
install -m 0755 ocat $(DESTDIR)$(INSTALLDIR)/bin
$(DESTDIR)$(INSTALLDIR)/sbin/ot-recorder --initialize
2015-09-15 05:21:18 -07:00
# mkdir -p $(DESTDIR)/etc/systemd/system/
# install --mode 0644 etc/ot-recorder.service $(DESTDIR)/etc/systemd/system/ot-recorder.service