From 6b0837639970bdf3c1c85e340a5fd750a2f4c3f9 Mon Sep 17 00:00:00 2001 From: Simon Cornish <7t9jna402@sneakemail.com> Date: Thu, 21 Nov 2024 17:35:46 -0800 Subject: [PATCH] Add dependencies to inets --- lib/inets/src/.gitignore | 1 + lib/inets/src/http_client/Makefile | 28 ++++++++++++++++++++++++++- lib/inets/src/http_lib/Makefile | 29 +++++++++++++++++++++++++++- lib/inets/src/http_server/Makefile | 31 +++++++++++++++++++++++++++++- lib/inets/src/inets_app/Makefile | 31 +++++++++++++++++++++++++++++- 5 files changed, 116 insertions(+), 4 deletions(-) create mode 100644 lib/inets/src/.gitignore diff --git a/lib/inets/src/.gitignore b/lib/inets/src/.gitignore new file mode 100644 index 000000000000..dd60386e3826 --- /dev/null +++ b/lib/inets/src/.gitignore @@ -0,0 +1 @@ +**/deps/ diff --git a/lib/inets/src/http_client/Makefile b/lib/inets/src/http_client/Makefile index 62f62792f082..eddac6dcd922 100644 --- a/lib/inets/src/http_client/Makefile +++ b/lib/inets/src/http_client/Makefile @@ -58,6 +58,17 @@ ERL_FILES = $(MODULES:%=%.erl) TARGET_FILES= $(MODULES:%=$(EBIN)/%.$(EMULATOR)) +DEPDIR=deps +DEP_FILE=$(DEPDIR)/http_client.d +$(shell mkdir -p $(dir $(DEP_FILE)) >/dev/null) + +ifeq ($(TARGET), win32) + # Native path without C: ignore driveletter case + ERL_TOP_NATIVE = $(shell w32_path.sh -m $(ERL_TOP) | sed "s@[a-zA-Z]:@:@") +else + ERL_TOP_NATIVE = $(ERL_TOP) +endif + # ---------------------------------------------------- # FLAGS @@ -77,11 +88,14 @@ ERL_COMPILE_FLAGS += \ # Targets # ---------------------------------------------------- -$(TYPES): $(TARGET_FILES) +$(TYPES): $(TARGET_FILES) $(DEP_FILE) + +deps: $(DEP_FILE) clean: rm -f $(TARGET_FILES) rm -f core + rm -rf $(DEPDIR) docs: @@ -104,5 +118,17 @@ info: @echo "INETS_FLAGS = $(INETS_FLAGS)" @echo "ERL_COMPILE_FLAGS = $(ERL_COMPILE_FLAGS)" +$(DEP_FILE): $(ERL_FILES) + @echo SED $(TARGET) $(ERL_TOP_NATIVE) + $(gen_verbose)erlc -M $(ERL_FILES) \ + | perl -pe "s@ [a-zA-Z]?$(ERL_TOP_NATIVE)/(?:bootstrap/)?lib/([^/]+)@ ../../../\1@g" 2> /dev/null \ + | sed "s/\.$(EMULATOR)/\.$$\(EMULATOR\)/" \ + | sed 's@^httpc@$$(EBIN)/httpc@' \ + > $(DEP_FILE) +# ---------------------------------------------------- +# Dependencies +# ---------------------------------------------------- +-include $(DEP_FILE) + diff --git a/lib/inets/src/http_lib/Makefile b/lib/inets/src/http_lib/Makefile index 481c4f66ebc8..d766b672803c 100644 --- a/lib/inets/src/http_lib/Makefile +++ b/lib/inets/src/http_lib/Makefile @@ -55,6 +55,17 @@ ERL_FILES = $(MODULES:%=%.erl) TARGET_FILES= $(MODULES:%=$(EBIN)/%.$(EMULATOR)) +DEPDIR=deps +DEP_FILE=$(DEPDIR)/http_lib.d +$(shell mkdir -p $(dir $(DEP_FILE)) >/dev/null) + +ifeq ($(TARGET), win32) + # Native path without C: ignore driveletter case + ERL_TOP_NATIVE = $(shell w32_path.sh -m $(ERL_TOP) | sed "s@[a-zA-Z]:@:@") +else + ERL_TOP_NATIVE = $(ERL_TOP) +endif + # ---------------------------------------------------- # FLAGS @@ -73,11 +84,14 @@ ERL_COMPILE_FLAGS += \ # Targets # ---------------------------------------------------- -$(TYPES): $(TARGET_FILES) +$(TYPES): $(TARGET_FILES) $(DEP_FILE) + +deps: $(DEP_FILE) clean: rm -f $(TARGET_FILES) rm -f core + rm -rf $(DEPDIR) docs: @@ -101,4 +115,17 @@ info: @echo "INETS_DEBUG = $(INETS_DEBUG)" @echo "INETS_FLAGS = $(INETS_FLAGS)" @echo "ERL_COMPILE_FLAGS = $(ERL_COMPILE_FLAGS)" +$(DEP_FILE): $(ERL_FILES) + @echo SED $(TARGET) $(ERL_TOP_NATIVE) + $(gen_verbose)erlc -M $(ERL_FILES) \ + | perl -pe "s@ [a-zA-Z]?$(ERL_TOP_NATIVE)/(?:bootstrap/)?lib/([^/]+)@ ../../../\1@g" 2> /dev/null \ + | sed "s/\.$(EMULATOR)/\.$$\(EMULATOR\)/" \ + | sed 's@^http_@$$(EBIN)/http_@' \ + > $(DEP_FILE) + + +# ---------------------------------------------------- +# Dependencies +# ---------------------------------------------------- +-include $(DEP_FILE) diff --git a/lib/inets/src/http_server/Makefile b/lib/inets/src/http_server/Makefile index abf8413f3370..d027106219fc 100644 --- a/lib/inets/src/http_server/Makefile +++ b/lib/inets/src/http_server/Makefile @@ -98,6 +98,17 @@ BEHAVIOUR_TARGET_FILES= $(BEHAVIOUR_MODULES:%=$(EBIN)/%.$(EMULATOR)) INETS_FLAGS = -D'SERVER_SOFTWARE="$(APPLICATION)/$(VSN)"' +DEPDIR=deps +DEP_FILE=$(DEPDIR)/http_server.d +$(shell mkdir -p $(dir $(DEP_FILE)) >/dev/null) + +ifeq ($(TARGET), win32) + # Native path without C: ignore driveletter case + ERL_TOP_NATIVE = $(shell w32_path.sh -m $(ERL_TOP) | sed "s@[a-zA-Z]:@:@") +else + ERL_TOP_NATIVE = $(ERL_TOP) +endif + # ---------------------------------------------------- # FLAGS @@ -117,11 +128,14 @@ ERL_COMPILE_FLAGS += \ # ---------------------------------------------------- $(TARGET_FILES): $(BEHAVIOUR_TARGET_FILES) -$(TYPES): $(TARGET_FILES) +$(TYPES): $(TARGET_FILES) $(DEP_FILE) + +deps: $(DEP_FILE) clean: rm -f $(TARGET_FILES) $(BEHAVIOUR_TARGET_FILES) rm -f core + rm -rf $(DEPDIR) docs: @@ -146,3 +160,18 @@ info: @echo "INETS_FLAGS = $(INETS_FLAGS)" @echo "ERL_COMPILE_FLAGS = $(ERL_COMPILE_FLAGS)" +$(DEP_FILE): $(ERL_FILES) + @echo SED $(TARGET) $(ERL_TOP_NATIVE) + $(gen_verbose)erlc -M $(ERL_FILES) \ + | perl -pe "s@ [a-zA-Z]?$(ERL_TOP_NATIVE)/(?:bootstrap/)?lib/([^/]+)@ ../../../\1@g" 2> /dev/null \ + | sed "s/\.$(EMULATOR)/\.$$\(EMULATOR\)/" \ + | sed 's@^httpd@$$(EBIN)/httpd@' \ + | sed 's@^mod_@$$(EBIN)/mod_@' \ + > $(DEP_FILE) + + +# ---------------------------------------------------- +# Dependencies +# ---------------------------------------------------- +-include $(DEP_FILE) + diff --git a/lib/inets/src/inets_app/Makefile b/lib/inets/src/inets_app/Makefile index 405e86105a4e..1ee2f9507d3b 100644 --- a/lib/inets/src/inets_app/Makefile +++ b/lib/inets/src/inets_app/Makefile @@ -70,6 +70,17 @@ APP_TARGET = $(EBIN)/$(APP_FILE) APPUP_SRC = $(APPUP_FILE).src APPUP_TARGET = $(EBIN)/$(APPUP_FILE) +DEPDIR=deps +DEP_FILE=$(DEPDIR)/inets_app.d +$(shell mkdir -p $(dir $(DEP_FILE)) >/dev/null) + +ifeq ($(TARGET), win32) + # Native path without C: ignore driveletter case + ERL_TOP_NATIVE = $(shell w32_path.sh -m $(ERL_TOP) | sed "s@[a-zA-Z]:@:@") +else + ERL_TOP_NATIVE = $(ERL_TOP) +endif + # ---------------------------------------------------- # FLAGS @@ -86,11 +97,14 @@ ERL_COMPILE_FLAGS += \ # Targets # ---------------------------------------------------- -$(TYPES): $(TARGET_FILES) +$(TYPES): $(TARGET_FILES) $(DEP_FILE) + +deps: $(DEP_FILE) clean: rm -f $(TARGET_FILES) rm -f core + rm -rf $(DEPDIR) docs: @@ -127,3 +141,18 @@ info: @echo "INETS_DEBUG = $(INETS_DEBUG)" @echo "INETS_FLAGS = $(INETS_FLAGS)" @echo "ERL_COMPILE_FLAGS = $(ERL_COMPILE_FLAGS)" + +$(DEP_FILE): $(ERL_FILES) + @echo SED $(TARGET) $(ERL_TOP_NATIVE) + $(gen_verbose)erlc -M $(ERL_FILES) \ + | perl -pe "s@ [a-zA-Z]?$(ERL_TOP_NATIVE)/(?:bootstrap/)?lib/([^/]+)@ ../../../\1@g" 2> /dev/null \ + | sed "s/\.$(EMULATOR)/\.$$\(EMULATOR\)/" \ + | sed 's@^inets@$$(EBIN)/inets@' \ + > $(DEP_FILE) + + +# ---------------------------------------------------- +# Dependencies +# ---------------------------------------------------- +-include $(DEP_FILE) +