Add an build option to control building static libraries or not

The option WITH_STATIC_LIBRARIES is default to yes

Signed-off-by: Lance Chen <cyen0312@gmail.com>
This commit is contained in:
Lance Chen 2016-06-03 01:45:43 +08:00
parent 4b4817c3f0
commit 5ccd0dbb80
No known key found for this signature in database
GPG Key ID: 2B9B29056A82FEB1
3 changed files with 21 additions and 2 deletions

View File

@ -80,6 +80,9 @@ WITH_DOCS:=yes
# Build with client support for SOCK5 proxy.
WITH_SOCKS:=yes
# Build static libraries
WITH_STATIC_LIBRARIES:=yes
# =============================================================================
# End of user configuration
# =============================================================================

View File

@ -3,15 +3,23 @@ include objects.mk
.PHONY : really clean install
all : libmosquitto.so.${SOVERSION} libmosquitto.a
ALL_DEPS=libmosquitto.so.${SOVERSION}
ifeq ($(WITH_STATIC_LIBRARIES),yes)
ALL_DEPS+=libmosquitto.a
endif
all : ${ALL_DEPS}
$(MAKE) -C cpp
install : all
$(INSTALL) -d ${DESTDIR}$(prefix)/lib${LIB_SUFFIX}/
$(INSTALL) -s --strip-program=${CROSS_COMPILE}${STRIP} libmosquitto.so.${SOVERSION} ${DESTDIR}${prefix}/lib${LIB_SUFFIX}/libmosquitto.so.${SOVERSION}
ln -sf libmosquitto.so.${SOVERSION} ${DESTDIR}${prefix}/lib${LIB_SUFFIX}/libmosquitto.so
ifeq ($(WITH_STATIC_LIBRARIES),yes)
$(INSTALL) libmosquitto.a ${DESTDIR}${prefix}/lib${LIB_SUFFIX}/libmosquitto.a
${CROSS_COMPILE}${STRIP} -g --strip-unneeded ${DESTDIR}${prefix}/lib${LIB_SUFFIX}/libmosquitto.a
endif
$(INSTALL) -d ${DESTDIR}${prefix}/include/
$(INSTALL) mosquitto.h ${DESTDIR}${prefix}/include/mosquitto.h
$(MAKE) -C cpp install

View File

@ -7,14 +7,22 @@ endif
.PHONY : clean install
all : libmosquittopp.so.${SOVERSION} libmosquittopp.a
ALL_DEPS=libmosquittopp.so.${SOVERSION}
ifeq ($(WITH_STATIC_LIBRARIES),yes)
ALL_DEPS+=libmosquittopp.a
endif
all : ${ALL_DEPS}
install : all
$(INSTALL) -d ${DESTDIR}$(prefix)/lib${LIB_SUFFIX}/
$(INSTALL) -s --strip-program=${CROSS_COMPILE}${STRIP} libmosquittopp.so.${SOVERSION} ${DESTDIR}${prefix}/lib${LIB_SUFFIX}/libmosquittopp.so.${SOVERSION}
ln -sf libmosquittopp.so.${SOVERSION} ${DESTDIR}${prefix}/lib${LIB_SUFFIX}/libmosquittopp.so
ifeq ($(WITH_STATIC_LIBRARIES),yes)
$(INSTALL) libmosquittopp.a ${DESTDIR}${prefix}/lib${LIB_SUFFIX}/libmosquittopp.a
${CROSS_COMPILE}${STRIP} -g --strip-unneeded ${DESTDIR}${prefix}/lib${LIB_SUFFIX}/libmosquittopp.a
endif
$(INSTALL) -d ${DESTDIR}${prefix}/include/
$(INSTALL) mosquittopp.h ${DESTDIR}${prefix}/include/mosquittopp.h