From 48b8f366dd6cff8b1ccc9bd8e7b4b924153a7d88 Mon Sep 17 00:00:00 2001 From: Eren Terzioglu Date: Mon, 30 Dec 2024 09:41:28 +0100 Subject: [PATCH] Move debug_info target implementation to apps --- Makefile | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/Makefile b/Makefile index b2b90c7c49e..13cf0c494bd 100644 --- a/Makefile +++ b/Makefile @@ -47,6 +47,7 @@ all: $(BIN) .PHONY: import install dirlinks export .depdirs preconfig depend clean distclean .PHONY: context postinstall clean_context context_all postinstall_all register register_all +.PHONY: checkpython3 debug_info .PRECIOUS: $(BIN) $(foreach SDIR, $(CONFIGURED_APPS), $(eval $(call SDIR_template,$(SDIR),all))) @@ -206,6 +207,41 @@ endif endif endif +# checkpython3: Checks python is in PATH + +checkpython3: + @if [ -z "$$(which python3)" ]; then \ + echo "ERROR: python3 not found in PATH"; \ + echo " Please install python3 or fix the PATH"; \ + exit 1; \ + fi + +SYSINFO_PARSE_FLAGS = "$(realpath $(TOPDIR))" +SYSINFO_PARSE_FLAGS += "-f$(CONFIG_APPS_DIR)/system/nxdiag/sysinfo.h" + +SYSINFO_FLAGS = "-c" +SYSINFO_FLAGS += "-p" +SYSINFO_FLAGS += -f \""$(shell echo '$(CFLAGS)' | sed 's/"/\\\\\\"/g')"\" +SYSINFO_FLAGS += \""$(shell echo '$(CXXFLAGS)' | sed 's/"/\\\\\\"/g')"\" +SYSINFO_FLAGS += \""$(shell echo '$(LDFLAGS)' | sed 's/"/\\\\\\"/g')"\" + +ifneq ($(findstring esp,$(CONFIG_ARCH_CHIP)),) +ARCH_ESP_HALDIR = $(TOPDIR)$(DELIM)arch$(DELIM)$(CONFIG_ARCH)$(DELIM)src$(DELIM)chip$(DELIM)esp-hal-3rdparty +SYSINFO_FLAGS += --espressif "$(TOPDIR)" "$(ARCH_ESP_HALDIR)" +SYSINFO_FLAGS += "--espressif_chip" +endif + +# debug_info: Parse nxdiag example output file (sysinfo.h) and print + +debug_info: checkpython3 + echo "Eren" + @if [[ ! -f "$(CONFIG_APPS_DIR)/system/nxdiag/sysinfo.h" ]]; then \ + echo "file $(CONFIG_APPS_DIR)/system/nxdiag/sysinfo.h not exists"; \ + python3 $(CONFIG_APPS_DIR)/tools/host_sysinfo.py $(SYSINFO_FLAGS) \ + $(realpath $(TOPDIR)) > $(CONFIG_APPS_DIR)/system/nxdiag/sysinfo.h; \ + fi + @python3 $(CONFIG_APPS_DIR)/tools/parse_sysinfo.py $(SYSINFO_PARSE_FLAGS) + .depdirs: $(foreach SDIR, $(CONFIGURED_APPS), $(SDIR)_depend) .depend: Makefile .depdirs