Files
mosquitto/lib/cpp/Makefile
Andreas Kempf 28e3495012 Enable building on AIX
The AIX operating system by IBM does not provide the getifaddrs function
and requires a custom linker script syntax. This commit allows for a
basic GCC build on AIX 7.2.

The build was tested using the command lines

make CC=gcc WITH_CJSON=no WITH_DOCS=no WITH_STATIC_LIBRARIES=yes
and
CC=gcc cmake <srcpath> -DDOCUMENTATION=no

At this point, the persistence test suite seems to fail. The library, as
well as the mosquitto_sub and mosquitto_pub executables were tested and
appear to be functional.

Signed-off-by: Andreas Kempf <aakempf@gmail.com>
2022-05-18 17:20:41 +02:00

52 lines
1.8 KiB
Makefile

R=../..
include ${R}/config.mk
ifneq ($(and $(findstring $(UNAME),SunOS), $(findstring $(UNAME),AIX)),)
LIB_LDFLAGS:=$(LDFLAGS) -Wl,-soname,libmosquittopp.so.${SOVERSION}
endif
.PHONY : clean install
ALL_DEPS=libmosquittopp.so.${SOVERSION}
ifeq ($(WITH_STATIC_LIBRARIES),yes)
ALL_DEPS+=libmosquittopp.a
endif
all : ${ALL_DEPS}
install : all
$(INSTALL) -d "${DESTDIR}${libdir}/"
$(INSTALL) ${STRIP_OPTS} libmosquittopp.so.${SOVERSION} "${DESTDIR}${libdir}/libmosquittopp.so.${SOVERSION}"
ln -sf libmosquittopp.so.${SOVERSION} "${DESTDIR}${libdir}/libmosquittopp.so"
ifeq ($(WITH_STATIC_LIBRARIES),yes)
$(INSTALL) libmosquittopp.a "${DESTDIR}${libdir}/libmosquittopp.a"
ifneq ($(UNAME),AIX)
${CROSS_COMPILE}${STRIP} -g --strip-unneeded "${DESTDIR}${libdir}/libmosquittopp.a"
endif
endif
$(INSTALL) -d "${DESTDIR}${incdir}/"
$(INSTALL) ${R}/include/mosquittopp.h "${DESTDIR}${incdir}/mosquittopp.h"
$(INSTALL) -d "${DESTDIR}${libdir}/pkgconfig/"
$(INSTALL) -m644 ${R}/libmosquittopp.pc.in "${DESTDIR}${libdir}/pkgconfig/libmosquittopp.pc"
sed ${SEDINPLACE} -e "s#@CMAKE_INSTALL_PREFIX@#${prefix}#" -e "s#@VERSION@#${VERSION}#" "${DESTDIR}${libdir}/pkgconfig/libmosquittopp.pc"
uninstall :
-rm -f "${DESTDIR}${libdir}/libmosquittopp.so.${SOVERSION}"
-rm -f "${DESTDIR}${libdir}/libmosquittopp.so"
-rm -f "${DESTDIR}${libdir}/libmosquittopp.a"
-rm -f "${DESTDIR}${incdir}/mosquittopp.h"
clean :
-rm -f *.o libmosquittopp.so.${SOVERSION} libmosquittopp.a
libmosquittopp.so.${SOVERSION} : mosquittopp.o
${CROSS_COMPILE}$(CXX) -shared $(LIB_LDFLAGS) $< -o $@ ../libmosquitto.so.${SOVERSION} $(LIB_LIDADD)
libmosquittopp.a : mosquittopp.o
${CROSS_COMPILE}$(AR) cr $@ $^
mosquittopp.o : mosquittopp.cpp ${R}/include/mosquittopp.h
${CROSS_COMPILE}$(CXX) $(LIB_CPPFLAGS) $(LIB_CXXFLAGS) -c $< -o $@