#
# WARNING: do not run this directly, it should be run by the main Makefile

include ../../Makefile.defs
auto_gen=
NAME=mqtt.so

ifeq ($(CROSS_COMPILE),)
	BUILDER = $(shell which pkg-config)
ifneq ($(BUILDER),)
	PKGLIBMO = $(shell $(BUILDER) --exists libmosquitto > /dev/null 2>&1 ; echo $$? )
	PKGLIBEV = $(shell $(BUILDER) --exists libev > /dev/null 2>&1 ; echo $$? )
endif
endif

ifeq ($(PKGLIBMO),0)
	DEFS += $(shell $(BUILDER) --cflags libmosquitto)
	LIBS += $(shell $(BUILDER) --libs libmosquitto)
else
ifneq (,$(findstring darwin,$(OS)))
	DEFS += -I/opt/local/include -I$(LOCALBASE)/include
	LIBS += -L/opt/local/lib -L$(LOCALBASE)/lib -lmosquitto
else
	DEFS += -I$(LOCALBASE)/include -I$(SYSBASE)/include
	LIBS += -L$(LOCALBASE)/lib -L$(SYSBASE)/lib -lmosquitto
endif
endif

ifeq ($(PKGLIBEV),0)
	DEFS += $(shell $(BUILDER) --cflags libev)
	LIBS += $(shell $(BUILDER) --libs libev)
else
ifneq (,$(findstring darwin,$(OS)))
	DEFS += -I/opt/local/include -I$(LOCALBASE)/include
	LIBS += -L/opt/local/lib -L$(LOCALBASE)/lib -lev
else
	DEFS += -I$(LOCALBASE)/include -I$(SYSBASE)/include
	LIBS += -L$(LOCALBASE)/lib -L$(SYSBASE)/lib -lev
endif
endif

include ../../Makefile.modules
