File 0423-megaco-example-simple-Add-dialyzer-make-targets.patch of Package erlang

From 6db3c618ff40e3d36d3415505879c9ea8a580cfa Mon Sep 17 00:00:00 2001
From: Micael Karlberg <bmk@erlang.org>
Date: Mon, 11 Jul 2022 17:37:22 +0200
Subject: [PATCH 3/7] [megaco|example|simple] Add dialyzer (make) targets

OTP-18179
---
 lib/megaco/examples/simple/Makefile | 43 +++++++++++++++++++++++++++++
 1 file changed, 43 insertions(+)

diff --git a/lib/megaco/examples/simple/Makefile b/lib/megaco/examples/simple/Makefile
index 6dab19e25f..fc6fa24635 100644
--- a/lib/megaco/examples/simple/Makefile
+++ b/lib/megaco/examples/simple/Makefile
@@ -100,6 +100,19 @@ MGC_START_ARGS += "{debug,false}"
 endif
 
 
+DIA_PLT      = megaco_example_simple.plt
+DIA_ANALYSIS = $(basename $(DIA_PLT)).dialyzer_analysis
+ifeq ($(DIAW_EH),true)
+DIA_WARNINGS += -Werror_handling
+endif
+ifeq ($(DIAW_US),true)
+DIA_WARNINGS += -Wunderspecs
+endif
+ifeq ($(DIAW_UR),true)
+DIA_WARNINGS += -Wunmatched_returns
+endif
+
+
 # ----------------------------------------------------
 # Targets
 # ----------------------------------------------------
@@ -117,6 +130,36 @@ docs:
 info: 
 	@echo "MEGACO_ROOT_DIR = $(MEGACO_ROOT_DIR)"
 
+
+dclean:
+	rm -f $(DIA_PLT)
+	rm -f $(DIA_ANALYSIS)
+
+dialyzer_plt: $(DIA_PLT)
+
+$(DIA_PLT): $(ERL_FILES)
+	@echo "Building ($(basename $(DIA_PLT))) plt file"
+	@dialyzer --build_plt \
+                  --output_plt $@ \
+                  -r ../../ebin \
+                     ../../../../lib/asn1/ebin \
+                     ../../../../lib/et/ebin \
+                     ../../../../lib/kernel/ebin \
+                     ../../../../lib/stdlib/ebin \
+                     ../../../../lib/debugger/ebin \
+                     ../../../../lib/runtime_tools/ebin \
+                     ../../../../erts/preloaded/ebin \
+                  --output $(DIA_ANALYSIS) \
+                  --verbose
+
+dialyzer: $(DIA_PLT)
+	@echo "Running dialyzer on $(basename $(DIA_PLT))"
+	@dialyzer --plt $< \
+                  -r ../../ebin \
+                  $(DIA_WARNINGS) \
+                  --verbose
+
+
 # ----------------------------------------------------
 # Special Build Targets
 # ----------------------------------------------------
-- 
2.35.3

openSUSE Build Service is sponsored by