From a65f946e83d7407e2206c6e5c09cccb7f5bfc6f2 Mon Sep 17 00:00:00 2001 From: "Roger A. Light" Date: Wed, 7 Oct 2020 22:04:15 +0100 Subject: [PATCH] Move headers to own directory. --- config.mk | 6 +++--- {lib => include}/mosquitto.h | 0 {src => include}/mosquitto_broker.h | 0 {src => include}/mosquitto_plugin.h | 0 {lib => include}/mqtt_protocol.h | 0 installer/mosquitto.nsi | 12 ++++++++---- installer/mosquitto64.nsi | 13 +++++++++---- lib/CMakeLists.txt | 7 ++++--- lib/Makefile | 16 ++++++++-------- src/CMakeLists.txt | 4 ++-- src/Makefile | 12 ++++++------ test/broker/c/Makefile | 2 +- test/lib/c/Makefile | 2 +- test/lib/cpp/Makefile | 2 +- test/unit/Makefile | 2 +- 15 files changed, 44 insertions(+), 34 deletions(-) rename {lib => include}/mosquitto.h (100%) rename {src => include}/mosquitto_broker.h (100%) rename {src => include}/mosquitto_plugin.h (100%) rename {lib => include}/mqtt_protocol.h (100%) diff --git a/config.mk b/config.mk index 03186734..204870c5 100644 --- a/config.mk +++ b/config.mk @@ -144,7 +144,7 @@ endif STATIC_LIB_DEPS:= -LIB_CPPFLAGS=$(CPPFLAGS) -I. -I.. -I../lib +LIB_CPPFLAGS=$(CPPFLAGS) -I. -I.. -I../include -I../../include ifeq ($(WITH_BUNDLED_DEPS),yes) LIB_CPPFLAGS:=$(LIB_CPPFLAGS) -I../src/deps endif @@ -153,12 +153,12 @@ LIB_CXXFLAGS:=$(CXXFLAGS) LIB_LDFLAGS:=$(LDFLAGS) LIB_LIBADD:=$(LIBADD) -BROKER_CPPFLAGS:=$(LIB_CPPFLAGS) +BROKER_CPPFLAGS:=$(LIB_CPPFLAGS) -I../lib BROKER_CFLAGS:=${CFLAGS} -DVERSION="\"${VERSION}\"" -DWITH_BROKER BROKER_LDFLAGS:=${LDFLAGS} BROKER_LDADD:= -CLIENT_CPPFLAGS:=$(CPPFLAGS) -I.. -I../lib +CLIENT_CPPFLAGS:=$(CPPFLAGS) -I.. -I../include CLIENT_CFLAGS:=${CFLAGS} -DVERSION="\"${VERSION}\"" CLIENT_LDFLAGS:=$(LDFLAGS) -L../lib CLIENT_LDADD:= diff --git a/lib/mosquitto.h b/include/mosquitto.h similarity index 100% rename from lib/mosquitto.h rename to include/mosquitto.h diff --git a/src/mosquitto_broker.h b/include/mosquitto_broker.h similarity index 100% rename from src/mosquitto_broker.h rename to include/mosquitto_broker.h diff --git a/src/mosquitto_plugin.h b/include/mosquitto_plugin.h similarity index 100% rename from src/mosquitto_plugin.h rename to include/mosquitto_plugin.h diff --git a/lib/mqtt_protocol.h b/include/mqtt_protocol.h similarity index 100% rename from lib/mqtt_protocol.h rename to include/mqtt_protocol.h diff --git a/installer/mosquitto.nsi b/installer/mosquitto.nsi index 60ac9a26..637a1750 100644 --- a/installer/mosquitto.nsi +++ b/installer/mosquitto.nsi @@ -61,11 +61,13 @@ Section "Files" SecInstall File "..\epl-v10" SetOutPath "$INSTDIR\devel" - File "..\lib\mosquitto.h" File "..\build\lib\Release\mosquitto.lib" - File "..\lib\cpp\mosquittopp.h" File "..\build\lib\cpp\Release\mosquittopp.lib" - File "..\src\mosquitto_plugin.h" + File "..\include\mosquitto.h" + File "..\include\mosquitto_broker.h" + File "..\include\mosquitto_plugin.h" + File "..\include\mqtt_protocol.h" + File "..\lib\cpp\mosquittopp.h" WriteUninstaller "$INSTDIR\Uninstall.exe" WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Mosquitto" "DisplayName" "Eclipse Mosquitto MQTT broker" @@ -108,9 +110,11 @@ Section "Uninstall" Delete "$INSTDIR\devel\mosquitto.h" Delete "$INSTDIR\devel\mosquitto.lib" + Delete "$INSTDIR\devel\mosquitto_broker.h" + Delete "$INSTDIR\devel\mosquitto_plugin.h" Delete "$INSTDIR\devel\mosquittopp.h" Delete "$INSTDIR\devel\mosquittopp.lib" - Delete "$INSTDIR\devel\mosquitto_plugin.h" + Delete "$INSTDIR\devel\mqtt_protocol.h" Delete "$INSTDIR\Uninstall.exe" RMDir "$INSTDIR" diff --git a/installer/mosquitto64.nsi b/installer/mosquitto64.nsi index c303f7a4..54db496b 100644 --- a/installer/mosquitto64.nsi +++ b/installer/mosquitto64.nsi @@ -62,11 +62,13 @@ Section "Files" SecInstall File "..\epl-v10" SetOutPath "$INSTDIR\devel" - File "..\lib\mosquitto.h" File "..\build64\lib\Release\mosquitto.lib" - File "..\lib\cpp\mosquittopp.h" File "..\build64\lib\cpp\Release\mosquittopp.lib" - File "..\src\mosquitto_plugin.h" + File "..\include\mosquitto.h" + File "..\include\mosquitto_broker.h" + File "..\include\mosquitto_plugin.h" + File "..\include\mqtt_protocol.h" + File "..\lib\cpp\mosquittopp.h" WriteUninstaller "$INSTDIR\Uninstall.exe" WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Mosquitto64" "DisplayName" "Eclipse Mosquitto MQTT broker (64 bit)" @@ -109,9 +111,12 @@ Section "Uninstall" Delete "$INSTDIR\devel\mosquitto.h" Delete "$INSTDIR\devel\mosquitto.lib" + Delete "$INSTDIR\devel\mosquitto_broker.h" + Delete "$INSTDIR\devel\mosquitto_plugin.h" + Delete "$INSTDIR\devel\mosquitto_plugin.h" Delete "$INSTDIR\devel\mosquittopp.h" Delete "$INSTDIR\devel\mosquittopp.lib" - Delete "$INSTDIR\devel\mosquitto_plugin.h" + Delete "$INSTDIR\devel\mqtt_protocol.h" Delete "$INSTDIR\Uninstall.exe" RMDir "$INSTDIR" diff --git a/lib/CMakeLists.txt b/lib/CMakeLists.txt index e0ce56b3..67b1359e 100644 --- a/lib/CMakeLists.txt +++ b/lib/CMakeLists.txt @@ -32,9 +32,9 @@ set(C_SRC memory_mosq.c memory_mosq.h messages_mosq.c messages_mosq.h misc_mosq.c misc_mosq.h - mosquitto.c mosquitto.h + mosquitto.c ../include/mosquitto.h mosquitto_internal.h - mqtt_protocol.h + ../include/mqtt_protocol.h net_mosq_ocsp.c net_mosq.c net_mosq.h options.c packet_datatypes.c @@ -115,4 +115,5 @@ if (WITH_STATIC_LIBRARIES) install(TARGETS libmosquitto_static ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}") endif (WITH_STATIC_LIBRARIES) -install(FILES mosquitto.h DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}") +install(FILES ../include/mosquitto.h DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}") +install(FILES ../include/mqtt_protocol.h DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}") diff --git a/lib/Makefile b/lib/Makefile index da2b3ffd..1a0ce126 100644 --- a/lib/Makefile +++ b/lib/Makefile @@ -70,8 +70,8 @@ ifeq ($(WITH_STATIC_LIBRARIES),yes) $(INSTALL) ${STRIP_OPTS} libmosquitto.a "${DESTDIR}${libdir}/libmosquitto.a" endif $(INSTALL) -d "${DESTDIR}${incdir}/" - $(INSTALL) mosquitto.h "${DESTDIR}${incdir}/mosquitto.h" - $(INSTALL) mqtt_protocol.h "${DESTDIR}${incdir}/mqtt_protocol.h" + $(INSTALL) ../include/mosquitto.h "${DESTDIR}${incdir}/mosquitto.h" + $(INSTALL) ../include/mqtt_protocol.h "${DESTDIR}${incdir}/mqtt_protocol.h" $(INSTALL) -d "${DESTDIR}${libdir}/pkgconfig" $(INSTALL) -m644 ../libmosquitto.pc.in "${DESTDIR}${libdir}/pkgconfig/libmosquitto.pc" sed ${SEDINPLACE} -e "s#@CMAKE_INSTALL_PREFIX@#${prefix}#" -e "s#@VERSION@#${VERSION}#" "${DESTDIR}${libdir}/pkgconfig/libmosquitto.pc" @@ -97,16 +97,16 @@ libmosquitto.so.${SOVERSION} : ${MOSQ_OBJS} libmosquitto.a : ${MOSQ_OBJS} ${CROSS_COMPILE}$(AR) cr $@ $^ -mosquitto.o : mosquitto.c mosquitto.h mosquitto_internal.h +mosquitto.o : mosquitto.c ../include/mosquitto.h mosquitto_internal.h ${CROSS_COMPILE}$(CC) $(LIB_CPPFLAGS) $(LIB_CFLAGS) -c $< -o $@ -actions.o : actions.c mosquitto.h mosquitto_internal.h +actions.o : actions.c ../include/mosquitto.h mosquitto_internal.h ${CROSS_COMPILE}$(CC) $(LIB_CPPFLAGS) $(LIB_CFLAGS) -c $< -o $@ -callbacks.o : callbacks.c mosquitto.h mosquitto_internal.h +callbacks.o : callbacks.c ../include/mosquitto.h mosquitto_internal.h ${CROSS_COMPILE}$(CC) $(LIB_CPPFLAGS) $(LIB_CFLAGS) -c $< -o $@ -connect.o : connect.c mosquitto.h mosquitto_internal.h +connect.o : connect.c ../include/mosquitto.h mosquitto_internal.h ${CROSS_COMPILE}$(CC) $(LIB_CPPFLAGS) $(LIB_CFLAGS) -c $< -o $@ handle_auth.o : handle_auth.c read_handle.h @@ -145,7 +145,7 @@ helpers.o : helpers.c logging_mosq.o : logging_mosq.c logging_mosq.h ${CROSS_COMPILE}$(CC) $(LIB_CPPFLAGS) $(LIB_CFLAGS) -c $< -o $@ -loop.o : loop.c mosquitto.h mosquitto_internal.h +loop.o : loop.c ../include/mosquitto.h mosquitto_internal.h ${CROSS_COMPILE}$(CC) $(LIB_CPPFLAGS) $(LIB_CFLAGS) -c $< -o $@ messages_mosq.o : messages_mosq.c messages_mosq.h @@ -163,7 +163,7 @@ net_mosq_ocsp.o : net_mosq_ocsp.c net_mosq.h net_mosq.o : net_mosq.c net_mosq.h ${CROSS_COMPILE}$(CC) $(LIB_CPPFLAGS) $(LIB_CFLAGS) -c $< -o $@ -options.o : options.c mosquitto.h mosquitto_internal.h +options.o : options.c ../include/mosquitto.h mosquitto_internal.h ${CROSS_COMPILE}$(CC) $(LIB_CPPFLAGS) $(LIB_CFLAGS) -c $< -o $@ packet_datatypes.o : packet_datatypes.c packet_mosq.h diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 0b8931f8..fd69b347 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -30,7 +30,7 @@ set (MOSQ_SRCS ../lib/memory_mosq.c ../lib/memory_mosq.h memory_public.c mosquitto.c - mosquitto_broker.h mosquitto_broker_internal.h + ../include/mosquitto_broker.h mosquitto_broker_internal.h ../lib/misc_mosq.c ../lib/misc_mosq.h mux.c mux.h mux_epoll.c mux_poll.c net.c @@ -203,7 +203,7 @@ if (UNIX) endif (UNIX) install(TARGETS mosquitto RUNTIME DESTINATION "${CMAKE_INSTALL_SBINDIR}") -install(FILES mosquitto_broker.h mosquitto_plugin.h DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}") +install(FILES ../include/mosquitto_broker.h ../include/mosquitto_plugin.h DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}") if (WITH_TLS) add_executable(mosquitto_passwd mosquitto_passwd.c ../lib/misc_mosq.c) diff --git a/src/Makefile b/src/Makefile index 72b7fb3f..4b1d7d4c 100644 --- a/src/Makefile +++ b/src/Makefile @@ -214,10 +214,10 @@ property_broker.o : property_broker.c mosquitto_broker_internal.h property_mosq.o : ../lib/property_mosq.c ../lib/property_mosq.h ${CROSS_COMPILE}${CC} $(BROKER_CPPFLAGS) $(BROKER_CFLAGS) -c $< -o $@ -plugin.o : plugin.c mosquitto_plugin.h mosquitto_broker_internal.h +plugin.o : plugin.c ../include/mosquitto_plugin.h mosquitto_broker_internal.h ${CROSS_COMPILE}${CC} $(BROKER_CPPFLAGS) $(BROKER_CFLAGS) -c $< -o $@ -plugin_public.o : plugin_public.c mosquitto_plugin.h mosquitto_broker_internal.h +plugin_public.o : plugin_public.c ../include/mosquitto_plugin.h mosquitto_broker_internal.h ${CROSS_COMPILE}${CC} $(BROKER_CPPFLAGS) $(BROKER_CFLAGS) -c $< -o $@ read_handle.o : read_handle.c mosquitto_broker_internal.h @@ -310,18 +310,18 @@ mosquitto_passwd : mosquitto_passwd.o misc_mosq.o mosquitto_passwd.o : mosquitto_passwd.c ${CROSS_COMPILE}${CC} -I.. -I../lib $(CPPFLAGS) $(CFLAGS) -c $< -o $@ -plugin_defer.so : plugin_defer.c mosquitto_plugin.h mosquitto_broker.h mosquitto_broker_internal.h +plugin_defer.so : plugin_defer.c ../include/mosquitto_plugin.h ../include/mosquitto_broker.h mosquitto_broker_internal.h ${CROSS_COMPILE}${CC} -I. -I../lib -fPIC -shared $< -o $@ -plugin_debug.so : plugin_debug.c mosquitto_plugin.h mosquitto_broker.h mosquitto_broker_internal.h +plugin_debug.so : plugin_debug.c ../include/mosquitto_plugin.../include/h mosquitto_broker.h mosquitto_broker_internal.h ${CROSS_COMPILE}${CC} -I. -I../lib -fPIC -shared $< -o $@ install : all $(INSTALL) -d "${DESTDIR}$(prefix)/sbin" $(INSTALL) ${STRIP_OPTS} mosquitto "${DESTDIR}${prefix}/sbin/mosquitto" $(INSTALL) -d "${DESTDIR}$(prefix)/include" - $(INSTALL) mosquitto_broker.h "${DESTDIR}${prefix}/include/mosquitto_broker.h" - $(INSTALL) mosquitto_plugin.h "${DESTDIR}${prefix}/include/mosquitto_plugin.h" + $(INSTALL) ../include/mosquitto_broker.h "${DESTDIR}${prefix}/include/mosquitto_broker.h" + $(INSTALL) ../include/mosquitto_plugin.h "${DESTDIR}${prefix}/include/mosquitto_plugin.h" ifeq ($(WITH_TLS),yes) $(INSTALL) -d "${DESTDIR}$(prefix)/bin" $(INSTALL) ${STRIP_OPTS} mosquitto_passwd "${DESTDIR}${prefix}/bin/mosquitto_passwd" diff --git a/test/broker/c/Makefile b/test/broker/c/Makefile index 57ca7158..6a561ba1 100644 --- a/test/broker/c/Makefile +++ b/test/broker/c/Makefile @@ -1,6 +1,6 @@ .PHONY: all test clean reallyclean -CFLAGS=-I../../../lib -I../../../src -Wall -Werror +CFLAGS=-I../../../include -Wall -Werror PLUGIN_SRC = \ auth_plugin_v4.c \ diff --git a/test/lib/c/Makefile b/test/lib/c/Makefile index 7cae716d..6c09e806 100644 --- a/test/lib/c/Makefile +++ b/test/lib/c/Makefile @@ -1,6 +1,6 @@ .PHONY: all clean reallyclean -CFLAGS=-I../../../lib -Werror +CFLAGS=-I../../../include -Werror LIBS=../../../lib/libmosquitto.so.1 SRC = \ diff --git a/test/lib/cpp/Makefile b/test/lib/cpp/Makefile index 42db17c3..c4ae14ca 100644 --- a/test/lib/cpp/Makefile +++ b/test/lib/cpp/Makefile @@ -1,6 +1,6 @@ .PHONY: all test 01 02 03 04 08 09 clean reallyclean -CFLAGS=-I../../../lib -I../../../lib/cpp -DDEBUG +CFLAGS=-I../../../include -I../../../lib/cpp -DDEBUG LIBS=../../../lib/libmosquitto.so.1 ../../../lib/cpp/libmosquittopp.so.1 all : 01 02 03 04 08 09 diff --git a/test/unit/Makefile b/test/unit/Makefile index 9c1eecfb..e6a25b56 100644 --- a/test/unit/Makefile +++ b/test/unit/Makefile @@ -2,7 +2,7 @@ include ../../config.mk .PHONY: all check test test-broker test-lib clean coverage -CPPFLAGS:=$(CPPFLAGS) -I../.. -I../../lib -I../../src +CPPFLAGS:=$(CPPFLAGS) -I../.. -I../../include -I../../lib -I../../src ifeq ($(WITH_BUNDLED_DEPS),yes) CPPFLAGS:=$(CPPFLAGS) -I../../src/deps endif