diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 0000000000000000000000000000000000000000..d7ed45133f78840565854d5731c66d53a42823e5 --- /dev/null +++ b/.gitmodules @@ -0,0 +1,6 @@ +[submodule "external/mosquitto"] + path = external/mosquitto + url = https://gitee.com/cpp-master/mosquitto.git +[submodule "external/json"] + path = external/json + url = https://gitee.com/cpp-master/json.git diff --git a/Makefile b/Makefile index 727af72198fd54b9a1e060e013f55a205aaad499..7e9995afa221256918ffd3c9e378389baa774c7c 100644 --- a/Makefile +++ b/Makefile @@ -1,6 +1,6 @@ include build_env.mk -.PHONY: all clean distclean +.PHONY: all clean distclean depend CCFLAGS := -Wall @@ -24,13 +24,23 @@ export CC CXX CFLAGS CXXFLAGS LDFLAGS APPS_DIR include config.mk -all test: + +all test: depend @for i in $(app_y); do \ [ ! -d $$i ] || $(MAKE) -C $$i $@ || exit $$? ; \ done +depend: + @for i in $(depends_y); do \ + [ ! -d $$i ] || $(MAKE) -C $$i || exit $$? ; \ + [ ! -d $$i ] || $(MAKE) -C $$i install || exit $$? ; \ + done + clean: -rm -rf $(OUTPUT_DIR) distclean: clean + @for i in $(depends_y); do \ + [ ! -d $$i ] || $(MAKE) -C $$i $@ || exit $$? ; \ + done -rm -rf $(STAGING_DIR) $(INSTALL_DIR) diff --git a/config.mk b/config.mk index 7b1b536f02301510d65097dc58c6bc13febc44f2..570bfa1d838e191af109f0973e863a8e4bcd6bb0 100644 --- a/config.mk +++ b/config.mk @@ -1,3 +1,4 @@ +depends_y += external app_y += base app_y += util app_y += event diff --git a/external/Makefile b/external/Makefile new file mode 100644 index 0000000000000000000000000000000000000000..a1dfdcd2d1baf1d1111ceb2b1ea3cdb2dc163686 --- /dev/null +++ b/external/Makefile @@ -0,0 +1,19 @@ +HOST ?= +Make ?= make -j$(shell nproc) + +.PHONY: all clean distclean install + +all: + $(Make) -C mosquitto || exit $$? + +clean distclean: + $(Make) -C mosquitto clean || exit $$? + +install: all + install -d $(STAGING_INCLUDE)/nlohmann + install -d $(STAGING_LIB) + install ./json/single_include/nlohmann/json.hpp $(STAGING_INCLUDE)/nlohmann/json.hpp + install ./json/include/nlohmann/json_fwd.hpp $(STAGING_INCLUDE)/nlohmann/json_fwd.hpp + make -C mosquitto install DESTDIR=$(STAGING_DIR)/mosquitto || exit $$? + cp -af $(STAGING_DIR)/mosquitto/usr/local/include/* $(STAGING_INCLUDE) + cp -af $(STAGING_DIR)/mosquitto/usr/local/lib/* $(STAGING_LIB) diff --git a/external/json b/external/json new file mode 160000 index 0000000000000000000000000000000000000000..db78ac1d7716f56fc9f1b030b715f872f93964e4 --- /dev/null +++ b/external/json @@ -0,0 +1 @@ +Subproject commit db78ac1d7716f56fc9f1b030b715f872f93964e4 diff --git a/external/mosquitto b/external/mosquitto new file mode 160000 index 0000000000000000000000000000000000000000..02182aff6598319e64a56eea13241fb0fb985dd6 --- /dev/null +++ b/external/mosquitto @@ -0,0 +1 @@ +Subproject commit 02182aff6598319e64a56eea13241fb0fb985dd6