summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHans Nilsson <hans@erlang.org>2021-03-26 10:27:11 +0100
committerHans Nilsson <hans@erlang.org>2021-03-26 14:53:12 +0100
commit68049fb610c30f6fc15ed399fc2ab00387b1b537 (patch)
treef0c3956476715b2dc0184a9245b0cf079ebbd9fd
parent94c9738e10326554af80d128c76e4bded1c7b983 (diff)
downloaderlang-68049fb610c30f6fc15ed399fc2ab00387b1b537.tar.gz
ssh: Update Makefile with automatic dependencies
-rw-r--r--lib/ssh/src/Makefile112
1 files changed, 27 insertions, 85 deletions
diff --git a/lib/ssh/src/Makefile b/lib/ssh/src/Makefile
index 4f4b55f5c5..29d77fa6f5 100644
--- a/lib/ssh/src/Makefile
+++ b/lib/ssh/src/Makefile
@@ -126,6 +126,17 @@ INTERNAL_HRL_FILES = \
ssh_transport.hrl \
ssh_xfer.hrl
+DEPDIR=$(ERL_TOP)/lib/ssh/src/deps
+DEP_FILE=$(DEPDIR)/ssh.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
# ----------------------------------------------------
@@ -143,11 +154,22 @@ ERL_COMPILE_FLAGS += -I$(ERL_TOP)/lib/kernel/src \
$(TARGET_FILES): $(BEHAVIOUR_TARGET_FILES_2)
$(BEHAVIOUR_TARGET_FILES_2): $(BEHAVIOUR_TARGET_FILES_1)
-debug opt: $(TARGET_FILES) $(APP_TARGET) $(APPUP_TARGET)
+$(DEP_FILE): $(ERL_FILES)
+ @echo SED $(TARGET) $(ERL_TOP_NATIVE)
+ $(gen_verbose)erlc -M $(ERL_FILES) \
+ | sed "s@[a-zA-Z]\?$(ERL_TOP_NATIVE)@../../..@g" \
+ | sed "s/\.$(EMULATOR)/\.$$\(EMULATOR\)/" \
+ | sed 's@^ssh_@$$(EBIN)/ssh_@' \
+ | sed 's@^sshc_@$$(EBIN)/sshc_@' \
+ | sed 's@^sshd_@$$(EBIN)/sshd_@' \
+ > $(DEP_FILE)
+
+debug opt: $(TARGET_FILES) $(APP_TARGET) $(APPUP_TARGET) $(DEP_FILE)
clean:
rm -f $(TARGET_FILES) $(APP_TARGET) $(APPUP_TARGET) $(BEHAVIOUR_TARGET_FILES)
rm -f errs core *~
+ rm -rf $(DEPDIR)
$(APP_TARGET): $(APP_SRC) ../vsn.mk
$(vsn_verbose)sed -e 's;%VSN%;$(VSN);' $< > $@
@@ -174,87 +196,7 @@ release_spec: opt
release_docs_spec:
-
-deps:
- erlc -M $(ERL_FILES) \
- | sed 's@$(ERL_TOP)/lib@../..@g' \
- | sed 's/\.$(EMULATOR)/\.$$\(EMULATOR\)/' \
- | sed 's@^ssh_@$$(EBIN)/ssh_@'
-
-ssh.$(EMULATOR): ssh.erl ssh.hrl ssh_connect.hrl \
- ../../public_key/include/public_key.hrl \
- ../../public_key/include/OTP-PUB-KEY.hrl \
- ../../public_key/include/PKCS-FRAME.hrl \
- ../../kernel/include/file.hrl
-$(EBIN)/ssh_sup.$(EMULATOR): ssh_sup.erl
-sshc_sup.$(EMULATOR): sshc_sup.erl
-sshd_sup.$(EMULATOR): sshd_sup.erl ssh.hrl
-$(EBIN)/ssh_connection_sup.$(EMULATOR): ssh_connection_sup.erl
-$(EBIN)/ssh_connection.$(EMULATOR): ssh_connection.erl ssh.hrl ssh_connect.hrl \
- ssh_transport.hrl
-$(EBIN)/ssh_connection_handler.$(EMULATOR): ssh_connection_handler.erl ssh.hrl \
- ssh_transport.hrl ssh_auth.hrl ssh_connect.hrl ssh_fsm.hrl
-$(EBIN)/ssh_fsm_kexint.$(EMULATOR): ssh.hrl \
- ssh_transport.hrl ssh_auth.hrl ssh_connect.hrl ssh_fsm.hrl
-$(EBIN)/ssh_fsm_userauth_client.$(EMULATOR): ssh.hrl \
- ssh_transport.hrl ssh_auth.hrl ssh_connect.hrl ssh_fsm.hrl
-$(EBIN)/ssh_fsm_userauth_server.$(EMULATOR): ssh.hrl \
- ssh_transport.hrl ssh_auth.hrl ssh_connect.hrl ssh_fsm.hrl
-$(EBIN)/ssh_shell.$(EMULATOR): ssh_shell.erl ssh_connect.hrl
-$(EBIN)/ssh_system_sup.$(EMULATOR): ssh_system_sup.erl ssh.hrl
-$(EBIN)/ssh_subsystem_sup.$(EMULATOR): ssh_subsystem_sup.erl
-$(EBIN)/ssh_channel_sup.$(EMULATOR): ssh_channel_sup.erl ssh.hrl
-$(EBIN)/ssh_acceptor_sup.$(EMULATOR): ssh_acceptor_sup.erl ssh.hrl
-$(EBIN)/ssh_acceptor.$(EMULATOR): ssh_acceptor.erl ssh.hrl
-$(EBIN)/ssh_agent.$(EMULATOR): ssh_agent.erl ssh.hrl ssh_agent.hrl
-$(EBIN)/ssh_app.$(EMULATOR): ssh_app.erl
-$(EBIN)/ssh_auth.$(EMULATOR): ssh_auth.erl \
- ../../public_key/include/public_key.hrl \
- ../../public_key/include/OTP-PUB-KEY.hrl \
- ../../public_key/include/PKCS-FRAME.hrl \
- ssh.hrl ssh_auth.hrl ssh_transport.hrl
-$(EBIN)/ssh_bits.$(EMULATOR): ssh_bits.erl ssh.hrl
-$(EBIN)/ssh_cli.$(EMULATOR): ssh_cli.erl ssh.hrl ssh_connect.hrl
-$(EBIN)/ssh_file.$(EMULATOR): ssh_file.erl \
- ../../public_key/include/public_key.hrl \
- ../../public_key/include/OTP-PUB-KEY.hrl \
- ../../public_key/include/PKCS-FRAME.hrl \
- ../../kernel/include/file.hrl ssh.hrl
-$(EBIN)/ssh_io.$(EMULATOR): ssh_io.erl ssh.hrl
-$(EBIN)/ssh_info.$(EMULATOR): ssh_info.erl
-$(EBIN)/ssh_message.$(EMULATOR): ssh_message.erl \
- ../../public_key/include/public_key.hrl \
- ../../public_key/include/OTP-PUB-KEY.hrl \
- ../../public_key/include/PKCS-FRAME.hrl \
- ssh.hrl ssh_connect.hrl ssh_auth.hrl ssh_transport.hrl
-$(EBIN)/ssh_no_io.$(EMULATOR): ssh_no_io.erl ssh_transport.hrl
-$(EBIN)/ssh_sftp.$(EMULATOR): ssh_sftp.erl \
- ../../kernel/include/file.hrl ssh.hrl \
- ssh_xfer.hrl
-$(EBIN)/ssh_sftpd.$(EMULATOR): ssh_sftpd.erl \
- ../../kernel/include/file.hrl ssh.hrl \
- ssh_xfer.hrl
-$(EBIN)/ssh_sftpd_file.$(EMULATOR): ssh_sftpd_file.erl
-$(EBIN)/ssh_transport.$(EMULATOR): ssh_transport.erl \
- ../../public_key/include/public_key.hrl \
- ../../public_key/include/OTP-PUB-KEY.hrl \
- ../../public_key/include/PKCS-FRAME.hrl \
- ../../kernel/include/inet.hrl \
- ssh_transport.hrl ssh.hrl
-$(EBIN)/ssh_xfer.$(EMULATOR): ssh_xfer.erl ssh.hrl ssh_xfer.hrl
-$(EBIN)/ssh_sftpd_file_api.$(EMULATOR): ssh_sftpd_file_api.erl
-$(EBIN)/ssh_client_channel.$(EMULATOR): ssh_client_channel.erl ssh_connect.hrl
-$(EBIN)/ssh_channel.$(EMULATOR): ssh_channel.erl ssh_connect.hrl
-$(EBIN)/ssh_daemon_channel.$(EMULATOR): ssh_daemon_channel.erl
-$(EBIN)/ssh_server_channel.$(EMULATOR): ssh_server_channel.erl
-$(EBIN)/ssh_client_key_api.$(EMULATOR): ssh_client_key_api.erl \
- ../../public_key/include/public_key.hrl \
- ../../public_key/include/OTP-PUB-KEY.hrl \
- ../../public_key/include/PKCS-FRAME.hrl \
- ssh.hrl
-$(EBIN)/ssh_server_key_api.$(EMULATOR): ssh_server_key_api.erl \
- ../../public_key/include/public_key.hrl \
- ../../public_key/include/OTP-PUB-KEY.hrl \
- ../../public_key/include/PKCS-FRAME.hrl \
- ssh.hrl
-
+# ----------------------------------------------------
+# Dependencies
+# ----------------------------------------------------
+-include $(DEP_FILE)