2015-08-15 03:50:16 -07:00
|
|
|
include config.mk
|
|
|
|
|
2022-08-06 06:34:49 -07:00
|
|
|
CFLAGS +=-Wall -Werror -DNS_ENABLE_IPV6
|
2016-02-19 08:31:32 -07:00
|
|
|
LIBS = $(MORELIBS) -lm
|
2016-02-09 03:17:59 -07:00
|
|
|
LIBS += -lcurl -lconfig
|
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 \
|
2017-05-17 00:21:14 -07:00
|
|
|
gcache.o \
|
2015-08-27 14:42:18 -07:00
|
|
|
geo.o \
|
|
|
|
geohash.o \
|
|
|
|
mkpath.o \
|
|
|
|
base64.o \
|
|
|
|
misc.o \
|
|
|
|
util.o \
|
2015-10-12 02:34:22 -07:00
|
|
|
storage.o \
|
2016-12-07 11:40:59 -07:00
|
|
|
fences.o \
|
2015-10-12 02:34:22 -07:00
|
|
|
listsort.o
|
2016-02-19 04:50:06 -07:00
|
|
|
OTR_EXTRA_OBJS =
|
2015-08-27 14:42:18 -07:00
|
|
|
|
2015-09-11 01:30:16 -07:00
|
|
|
CFLAGS += -DGHASHPREC=$(GHASHPREC)
|
|
|
|
|
2018-10-22 06:23:51 -07:00
|
|
|
LIBS += -llmdb
|
2017-05-17 00:21:14 -07:00
|
|
|
LIBS += -lpthread
|
2016-02-22 05:09:57 -07:00
|
|
|
|
2016-02-19 08:31:32 -07:00
|
|
|
ifeq ($(WITH_MQTT),yes)
|
|
|
|
CFLAGS += -DWITH_MQTT=1
|
|
|
|
CFLAGS += $(MOSQUITTO_INC)
|
|
|
|
LIBS += $(MOSQUITTO_LIB) -lmosquitto -lm
|
|
|
|
endif
|
|
|
|
|
2015-09-28 10:04:37 -07:00
|
|
|
ifeq ($(WITH_PING),yes)
|
|
|
|
CFLAGS += -DWITH_PING=1
|
2015-09-10 12:04:10 -07:00
|
|
|
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
|
|
|
|
|
2016-01-22 14:42:30 -07:00
|
|
|
ifeq ($(WITH_ENCRYPT),yes)
|
|
|
|
CFLAGS += -DWITH_ENCRYPT=1 $(SODIUM_CFLAGS)
|
|
|
|
LIBS += $(SODIUM_LIBS)
|
|
|
|
endif
|
|
|
|
|
2015-09-28 10:04:37 -07:00
|
|
|
ifeq ($(WITH_KILL),yes)
|
|
|
|
CFLAGS += -DWITH_KILL=1
|
2015-09-14 23:35:58 -07:00
|
|
|
endif
|
2015-09-10 12:04:10 -07:00
|
|
|
|
2015-09-28 10:04:37 -07:00
|
|
|
ifeq ($(WITH_HTTP),yes)
|
|
|
|
CFLAGS += -DWITH_HTTP=1
|
2016-02-19 04:50:06 -07:00
|
|
|
OTR_EXTRA_OBJS += mongoose.o http.o
|
2015-08-27 14:42:18 -07:00
|
|
|
endif
|
|
|
|
|
2022-08-06 09:46:11 -07:00
|
|
|
ifeq ($(WITH_TOURS),yes)
|
|
|
|
CFLAGS += -DWITH_TOURS
|
2022-08-04 02:25:23 -07:00
|
|
|
OTR_EXTRA_OBJS +=
|
|
|
|
endif
|
|
|
|
|
2015-11-10 01:23:06 -07:00
|
|
|
ifeq ($(WITH_GREENWICH),yes)
|
|
|
|
CFLAGS += -DWITH_GREENWICH=1
|
|
|
|
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 06:48:56 -07:00
|
|
|
CFLAGS += -DSTORAGEDEFAULT=\"$(STORAGEDEFAULT)\" -DDOCROOT=\"$(DOCROOT)\"
|
2016-02-09 03:17:59 -07:00
|
|
|
CFLAGS += -DCONFIGFILE=\"$(CONFIGFILE)\"
|
2018-11-29 12:16:10 -07:00
|
|
|
CFLAGS += -DGEOCODE_TIMEOUT=$(GEOCODE_TIMEOUT)
|
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
|
|
|
|
2016-07-22 00:51:06 -07:00
|
|
|
GIT_VERSION := $(shell git describe --long --abbrev=10 --dirty --tags 2>/dev/null || echo "tarball")
|
|
|
|
CFLAGS += -DGIT_VERSION=\"$(GIT_VERSION)\"
|
|
|
|
|
2022-09-22 13:37:41 -07:00
|
|
|
PKG_CONFIG ?= pkg-config
|
|
|
|
|
2015-09-01 04:45:53 -07:00
|
|
|
all: $(TARGETS)
|
2015-08-14 09:40:35 -07:00
|
|
|
|
2016-02-19 04:50:06 -07:00
|
|
|
ot-recorder: recorder.o $(OTR_OBJS) $(OTR_EXTRA_OBJS)
|
2022-09-22 13:33:41 -07:00
|
|
|
$(CC) $(CFLAGS) $(LDFLAGS) -o ot-recorder recorder.o $(OTR_OBJS) $(OTR_EXTRA_OBJS) $(LIBS)
|
2015-10-27 16:35:14 -07:00
|
|
|
if test -r codesign.sh; then /bin/sh codesign.sh; fi
|
2015-09-02 03:21:10 -07:00
|
|
|
|
|
|
|
ocat: ocat.o $(OTR_OBJS)
|
2022-09-22 13:33:41 -07:00
|
|
|
$(CC) $(CFLAGS) $(LDFLAGS) -o ocat ocat.o $(OTR_OBJS) $(LIBS)
|
2015-09-02 03:21:10 -07:00
|
|
|
|
2015-09-30 01:51:27 -07:00
|
|
|
$(OTR_OBJS): config.mk Makefile
|
2015-08-14 09:40:35 -07:00
|
|
|
|
2016-12-07 11:40:59 -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 base64.h recorder.h version.h fences.h
|
2015-09-30 01:51:27 -07:00
|
|
|
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
|
2016-09-12 00:09:16 -07:00
|
|
|
$(CC) $(CFLAGS) -Wno-unused-result -Wno-uninitialized -c base64.c
|
2015-09-30 01:51:27 -07:00
|
|
|
gcache.o: gcache.c gcache.h json.h
|
|
|
|
misc.o: misc.c misc.h udata.h
|
2016-02-24 09:59:00 -07:00
|
|
|
http.o: http.c mongoose.h util.h http.h storage.h version.h hooks.h
|
2015-09-30 01:51:27 -07:00
|
|
|
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
|
2015-10-12 02:34:22 -07:00
|
|
|
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
|
2015-10-12 02:34:22 -07:00
|
|
|
listsort.o: listsort.c listsort.h
|
2016-12-07 11:40:59 -07:00
|
|
|
fences.o: fences.c fences.h util.h json.h udata.h gcache.h hooks.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
|
|
|
|
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)
|
2016-01-27 03:53:10 -07:00
|
|
|
mkdir -p $(DESTDIR)$(STORAGEDEFAULT)/last
|
2015-09-15 02:21:45 -07:00
|
|
|
cp -R docroot/* $(DESTDIR)$(DOCROOT)/
|
2015-09-16 06:26:14 -07:00
|
|
|
install -m 0755 ot-recorder $(DESTDIR)$(INSTALLDIR)/sbin
|
|
|
|
install -m 0755 ocat $(DESTDIR)$(INSTALLDIR)/bin
|
2017-05-17 00:21:14 -07:00
|
|
|
mkdir -p `dirname $(DESTDIR)/$(CONFIGFILE)`
|
|
|
|
test -r $(DESTDIR)/$(CONFIGFILE) || install -m 640 etc/ot-recorder.default $(DESTDIR)/$(CONFIGFILE)
|
2016-01-27 04:11:20 -07:00
|
|
|
ifndef DESTDIR
|
2016-01-27 04:13:03 -07:00
|
|
|
$(INSTALLDIR)/sbin/ot-recorder --initialize
|
2016-01-27 04:11:20 -07:00
|
|
|
endif
|
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
|